English
Language : 

DS80C320-MCG Datasheet, PDF (128/175 Pages) Dallas Semiconductor – High-Speed Microcontroller User Guide
TIMER 2 CAPTURE REGISTERS SUMMARY
High-Speed Microcontroller User’s Guide
LEAST SIGNIFICANT
RCAP2L; CAh
BYTE CAPTURE OF TIMER 2
RCAP2L.7-0
This register is used to capture the TL2 value when Timer 2 is
configured in capture mode. RCAP2L is also used as the LSB of a
16-bit reload value when Timer 2 is configured in auto-reload mode.
MOST SIGNIFICANT
RCAP2H; CBh
BYTE CAPTURE OF TIMER 2
RCAP2H.7-0
This register is used to capture the TH2 value when Timer 2 is
configured in capture mode. RCAP2H is also used as the MSB of a
16-bit reload value when Timer 2 is configured in auto-reload mode.
TIMER 2 MODES
As is seen in the register descriptions, Timer 2 has several abilities not found in Timers 0 and 1.
However, it does not offer the 13-bit and dual 8-bit modes. Thus it runs in 16-bit mode at all times. Also
note that instead of offering an 8-bit auto-reload mode, Timer 2 has a 16-bit auto-reload mode. This
mode uses the Timer Capture registers to hold the reload values. The modes available on Timer 2 are
described below.
16-bit Timer/Counter
In this mode, Timer 2 performs a simple timer or counter function where it behaves similarly to mode 1
of Timers 0 and 1, but uses 16 instead of 8 bits. This mode, along with the optional capture mode
described below, is illustrated in Figure 11-4. The 16-bit count values are found in TL2 and TH2 Special
Function Registers (addresses 0CCh and 0CDh respectively). The selection of whether a Timer or
Counter function is performed is made using the bit C/ T2 (T2CON.1). When C/ T2 is set to a logic 1,
Timer 2 behaves as a counter where it counts 1 to 0 transitions at the T2 (P1.0) pin. When C/ T2 is set to
a logic 0, Timer 2 functions as a timer where it counts the oscillator cycles divided by either 12 or 4 as
determined by bit T2M (T2CON.5). Timing or counting is enabled by setting bit TR2 (T2CON.2) to 1,
and disabled by setting it to 0. When the counter rolls over from FFFFh to 0000h, the TF2 flag
(T2CON.7) is set and will cause an interrupt if Timer 2’s interrupt is enabled.
16-bit Timer with Capture
A diagram of Timer 2’s Capture Mode is shown in Figure 11-4. In this mode, the timer performs basically
the same 16-bit timer/counter function described above. However, a 1 to 0 transition on T2EX (pin P1.1)
causes the value in Timer 2 to be transferred into the capture registers if enabled by EXEN2 (T2CON.3).
The capture registers, RCAP2L and RCAP2H, correspond to TL2 and TH2 respectively. The capture
function is enabled by the CP/ RL2 (T2CON.0) bit. When set to a logic 1, the timer is in capture mode as
described. When set to a logic 0, the timer is in auto-reload mode described later. As was possible with
Timers 0 and 1, the timebase for Timer 2 may be selected to be oscillator cycles divided by either 12 or 4
when in this mode.
128 of 175