
132
CHAPTER 6
16-BIT TIMER/EVENT COUNTER 0
User’s Manual U12790EJ2V0UD
6.4.2 Operation as external event counter
The external event counter counts the number of external clock pulses input to the TI00/P32 pin by using 16-bit
timer counter 0 (TM0).
Each time the valid edge specified by prescaler mode register 0 (PRM0) has been input to TI00/P32, the value
of TM0 is incremented.
When the count value of TM0 matches the value of capture/compare register 00 (CR00), TM0 is cleared to 0 and
an interrupt request signal (INTTM00) is generated.
Set CR00 to a value other than 0000H (one pulse cannot be counted).
The rising, falling, or both rising and falling edges can be selected as the valid edge of TI00/P32 by using bits 4
and 5 (ES00 and ES01) of prescaler mode register 0 (PRM0).
Because the operation is performed only after the valid level of the TI00 pin is detected twice by sampling using
the internal clock (fX/23), noise with a short pulse width can be eliminated.
Figure 6-10. Setting of Control Registers in External Event Counter Mode
(a) 16-bit timer mode control register 0 (TMC0)
(b) Capture/compare control register 0 (CRC0)
Remark
0/1: When these bits are reset to 0 or set to 1, other functions can be used at the same time as the
external event counter function. For details, refer to Figures 6-2 and 6-3.
00000
CRC02
0/1
CRC01
0/1
CRC00
0
CRC0
CR00 is used as compare register.
0000
TMC03
1
TMC02
1
TMC01
0/1
OVF0
0
TMC0
Clear & start on match between
TM0 and CR00.