Rev. 2.50 250 June 22, 2017 Rev. 2.50 251 June 22, 2017
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
HT66F20/HT66F30/HT66F40/HT66F50/HT66F60
HT66FU30/HT66FU40/HT66FU50/HT66FU60
A/D Flash MCU with EEPROM
• Transmittingdata
WhentheUARTistransmittingdata,thedataisshiftedontheTXpinfromtheshiftregister,
withtheleastsignicantbitLSBrst.Inthetransmitmode,theTXRregisterformsabuffer
betweentheinternalbusandthetransmittershiftregister.Itshouldbenotedthatif9-bitdata
formathasbeenselected,thentheMSBwillbetakenfromtheTX8bitintheUCR1register.The
stepstoinitiateadatatransfercanbesummarizedasfollows:
♦
MakethecorrectselectionoftheBNO,PRT,PRENandSTOPSbitstodenetherequired
wordlength,paritytypeandnumberofstopbits.
♦
SetuptheBRGregistertoselectthedesiredbaudrate.
♦
SettheTXENbittoensurethattheUARTtransmitterisenabledandtheTXpinisusedasa
UARTtransmitterpin.
♦
AccesstheUSRregisterandwritethedatathatistobetransmittedintotheTXRregister.Note
thatthisstepwillcleartheTXIFbit.
Thissequenceofeventscannowberepeatedtosendadditionaldata.
ItshouldbenotedthatwhenTXIF=0,datawillbeinhibitedfrombeingwrittentotheTXR
register.ClearingtheTXIFagisalwaysachievedusingthefollowingsoftwaresequence:
1.AUSRregisteraccess
2.ATXRregisterwriteexecution
Theread-onlyTXIFagissetbytheUARThardwareandifsetindicatesthattheTXRregister
isemptyandthatotherdatacannowbewrittenintotheTXRregisterwithoutoverwritingthe
previousdata.IftheTEIEbitisset,thentheTXIFagwillgenerateaninterrupt.Duringadata
transmission,awriteinstructiontotheTXRregisterwillplacethedataintotheTXRregister,
whichwillbecopiedtotheshiftregisterattheendofthepresenttransmission.Whenthereisno
datatransmissioninprogress,awriteinstructiontotheTXRregisterwillplacethedatadirectly
intotheshiftregister,resultinginthecommencementofdatatransmission,andtheTXIFbit
beingimmediatelyset.Whenaframetransmissioniscomplete,whichhappensafterstopbits
aresentorafterthebreakframe,theTIDLEbitwillbeset.TocleartheTIDLEbitthefollowing
softwaresequenceisused:
1.AUSRregisteraccess
2.ATXRregisterwriteexecution
NotethatboththeTXIFandTIDLEbitsareclearedbythesamesoftwaresequence.
• Transmittingbreak
IftheTXBRKbitisset,thenthebreakcharacterswillbesentonthenexttransmission.Break
charactertransmissionconsistsofastartbit,followedby13×N"0"bits,whereN=1,2,etc.if
abreakcharacteristobetransmitted,thentheTXBRKbitmustberstsetbytheapplication
programandthenclearedtogeneratethestopbits.Transmittingabreakcharacterwillnot
generateatransmitinterrupt.Notethatabreakconditionlengthisatleast13bitslong.Ifthe
TXBRKbitiscontinuallykeptatalogichighlevel,thenthetransmittercircuitrywilltransmit
continuousbreakcharacters.AftertheapplicationprogramhasclearedtheTXBRKbit,the
transmitterwillnishtransmittingthelastbreakcharacterandsubsequentlysendoutoneortwo
stopbits.Theautomaticlogichighattheendofthelastbreakcharacterwillensurethatthestart
bitofthenextframeisrecognized.