CHAPTER 7 16-BIT TIMER/EVENT COUNTER Q (TMQ)
User’s Manual U17716EJ2V0UD
252
(a) Function as compare register
The TQnCCR0 register can be rewritten even when the TQnCTL0.TQnCE bit = 1.
The set value of the TQnCCR0 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
(INTTQnCC0) is generated. If TOQn0 pin output is enabled at this time, the output of the TOQn0 pin is
inverted.
When the TQnCCR0 register is used as a cycle register in the interval timer mode, external event count
mode
Note, external trigger pulse output modeNote, one-shot pulse output modeNote, or PWM output modeNote,
the value of the 16-bit counter is cleared (0000H) if its count value matches the value of the CCR0 buffer
register.
The compare register is not cleared by the TQnCTL0.TQnCE bit = 0.
Note These modes can be set only in TMQ0. They cannot be set in TMQ1.
(b) Function as capture register (TQ0CCR0 register only)
When the TQ0CCR0 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 TQ0CCR0 register if the valid edge of the capture trigger input pin
(TIQ00 pin) is detected. In the pulse width measurement mode, the count value of the 16-bit counter is
stored in the TQ0CCR0 register and the 16-bit counter is cleared (0000H) if the valid edge of the capture
trigger input pin (TIQ00 pin) is detected.
Even if the capture operation and reading the TQ0CCR0 register conflict, the correct value of the
TQ0CCR0 register can be read.
The capture register is cleared by the TQ0CTL0.TQ0CE bit = 0.
The following table shows the functions of the capture/compare register in each mode, and how to write data to
the compare register.
Table 7-4. 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
Note 1
Compare register
Anytime write
External trigger pulse output
Notes 1, 2
Compare register
Batch write
Note 3
One-shot pulse output
Notes 1, 2
Compare register
Anytime write
PWM output
Note 1
Compare register
Batch write
Note 3
Free-running timer
Capture/compare register
Anytime write
Pulse width measurement
Note 1
Capture register
None
Notes 1. TMQ0 only
2. This mode can be set only with the software trigger. No external trigger input pin is available.
3. Writing to the TQ0CCR1 register is the trigger.
Remark
For anytime write and batch write, see 7.6 (2) Anytime write and batch write.