CHAPTER 6 16-BIT TIMER/EVENT COUNTER P (TMP)
User’s Manual U16896EJ2V0UD
146
(a) Function as compare register
The TP0CCR0 register can be rewritten even when the TP0CTL0.TP0CE bit = 1.
The set value of the TP0CCR0 register is transferred to the CCR0 buffer register. When the value of the
16-bit counter matches the value of the CCR0 buffer register, a compare match interrupt request signal
(INTTP0CC0) is generated. If TOP00 pin output is enabled at this time, the output of the TOP00 pin is
inverted.
When the TP0CCR0 register is used as a cycle register in the interval timer mode, external event count
mode, external trigger pulse output mode, one-shot pulse output mode, or PWM output mode, the value of
the 16-bit counter is cleared (0000H) if its count value matches the value of the CCR0 buffer register.
(b) Function as capture register
When the TP0CCR0 register is used as a capture register in the free-running timer mode, the count value
of the 16-bit counter is stored in the TP0CCR0 register if the valid edge of the capture trigger input pin
(TIP00 pin) is detected. In the pulse width measurement mode, the count value of the 16-bit counter is
stored in the TP0CCR0 register and the 16-bit counter is cleared (0000H) if the valid edge of the capture
trigger input pin (TIP00 pin) is detected.
Even if the capture operation and reading the TP0CCR0 register conflict, the correct value of the
TP0CCR0 register can be read.
The following table shows the functions of the capture/compare register in each mode, and how to write data to
the compare register.
Table 6-2. Function of Capture/Compare Register in Each Mode and How to Write Compare Register
Operation Mode
Capture/Compare Register
How to Write Compare Register
Interval timer
Compare register
Anytime write
External event counter
Compare register
Anytime write
External trigger pulse output
Compare register
Batch write
One-shot pulse output
Compare register
Anytime write
PWM output
Compare register
Batch write
Free-running timer
Capture/compare register
Anytime write
Pulse width measurement
Capture register
−