HT46RU67 Holtek Semiconductor Inc., HT46RU67 Datasheet - Page 39

no-image

HT46RU67

Manufacturer Part Number
HT46RU67
Description
Ht46ru67/ht46cu67 -- A/d Type 8-bit Mcu With Lcd
Manufacturer
Holtek Semiconductor Inc.
Datasheet
Rev. 1.00
Baud rate generator
To setup the speed of the serial data communication,
the UART function contains its own dedicated baud
rate generator. The baud rate is controlled by its own
internal free running 8-bit timer, the period of which is
determined by two factors. The first of these is the
value placed in the BRG register and the second is the
value of the BRGH bit within the UCR2 control regis-
ter. The BRGH bit decides, if the baud rate generator
is to be used in a high speed mode or low speed
mode, which in turn determines the formula that is
used to calculate the baud rate. The value in the BRG
register determines the division factor, N, which is
used in the following baud rate calculation formula.
Note that N is the decimal value placed in the BRG
register and has a range of between 0 and 255.
The following tables show actual values of baud rate and error values for the two values of BRGH.
Baud Rate
Baud Rate
UCR2 BRGH Bit
TXEN
The TXEN bit is the Transmitter Enable Bit. When
this bit is equal to 0 the transmitter will be disabled
with any pending transmissions being aborted. In
addition the buffer will be reset. In this situation the
TX pin can be used as a general purpose I/O pin. If
the TXEN bit is equal to 1 the transmitter will be
enabled and if the UARTEN bit is equal to 1 the
TX pin will be controlled by the UART. Clearing the
TXEN bit during a transmission will cause the trans-
mission to be aborted and will reset the transmitter.
If this occurs, the TX pin can be used as a general
purpose I/O pin.
K/BPS
115.2
19.2
38.4
57.6
0.3
1.2
2.4
4.8
9.6
BRG
207
51
25
12
6
2
1
0
[64 (N + 1)]
f
SYS
0
Baud Rates and Error Values for BRGH = 0
f
SYS
Kbaud
0.300
1.202
2.404
4.808
8.929
20.83
62.5
=4MHz
[16 (N + 1)]
f
SYS
1
Baud Rates for BRGH=0
Error (%)
-6.99
0.00
0.16
0.16
0.16
8.51
8.51
39
By programming the BRGH bit which allows selection
of the related formula and programming the required
value in the BRG register, the required baud rate can
be setup. Note that because the actual baud rate is
determined using a discrete value, N, placed in the
BRG register, there will be an error associated be-
tween the actual and requested value. The following
example shows how the BRG register value N and the
error value can be calculated.
Calculating the register and error values
For a clock frequency of 4MHz, and with BRGH set to
baud rate and the error value for a desired baud rate
of 4800.
From the above table the desired baud rate BR
Re-arranging this equation gives N
Giving a value for N
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
Therefore the error is equal to
0 determine the BRG register value N, the actual
[64 (N + 1)]
f
[64(12 + 1)]
SYS
4000000
BRG
185
46
22
11
5
2
1
0
HT46RU67/HT46CU67
f
SYS
4808
=3.579545MHz
(
4000000
4800 64
Kbaud
18.643
0.300
2.432
4.661
9.321
55.93
1.19
x
)
February 27, 2008
1
(BRx64)
12.0208
Error (%)
f
SYS
-0.83
0.00
1.32
-2.9
-2.9
-2.9
-2.9
= 0.16%
1

Related parts for HT46RU67