Rev. 1.50 166 August 28, 2017 Rev. 1.50 167 August 28, 2017
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
HT66F0175/HT66F0185
A/D Flash MCU with EEPROM
3
rd
bytehasbeencompletelyshiftedin,otherwisethe3
rd
bytewillbediscardedandanoverrunerror
OERRwillbesubsequentlyindicated.Thestepstoinitiateadatatransfercanbesummarizedas
follows:
• MakethecorrectselectionoftheBNO,PRT,PRENandSTOPSbitstodenetherequiredword
length,paritytypeandnumberofstopbits.
• SetuptheBRGregistertoselectthedesiredbaudrate.
• SettheRXENbittoensurethattheUARTreceiverisenabledandtheRXpinisusedasaUART
receiverpin.
Atthispointthereceiverwillbeenabledwhichwillbegintolookforastartbit.
Whenacharacterisreceived,thefollowingsequenceofeventswilloccur:
• TheRXIFbitintheUSRregisterwillbesetthenRXRregisterhasdataavailable,atleastone
morecharactercanberead.
• WhenthecontentsoftheshiftregisterhavebeentransferredtotheRXRregisterandiftheRIE
bitisset,thenaninterruptwillbegenerated.
• Ifduringreception,aframeerror,noiseerror,parityerrororanoverrunerrorhasbeendetected,
thentheerroragscanbeset.
TheRXIFbitcanbeclearedusingthefollowingsoftwaresequence:
1.AUSRregisteraccess
2.ARXRregisterreadexecution
Receiving Break
AnybreakcharacterreceivedbytheUARTwillbemanagedasaframingerror.Thereceiverwill
countandexpectacertainnumberofbittimesasspeciedbythevaluesprogrammedintotheBNO
andSTOPSbits.Ifthebreakismuchlongerthan13bittimes,thereceptionwillbeconsideredas
completeafterthenumberofbittimesspeciedbyBNOandSTOPS.TheRXIFbitisset,FERR
isset,zerosareloadedintothereceivedataregister,interruptsaregeneratedifappropriateandthe
RIDLEbitisset.Ifalongbreaksignalhasbeendetectedandthereceiverhasreceivedastartbit,
thedatabitsandtheinvalidstopbit,whichsetstheFERRag,thereceivermustwaitforavalid
stopbitbeforelookingforthenextstartbit.Thereceiverwillnotmaketheassumptionthatthe
breakconditiononthelineisthenextstartbit.Abreakisregardedasacharacterthatcontainsonly
zeroswiththeFERRagset.Thebreakcharacterwillbeloadedintothebufferandnofurtherdata
willbereceiveduntilstopbitsarereceived.ItshouldbenotedthattheRIDLEreadonlyagwillgo
highwhenthestopbitshavenotyetbeenreceived.ThereceptionofabreakcharacterontheUART
registerswillresultinthefollowing:
• Theframingerrorag,FERR,willbeset.
• Thereceivedataregister,RXR,willbecleared.
• TheOERR,NF,PERR,RIDLEorRXIFagswillpossiblybeset.
Idle Status
Whenthereceiverisreadingdata,whichmeansitwillbeinbetweenthedetectionofastartbitand
thereadingofastopbit,thereceiverstatusagintheUSRregister,otherwiseknownastheRIDLE
ag,willhaveazerovalue.Inbetweenthereceptionofastopbitandthedetectionofthenextstart
bit,theRIDLEagwillhaveahighvalue,whichindicatesthereceiverisinanidlecondition.