Datasheet

Section 14 Timer RD
Rev. 1.50 Sep. 18, 2007 Page 307 of 584
REJ09B0240-0150
(1) Free-Running Count Operation and Periodic Count Operation
Immediately after a reset, the TRDCNT counters for channels 0 and 1 are all designated as free-
running counters. When the relevant bit in TRDSTR is set to 1, the corresponding TRDCNT
counter starts an increment operation as a free-running counter. When TRDCNT overflows, the
OVF flag in TRDSR is set to 1. If the value of the OVIE bit in the corresponding TRDIER is 1 at
this point, timer RD requests an interrupt. After overflow, TRDCNT starts an increment operation
again from H'0000.
Figure 14.11 illustrates free-running counter operation.
H'FFFF
TRDCNT value
Time
H'0000
STR0,
STR1
OVF
Figure 14.11 Free-Running Counter Operation
When compare match is selected as the TRDCNT clearing source, the TRDCNT counter for the
relevant channel performs periodic count operation. The GR registers for setting the period are
designated as output compare registers, and counter clearing by compare match is selected by
means of bits CCLR1 and CCLR0 in TRDCR. After the settings have been made, TRDCNT starts
an increment operation as a periodic counter when the corresponding bit in TRDSTR is set to 1.
When the count value matches the value in GR, the IMFA, IMFB, IMFC, or IMFD flag in TRDSR
is set to 1 and TRDCNT is cleared to H'0000.
If the value of the corresponding IMIEA, IMIEB, IMIEC, or IMIED bit in TRDIER is 1 at this
point, timer RD requests an interrupt. After a compare match, TRDCNT starts an increment
operation again from H'0000.