
XC886/888CLM
Functional Description
Data Sheet
Prelimary
84
V0.1, 2006-02
3.16
Timer 2 and Timer 21
Timer 2 and Timer 21 are 16-bit general purpose timers (THL2) that are fully compatible
and have two modes of operation, a 16-bit auto-reload mode and a 16-bit one channel
capture mode. As a timer, the timers count with an input clock of PCLK/12 (if prescaler
is disabled). As a counter, they count 1-to-0 transitions on pin T2. In the counter mode,
the maximum resolution for the count is PCLK/24 (if prescaler is disabled).
Table 32
Mode
Auto-reload Up/Down Count Disabled
Count up only
Start counting from 16-bit reload value, overflow at FFFF
H
Reload event configurable for trigger by overflow condition only, or by
negative/positive edge at input pin T2EX as well
Programmble reload value in register RC2
Interrupt is generated with reload event
Up/Down Count Enabled
Count up or down, direction determined by level at input pin T2EX
No interrupt is generated
Count up
– Start counting from 16-bit reload value, overflow at FFFF
H
– Reload event triggered by overflow condition
– Programmble reload value in register RC2
Count down
– Start counting from FFFF
H
, underflow at value defined in register
RC2
– Reload event triggered by underflow condition
– Reload value fixed at FFFF
H
Channel
capture
Start counting from 0000
H
, overflow at FFFF
H
Reload event triggered by overflow condition
Reload value fixed at 0000
H
Capture event triggered by falling/rising edge at pin T2EX
Captured timer value stored in register RC2
Interrupt is generated with reload or capture event
Timer 2 Modes
Description
Count up only