English
Language : 

DS80C320-MCG Datasheet, PDF (129/175 Pages) Dallas Semiconductor – High-Speed Microcontroller User Guide
High-Speed Microcontroller User’s Guide
TIMER/COUNTER 2 WITH OPTIONAL CAPTURE Figure 11-4
OSC INPUT TO TIMER
CLK MODE TIMER INPUT
DIVIDE BY 4 OSC/1
PMM1
OSC/16
PMM2
OSC/256
T2 = P1.0
TR2 = T2CON.2
T2EX = P1.1
DIVIDE T2M = CKCON.5
BY 12
0
C/ T2 = T2CON.1
DIVIDE
BY 4
1
0 CLK
0
78
15
TF2 =
TL2
TH2
T2CON.7
1
CAPTURE
RCAP2L RCAP2H
0
78
15
TIMER 2
INTERRUPT
EXEN2 = T2CON.3
EXF2 =
T2CON.6
16-bit Auto-reload Timer/Counter
This mode is illustrated in Figure 11-5a. When Timer 2 reaches an overflow state, i.e., rolls over from
FFFFh to 0000, it will set the TF2 Flag. This flag can generate an interrupt if enabled. In addition, the
timer will restore its starting value and begin timing (or counting) again. The starting value is preloaded
by software into the capture registers RCAP2L and RCAP2H. These registers cannot be used for capture
functions while also performing auto-reload, so these modes are mutually exclusive. Auto-reload is
invoked by the CP/ RL2 (T2CON.0) bit. When set to a logic 0, the timer is in auto-reload mode. When
CP/ RL2 is set to a logic 1, the timer is in capture mode described above. If the oscillator timebase is used
(C/ T2 = T2CON.1 = 0), the timer’s input may be selected to be oscillator cycles divided by either 12 or 4
as determined by T2M (CKCON.5). Otherwise, pulses on pin T2 (P1.0) are counted when C/ T2 = 1. As
in other modes, Counting or timing is enabled or disabled with TR2 (T2CON.2).
When in auto-reload mode, Timer 2 can also be forced to reload with the T2EX (P1.1) pin. A 1 to 0
transition will force a reload if enabled by the EXEN2 (T2CON.3) bit. If EXEN2 is set to a logic 1, then
a 1 to 0 transition on T2EX will cause a reload. Otherwise, the T2EX pin will be ignored.
129 of 175