
The capture / compare units
UM0404
DocID13284 Rev 2
A CAPCOM unit handles high speed I/O tasks such as pulse and waveform generation,
pulse width modulation, or recording of the time at which specific events occur. It also allows
the implementation of up to 16 software timers. The maximum resolution of the CAPCOM
units is calculated with the formula in
Section 16.1: CAPCOM timers on page 329
specified in the device datasheet.
Each CAPCOM unit consists of two 16-bit timers (T0 / T1 in CAPCOM1, T7 / T8 in
CAPCOM2), each with its own reload register (TxREL), and a bank of sixteen dual purpose
16-bit capture / compare registers (CC0 through CC15 in CAPCOM1, CC16 through CC31
in CAPCOM2).
The input clock for the CAPCOM timers is programmable to several pre-scaled values of the
CPU clock, or it can be derived from an overflow / underflow of timer T6 in block GPT2. T0
and T7 may also operate in counter mode (from an external input) where they can be
clocked by external events.
Each capture / compare register may be programmed individually for capture or compare
function, and each register may be allocated to either timer of the associated unit. Each
capture / compare register has one port pin associated with it which serves as an input pin
for the capture function or as an output pin for the compare function (except for
CC27...CC24 on P1H.7...P1H.4, which only provide the capture function). The capture
function causes the current timer contents to be latched into the respective capture /
compare register triggered by an event (transition) on its associated port pin. The compare
function may cause an output signal transition on that port pin whose associated capture /
compare register matches the current timer contents. Specific interrupt requests are
generated upon each capture / compare event or upon timer overflow.
shows the basic structure of the two CAPCOM units.