EasyManua.ls Logo

Holtek BS82B12A-3 - Page 125

Holtek BS82B12A-3
168 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rev. 1.20 124 January 23, 2015 Rev. 1.20 125 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
Calculating the Baud Rate and Error Values
Foraclockfrequencyof4MHz,andwithBRGHsetto"0"determinetheBRGregistervalueN,the
actualbaudrateandtheerrorvalueforadesiredbaudrateof4800.
FromtheabovetablethedesiredbaudrateBR=f
SYS
/[64(N+1)]
Re-arrangingthisequationgivesN=[f
SYS
/(BR×64)]-1
GivingavalueforN=[4000000/(4800×64)]-1=12.0208
Toobtaintheclosestvalue,adecimalvalueof12shouldbeplacedintotheBRGregister.Thisgives
anactualorcalculatedbaudratevalueofBR=4000000/[64×(12+1)]=4808
Thereforetheerrorisequalto(4808-4800)/4800=0.16%
ThefollowingtableshowsactualvaluesofbaudrateanderrorvaluesforthetwovaluesofBRGH.
Baud Rate
K/BPS
f
SYS
=8MHz
Baud Rates for BRGH=0 Baud Rates for BRGH=1
BRG Kbaud Error (%) BRG Kbaud Error (%)
0.3
1.2
103 1.202 0.16
2.4
51 2.404 0.16 207 2.404 0.16
4.8
25 4.808 0.16 103 4.808 0.16
9.6 12
9.615 0.16 51 9.615 0.16
19.2 6
17.8857 -6.99 25 19.231 0.16
38.4 2 41.667 8.51 12 38.462 0.16
57.6 1 62.500 8.51 8 55.556 -3.55
115.2 0 125 8.51 3 125 8.51
250 1 250 0
Baud Rates and Error Values
UART Setup and Control
Fordatatransfer,theUARTfunctionutilizesanon-return-to-zero,morecommonlyknownasNRZ,
format.Thisiscomposedofonestartbit,eightorninedatabits,andoneortwostopbits.Parity
issupportedbytheUARThardware,andcanbesetuptobeeven,oddornoparity.Forthemost
commondataformat,8databitsalongwithnoparityandonestopbit,denotedas8,N,1,isused
asthedefaultsetting,whichisthesettingatpower-on.Thenumberofdatabitsandstopbits,along
withtheparity,aresetupbyprogrammingthecorrespondingBNO,PRT,PREN,andSTOPSbits
intheUCR1register.Thebaudrateusedtotransmitandreceivedataissetupusingtheinternal
8-bitbaudrategenerator,whilethedataistransmittedandreceivedLSBrst.AlthoughtheUART
transmitterandreceiverarefunctionallyindependent,theybothusethesamedataformatandbaud
rate.Inallcasesstopbitswillbeusedfordatatransmission.

Table of Contents

Related product manuals