Rev. 1.20 126 January 23, 2015 Rev. 1.20 127 January 23, 2015
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
BS82B12A-3/BS82C16A-3/BS82D20A-3
Touch Key 8-Bit Flash MCU with LED/LCD Driver
Enabling/Disabling the UART Interface
Thebasicon/offfunctionoftheinternalUARTfunctioniscontrolledusingtheUARTENbitinthe
UCR1register.IftheUARTEN,TXENandRXENbitsareset,thenthesetwoUARTpinswillact
asnormalTXoutputpinandRXinputpinrespectively.IfnodataisbeingtransmittedontheTX
pin,thenitwilldefaulttoalogichighvalue.
ClearingtheUARTENbitwilldisabletheTXandRXpinsandallowthesetwopinstobeusedas
normalI/Oorotherpin-sharedfunctionalpins.WhentheUARTfunctionisdisabledthebufferwill
beresettoanemptycondition,atthesametimediscardinganyremainingresidualdata.Disabling
theUARTwillalsoresettheerrorandstatusagswithbitsTXEN,RXEN,TXBRK,RXIF,OERR,
FERR,PERRandNFbeingclearedwhilebitsTIDLE,TXIFandRIDLEwillbeset.Theremaining
controlbitsintheUCR1,UCR2andBRGregisterswillremainunaffected.IftheUARTENbitin
theUCR1registerisclearedwhiletheUARTisactive,thenallpendingtransmissionsandreceptions
willbeimmediatelysuspendedandtheUARTwillberesettoaconditionasdenedabove.Ifthe
UARTisthensubsequentlyre-enabled,itwillrestartagaininthesameconguration.
Data, Parity and Stop Bit Selection
Theformatofthedatatobetransferrediscomposedofvariousfactorssuchasdatabitlength,
parityon/off,paritytype,addressbitsandthenumberofstopbits.Thesefactorsaredeterminedby
thesetupofvariousbitswithintheUCR1register.TheBNObitcontrolsthenumberofdatabits
whichcanbesettoeither8or9,thePRTbitcontrolsthechoiceofoddorevenparity,thePREN
bitcontrolstheparityon/offfunctionandtheSTOPSbitdecideswhetheroneortwostopbitsareto
beused.Thefollowingtableshowsvariousformatsfordatatransmission.Theaddressbitidenties
theframeasanaddresscharacter.Thenumberofstopbits,whichcanbeeitheroneortwo,is
independentofthedatalengthandareonlytobeusedforTransmitter.Thereisonlyonestopbitfor
Receiver.
Start Bit Data Bits Address Bits Parity Bits Stop Bit
Example of 8-bit Data Formats
1 8 0 0 1
1 7 0 1 1
1 7 1 0 1
Example of 9-bit Data Formats
1 9 0 0 1
1 8 0 1 1
1 8 1 0 1
Transmitter Receiver Data Format
Thefollowingdiagramshowsthetransmitandreceivewaveformsforboth8-bitand9-bitdata
formats.
8-Bit Data Format
9-Bit Data Format