On-Chip Peripheral Components
C513AO
User’s Manual
6-36
05.99
6.3.3.2 Using Timer 2 to Generate Baudrates
Timer 2 is selected as the baudrate generator by setting TCLK and/or RCLK in T2CON. Note that,
simultaneously, the baudrates can be different for transmit and receive. Setting RCLK and/or TCLK
puts Timer 2 into its Baudrate Generator Mode, as shown in Figure 6-20.
Figure 6-20
Timer 2 in Baudrate Generator Mode
Baudrate Generator Mode is similar to the Auto-Reload Mode, in that rollover in TH2 causes the
Timer 2 registers to be reloaded with the 16-bit value in registers RC2H and RC2L, which are preset
by software.
The baudrates in Modes 1 and 3 are determined by the overflow rate of Timer 2 as follows:
Modes 1 and 3 baudrate = Timer 2 overflow rate/16
The timer can be configured for either “timer” or “counter” operation. In the most typical applications,
it is configured for “timer” operation (C/T2 = 0). “Timer” operation is a little different for Timer 2 when
it is used as a baudrate generator. Normally, as a timer it would increment every machine cycle
MCS02586
EXF2
EXEN2
RC2L
RC2H
TL2
TH2
"Timer 2"
Interrupt
Control
C/T2 = 0
OSC
Control
TR2
C/T2 = 1
P1.0/T2
P1.1/T2EX
÷ 16
"0"
"1"
Timer 1
Overflow
"0"
"1"
"1"
"0"
÷ 16
÷ 2
TCLK
RCLK
SMOD
CLOCK
RX
CLOCK
TX
÷ 12