RL78/G10 CHAPTER 6 TIMER ARRAY UNIT
R01UH0384EJ0311 Rev. 3.11 163
Dec 22, 2016
6.8.2 Operation as external event counter
The timer array unit can be used as an external event counter that counts the number of times the valid input edge
(external event) is detected in the TI0n pin. When a specified count value is reached, the event counter generates the
interrupt request signal (INTTM0n). The specified number of counts can be calculated by the following expression.
Specified number of counts = Set value of TDR0n + 1
When channel 1 or 3 is used as an 8-bit timer (SPLIT0n = 1), only the lower 8-bit timer can be used as the external
event counter.
Timer count register 0n (TCR0n) operates as a down counter in the event counter mode.
The TCR0n register loads the value of timer data register 0n (TDR0n) by setting any channel start trigger bit (TS0n) of
timer channel start register 0 (TS0) to 1.
The TCR0n register counts down each time the valid input edge of the TI0n pin has been detected. When TCR0n =
0000H, the TCR0n register loads the value of the TDR0n register again, and outputs INTTM0n.
After that, the above operation is repeated.
An irregular waveform that depends on external events is output from the TO0n pin. Stop the output by setting the
TOE0n bit of timer output enable register 0 (TOE0) to 0.
The TDR0n register can be rewritten at any time. The new value of the TDR0n register becomes valid during the next
count period.
Figure 6-44. Block Diagram of Operation as External Event Counter
Edge
detection
TI0n pin
Clock selection
Trigger selection
TS0n
Interrupt request signal
(INTTM0n)
Interrupt
controller
Timer counter
register 0n (TCR0n)
Timer data
register 0n (TDR0n)
Noise
filter
TNFEN0n
Remark n: Channel number
n = 0, 1 (for 10-pin products); n = 0 to 3 (for 16-pin products)