14 16-BIT PWM TIMERS (T16B)
14-8
Seiko Epson Corporation
S1C17M12/M13 TECHNICAL MANUAL
(Rev. 1.2)
14.4.3 Comparator/Capture Block Operations
The comparator/capture block functions as a comparator to compare the counter value with the register value set or
a capture circuit to capture counter values using the external/software trigger signals.
Comparator/capture block operating mode
The comparator/capture block includes two systems (four or six systems) of comparator/capture circuits and
each system can be set to comparator mode or capture mode, individually.
Set the T16B
n
CCCTL
m
.CCMD bit to 0 to set the comparator/capture circuit
m
to comparator mode or 1 to set
it to capture mode.
Operations in comparator mode
The comparator mode compares the counter value and the value set via software. It generates an interrupt and
toggles the timer output signal level when the values are matched. The T16B
n
CCR
m
register functions as the
compare data register used for setting a comparison value in this mode. The TOUT
nm
/CAP
nm
pin is config-
ured to the TOUT
nm
pin.
When the counter reaches the value set in the T16B
n
CCR
m
register during counting, the comparator asserts the
MATCH signal and sets the T16B
n
INTF.COMPCAP
m
IF bit (compare interrupt flag) to 1.
When the counter reaches the MAX value in comparator mode, the T16B
n
INTF.CNTMAXIF bit (counter
MAX interrupt flag) is set to 1. When the counter reaches 0x0000, the T16B
n
INTF.CNTZEROIF bit (counter
zero interrupt flag) is set to 1.
0xffff
0x0000
Comparison value
(T16BnCCRm register)
MAX value
(T16BnMC register)
RUN = 1
CMPCAPmIF = 1
Compare period
RUN = 1
CNTMAXIF = 1
CMPCAPmIF = 1
CNTMAXIF = 1
CMPCAPmIF = 1
CNTMAXIF = 1
PRESET = 1
RUN = 0
Counter
(1) Repeat up count mode
Count cycle
Time
Software operation
Hardware operation
0xffff
0x0000
RUN = 1
CMPCAPmIF = 1
Comparison value
(T16BnCCRm register)
MAX value
(T16BnMC register)
Compare
period
Counter
(2) Repeat down count mode
Count cycle
Time
RUN = 1
CNTZEROIF = 1
CMPCAPmIF = 1
CNTZEROIF = 1
CMPCAPmIF = 1
CNTZEROIF = 1
PRESET = 1
RUN = 0