
XC161 Derivatives
Peripheral Units (Vol. 2 of 2)
Capture/Compare Units
User’s Manual
17-16
V2.2, 2004-01
CC12_X1, V2.1
Figure 17-5
Compare Mode 0 and 1 Block Diagram
Note: The signal remains unaffected in compare mode 0.
illustrates a few example cases for compare modes 0 and 1.
In all examples, the reload value of the used timer is set to FFF9
H
. When the timer
overflows, it starts counting from this value upwards.
In Case 1, register CCy contains the value FFFC
H
. When the timer reaches this value,
a match is detected, and the interrupt request line CCyIRQ is activated. In compare
mode 0, this is all that will happen. In compare mode 1, additionally the associated port
output is toggled, causing an inversion of the output signal. If the contents of register CCy
are not changed, this operation will take place each time the timer reaches the
programmed compare value.
In Case 2, software reloads the compare register CCy with FFFF
H
after the first match
with FFFC
H
has occurred. As the timer continues to count up, it finally reaches this new
compare value, and a new match is detected, activating the interrupt request line (both
modes) and toggling the output signal (compare mode 1). If then the compare value is
left unchanged, the next match will occur when the timer reaches FFFF
H
again.
This example illustrates, that further compare matches are possible within the current
timer period (this is in contrast to compare modes 2 and 3).
MCB05421
MUX
Timer T0/T7
ACCy
Mode &
Output Ctrl.
CCyIRQ
to Port
Logic
Timer T1/T8
Mode
Control
SEMy
SEEy
Compare
Register CCy
Comparator
= ?
MODy
T0IRQ,
T7IRQ
T1IRQ,
T8IRQ
Mode 1 only!