![](http://datasheet.mmic.net.cn/340000/C517_datasheet_16463234/C517_34.png)
C517A
Semiconductor Group
32
Timer 2 Operation
Timer Mode : In timer function, the count rate is derived from the oscillator frequency. A prescaler
offers the possibility of selecting a count rate of 1/12 or 1/24 of the oscillator frequency.
Gated Timer Mode : In gated timer function, the external input pin P1.7/T2 operates as a gate to the
input of timer 2. lf T2 is high, the internal clock input is gated to the timer. T2 = 0 stops the counting
procedure. The external gate signal is sampled once every machine cycle.
Event Counter Mode : In the event counter function. the timer 2 is incremented in response to a 1-
to-0 transition at its corresponding external input pin P1.7/T2. In this function, the external input is
sampled every machine cycle. The maximum count rate is 1/24 of the oscillator frequency.Reload
of Timer 2 : Two reload modes are selectable:
In mode 0, when timer 2 rolls over from all 1’s to all 0’s, it not only sets TF2 but also causes the timer
2 registers to be loaded with the 16-bit value in the CRC register, which is preset by software.
In mode 1, a 16-bit reload from the CRC register is caused by a negative transition at the correspon-
ding input pin P1.5/T2EX.
Figure 12
Block Diagram of Timer 2
MCB03328
Programmable
Prescaler
OSC
T2PS
T2PS1
No input selected
Timer stop
0
0
0
1
1
0
1
1
Counter function
via ext. input P1.7/T2
Gated timer function
by ext. input P1.7/T2
Timer function
T2I1
T2I0
SFR T2CON
P1.7/T2
TL2
(8 Bits)
TH2
(8 Bits)
TF2
EXF2
Interrupt
EXEN2
Sync
P1.5/T2EX
Reload
Timer 2
Input Clock
1
1
_
_