Common Features Description
Atmel 8051 Microcontrollers Hardware Manual 2-88
4316B–8051–02/04
depending on the system oscillator frequency and the value in the RCAP2H and
RCAP2L registers:
Note: X2 bit is located in the CKCON register.
In X2 mode, F
OSC
=F
XTAL
. In standard mode, F
OSC
=F
XTAL
/2.
For a 16 MHz system clock, timer 2 has a programmable frequency range of 61 Hz
(F
OSC
/2
16)
to 4 MHz (F
OSC
/4). The generated clock signal is brought out to the T2 pin
(P1.0).
Timer 2 is programmed for the clock-out mode as follows:
• Set T2OE bit in the T2MOD register.
• Clear C/T2
bit in the T2CON register.
• Determine the 16-bit reload value from the formula and enter it in the
RCAP2H/RCAP2L registers.
• Enter a 16-bit initial value in timer registers TH2/TL2. It can be the same as the
reload value, or different, depending on the application.
• To start the timer, set TR2 run control bit in the T2CON register.
It is possible to use timer 2 as a baud rate generator and a clock generator simulta-
neously. For this configuration, the baud rates and clock frequencies are not
independent since both functions use the values in the RCAP2H and RCAP2L registers.
Figure 2-18. Clock-out Mode
2.12.3 Timer Registers Table 2-8. T2CON Register - T2CON (S:C8h)
Timer 2 Control Register
Cl ock O utF r eque ncy
–
F
osc
2
x
×
4 65536
RCAP
2
H
–
RCAP
2
L
⁄()×
-----------------------------------------------------------------------------------------=
:6
EXF2
TR2
OVER-
FLOW
T2EX
TH2
(8-bit)
TL2
(8-bit)
TIMER 2
RCAP2H
(8-bit)
RCAP2L
(8-bit)
T2OE
T2
FCLK PERIPH
T2CON
T2CON
T2CON
T2MOD
INTERRUPT
QD
To gg l e
EXEN2
76543210
TF2 EXF2 RCLK TCLK EXEN2 TR2 C/T2# CP/RL2#