User`s guide

8051-Compatible Timers LZ87010 Advance User’s Guide
7-4 1/15/03
7.1.1.3 Mode 2
Mode 2 is an 8-bit auto-reload mode. TL(x) is the 8-bit counter. TH(x) holds the reload
value. Whenever TL(x) overflows to zero, it is reloaded with TH(x). See Figure 7-4. The
auto-reload feature allows timers running Mode 2 to generate overflows at the rate of
(256 - TH1) PCLK cycles if internal clocking is used (CTIN0 or CTIN1 replace PCLK if
external clocking is used). For example, a TH1 value of 100 gives an overflow every 156
clock cycles, which with internal clocking and a PCLK rate of 20 MHz gives an overflow
interval of 0.05 to 12.8
µs (78,125 Hz to 20 MHz).
7.1.1.4 Mode 3
Mode 3 operates differently in Timer 0 and Timer 1. When Timer 1 is placed into Mode 3,
it halts. When Timer 0 is placed into Mode 3, it splits into two independent 8-bit timers, TL0
and TH0. Two bits are borrowed from Timer 1 and given to the timer using TH0. These bits
are TCON.TR1 (Timer Run Enable 1) and TCON.TF1 (Timer Interrupt Flag 1). See
Figure 7-5.
Because Timer 1 lacks an interrupt bit when Timer 0 is in Mode 3, it can only be used for
tasks that do not require interrupts. For example, Timer 1 can be put into Mode 2 and used
as a baud-rate generator for UART 0.
Because Timer 1 also lacks a run-enable bit when Timer 0 is in Mode 3, Timer 1 will run
continuously if placed in Modes 0-2. If placed in Mode 3, it stops. This mechanism allows
Timer 1 to be started and stopped when the TCON.TR1 bit is unavailable to it.
Figure 7-4. Timer Mode 2
LZ87010-103
TL(x)
TH(x)
TCON.TF(x)
TO INTERRUPT
CONTROLLER
f[7:0]
CLKTCLK(x)
OVF
RELOAD
n[7:0]PRE
f(n) = n+1
8
8
8
8