User`s guide

UARTs LZ87010 Advance User’s Guide
10-8 1/15/03
10.1.3.1 Mode 0
In both UARTs, Mode 0 uses a fixed baud rate equal to PCLK.
10.1.3.2 Modes 1 and 3
UART 0 and 1 have a variable baud rate in these modes.
In UART 0, the baud rate is generated by setting Timer 1 to auto-reload mode (Timer
Mode 2). The formula for the baud rate is:
For example, if PCLK is 20 MHz (XTAL = 40 MHz) and PCON.SMOD is 0, a TH1 value
of 0 will give 2,441 baud (2,441 bits/s).
This equation can be restated as:
UART 1 uses a dedicated baud-rate generator, which is a 16-bit frequency divider that
divides PCLK by any integer in the range of 1 and 65,536. See Figure 10-7. The baud-rate
generator must be enabled by setting the ALTFEN1.UEN bit to ‘1’. The frequency divisor
is selected by writing to the register pair BRGCNTH and BRGCNTL. UART 1 has a range
of 19 baud to 1.25 Mbaud when the system oscillator is 40 MHz.
This equation can be restated as:
UART 0 Baud Rate
PCON.SMOD + 1()PCLK×
32 256 TH1()×
--------------------------------------------------------------------------=
TH1 256
PCON.SMOD + 1()PCLK×
32 Baud×
--------------------------------------------------------------------------=
UART 1 Baud Rate
PCLK
16 BRGCNT[H:L] + 1()×
------------------------------------------------------------------=
BRGCNT[H:L]
PCLK
16 Baud×
--------------------------- 1=
Figure 10-7. Baud Rate Generator, UART 1
LZ87010-83
ALTFEN1.UEN
PCLK
BRGCNTH
16-BIT COUNT
DOWN
COUNTER
N
N-1 UNDRFLW
CLK RESET
PRESET
BRGCNTL
8 8
16
16
1
DIVIDE-
BY-16
UART1 CLOCK