CHAPTER 6 16-BIT TIMER/EVENT COUNTER
120
(2) Pulse width measurement by means of restart
When input of a valid edge to the TI0/P00 pin is detected, the count value of the 16-bit timer register (TM0) is
taken into the 16-bit capture register (CR01), and then the pulse width of the signal input to the TI0/P00 pin is
measured by clearing TM0 and restarting the count.
The edge specification can be selected from three types, rising, falling, and both edges by the external interrupt
mode register (INTM0) bit 2 and bit 3 (ES10 and ES11).
In a valid edge detection, the sampling is performed by a cycle selected by the sampling clock selection register
(SCS), and a capture operation is not performed before detecting valid levels twice allowing short pulse width
noise to be eliminated.
Figure 6-16. Timing of Pulse Width Measurement Operation by Means of Restart
(with Both Edges Specified)
t
0000
TM0 dount value
Count clock
CR01 captured value
INTP0
0001
D0
0000
0001
D1
0000
0001
D0
(D0 + 1)
×
t
(D1 + 1)
×
t
TI0 pin input
D1
6.5.4 External event counter operation
The external event counter counts the number of external clock pulses to be input to the TI0/P00 pin with the 16-
bit timer register (TM0).
TM0 is incremented each time the valid edge specified with the external interrupt mode register (INTM0) is input.
When the TM0 counted value matches the 16-bit compare register (CR00) value, TM0 is cleared to 0 and the
interrupt request signal (INTTM0) is generated.
Set a value other than 0000H to CR00 (1-pulse count operation cannot be performed).
The rising edge, the falling edge or both edges can be selected with bits 2 and 3 (ES10 and ES11) of INTM0.
Because operation is carried out only after the valid edge is detected twice by sampling at the cycle selected with
the sampling clock select register (SCS), noise with short pulse widths can be removed.