RX610 Group
15. 16-Bit Timer Pulse Unit (TPU)
R01UH0032EJ0120 Rev.1.20
Page 486 of 1006
Feb 20, 2013
(b)
Free-running count operation and periodic count operation
Immediately after a reset, the TPUm.TCNT counters are all set as free-running counters. When the relevant bit in TSTRA
or TSTRB is set to 1, the corresponding TCNT counter starts up-count operation as a free-running counter. When TCNT
overflows (changes from FFFFh to 0000h), the TPU requests an interrupt. After an overflow, TCNT restarts counting up
from 0000h.
Figure 15.4 shows free-running counter operation.
TCNT value
FFFFh
0000h
TSTRy.CSTj bit
TCImV interrupt
Time
Figure 15.4 Free-Running Counter Operation
When compare match is selected as the TCNT clearing source, the TCNT counter for the relevant channel performs
periodic count operation. The TPUm.TGRy for setting the period is set as an output compare register, and counter
clearing by compare match is selected by the CCLR[2:0] bits in TPUm.TCR. After the settings have been made, TCNT
starts count-up operation as a periodic counter when the corresponding bit in TSTRA or TSTRB is set to 1. When the
count value matches the TGRy value, TCNT is cleared to 0000h.
At this time, the TPU requests an interrupt. After a compare match, TCNT restarts counting up from 0000h.
Figure 15.5 shows periodic counter operation.
TGImy interrupt
Counter cleared by TGRy compare match
TCNT value
C000h
0000h
TSTRy.CSTj bit
Time
Figure 15.5 Periodic Counter Operation