Sys /2; Sys /4; Sys /8; Sys /16 - Holtek HT46RU67 Manual

A/d type 8-bit mcu with lcd
Table of Contents

Advertisement

¨
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.
·
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.
UCR2 BRGH Bit
Baud Rate
[64 (N + 1)]
The following tables show actual values of baud rate and error values for the two values of BRGH.
Baud Rate
K/BPS
BRG
0.3
207
1.2
51
2.4
25
4.8
12
9.6
6
19.2
2
38.4
1
57.6
0
¾
115.2
Rev. 1.30
0
1
f
f
SYS
SYS
[16 (N + 1)]
Baud Rates for BRGH=0
f
=4MHz
SYS
Error (%)
Kbaud
0.300
0.00
1.202
0.16
2.404
0.16
4.808
0.16
8.929
-6.99
20.83
8.51
¾
¾
62.5
8.51
¾
¾
Baud Rates and Error Values for BRGH = 0
39
HT46RU67/HT46CU67
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
²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 =
4000000
Giving a value for N =
x
(
4800 64
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
4000000
BR =
= 4808
[64(12 + 1)]
Therefore the error is equal to
f
=3.579545MHz
SYS
BRG
Kbaud
185
0.300
46
1.19
22
2.432
11
4.661
5
9.321
2
18.643
¾
1
0
55.93
¾
¾
f
- 1
SYS
(BRx64)
- 1 = 12.0208
)
-
= 0.16%
Error (%)
0.00
-0.83
1.32
-2.9
-2.9
-2.9
¾
-2.9
¾
June 10, 2014

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ht46cu67

Table of Contents