English
Language : 

UPSD33XX Datasheet, PDF (77/231 Pages) STMicroelectronics – Fast 8032 MCU with Programmable Logic
uPSD33xx
Baud Rate Generator Mode. The RCLK and/or
TCLK Bits in the SFR T2CON allow the transmit
and receive baud rates on serial port UART0 to be
derived from either Timer 1 or Timer 2. Figure
27., page 80 illustrates Baud Rate Generator
Mode.
When TCLK = 0, Timer 1 is used as UART0’s
transmit baud generator. When TCLK = 1, Timer 2
will be the transmit baud generator. RCLK has the
same effect for UART0’s receive baud rate. With
these two bits, UART0 can have different receive
and transmit baud rates - one generated by Timer
1, the other by Timer 2.
Note: Bits RCLK1 and TCLK1 in the SFR named
PCON (see PCON: Power Control Register (SFR
87h, reset value 00h), page 50) have identical
functions as RCLK and TCLK but they apply to
UART1 instead. For simplicity in the following dis-
cussions about baud rate generation, no suffix will
be used when referring to SFR registers and bits
related to UART0 or UART1, since each UART in-
terface has identical operation. Example, TCLK or
TCLK1 will be referred to as just TCLK.
The Baud Rate Generator Mode is similar to the
Auto-reload Mode, in that a roll over in TH2 causes
the Timer 2 registers, TH2 and TL2, to be reloaded
with the 16-bit value in Registers RCAP2H and
RCAP2L, which are preset with firmware.
The baud rates in UART Modes 1 and 3 are deter-
mined by Timer 2’s overflow rate as follows:
UART Mode 1,3 Baud Rate =
Timer 2 Overflow Rate / 16
The timer can be configured for either “timer” or
“counter” operation. In the most typical applica-
tions, it is configured for “timer” operation (C/T2 =
0). “Timer” operation is a little different for Timer 2
when it's being used as a baud rate generator. In
this case, the baud rate is given by the formula:
UART Mode 1,3 Baud Rate =
fOSC/(32 x [65536 – [RCAP2H, RCAP2L]))
where [RCAP2H, RCAP2L] is the content of the
SFRs RCAP2H and RCAP2L taken as a 16-bit un-
signed integer.
A roll-over in TH2 does not set TF2, and will not
generate an interrupt. Therefore, the Timer Inter-
rupt does not have to be disabled when Timer 2 is
in the Baud Rate Generator Mode.
If EXEN2 is set, a 1-to-0 transition on pin T2X will
set the Timer 2 interrupt flag EXF2, but will not
cause a reload from RCAP2H and RCAP2L to
TH2 and TL2. Thus when Timer 2 is in use as a
baud rate generator, the pin T2X can be used as
an extra external interrupt, if desired.
When Timer 2 is running (TR2 = 1) in a “timer”
function in the Baud Rate Generator Mode, firm-
ware should not read or write TH2 or TL2. Under
these conditions the results of a read or write may
not be accurate. However, SFRs RCAP2H and
RCAP2L may be read, but should not be written,
because a write might overlap a reload and cause
write and/or reload errors. Timer 2 should be
turned off (clear TR2) before accessing Timer 2 or
Registers RCAP2H and RCAP2L, in this case.
Table 43., page 78 shows commonly used baud
rates and how they can be obtained from Timer 2,
with T2CON = 34h.
77/231