Datasheet

Table Of Contents
Section 14 16-Bit Timer Pulse Unit (TPU)
Rev. 2.00 Jul. 04, 2007 Page 291 of 692
REJ09B0309-0200
(b) Free-Running Count Operation and Periodic Count Operation
Immediately after a reset, the TPU's TCNT counters are all designated as free-running counters.
When the relevant bit in TSTR is set to 1, the corresponding TCNT starts up-count operation as a
free-running counter. When TCNT overflows (from H'FFFF to H'0000), the TCFV bit in TSR is
set to 1. If the value of the corresponding TCIEV bit in TIER is 1 at this point, the TPU requests
an interrupt. After overflow, TCNT starts counting up again from H'0000.
Figure 14.6 illustrates free-running counter operation.
TCNT value
H'FFFF
H'0000
CST bit
TCFV
Time
Figure 14.6 Free-Running Counter Operation
When compare match is selected as the TCNT clearing source, TCNT for the relevant channel
performs periodic count operation. TGR for setting the period is designated as an output compare
register, and counter clearing by compare match is selected by means of bits CCLR0 and CCLR1
in TCR. After the settings have been made, TCNT starts up-count operation as a periodic counter
when the corresponding bit in TSTR is set to 1. When the count value matches the value in TGR,
the TGF bit in TSR is set to 1 and TCNT is cleared to H'0000.
If the value of the corresponding TGIE bit in TIER is 1 at this point, the TPU requests an interrupt.
After a compare match, TCNT starts counting up again from H'0000.