Rev. 1.20
124
�an�a�� 2�� 201�
Rev. 1.20
12�
�an�a�� 2�� 201�
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
4
MHz, 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 = [
4
000000 / (
48
00×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 =
4
000000 / [64× (12 + 1)] = 4808
Therefore the error is equal to (4808 -
48
00) /
48
00 = 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.�
—
—
—
—
—
—
1.2
10�
1.202
0.16
—
—
—
2.4
�1
2.404
0.16
207
2.404
0.16
4.8
2�
4.808
0.16
10�
4.808
0.16
9.6
12
9.61�
0.16
�1
9.61�
0.16
19.2
6
17.88�7
-6.99
2�
19.2�1
0.16
�8.4
2
41.667
8.�1
12
�8.462
0.16
�7.6
1
62.�00
8.�1
8
��.��6
-�.��
11�.2
0
12�
8.�1
�
12�
8.�1
2�0
—
—
—
1
2�0
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 first. 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.
Содержание BS82B12A-3
Страница 33: ...Rev 1 20 33 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...
Страница 34: ...Rev 1 20 34 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...
Страница 35: ...Rev 1 20 35 January 23 2015 BS82B12A 3 BS82C16A 3 BS82D20A 3 Touch Key 8 Bit Flash MCU with LED LCD Driver ...