![](http://datasheet.mmic.net.cn/370000/UPD70F3214HGC-8EU_datasheet_16743828/UPD70F3214HGC-8EU_326.png)
CHAPTER 8 16-BIT TIMER/EVENT COUNTER 0
User’s Manual U16890EJ1V0UD
326
8.4.4 Operation as external event counter
Setting procedure
The basic operation setting procedure is as follows.
<1> Set the CRC0n register (refer to
Figure 8-18
for the setting value).
<2> Set the count clock using the PRM0n register.
<3> Set any value (except for 0000H) to the CR0n0 register.
<4> Set the TMC0n register: Start operation (refer to
Figure 8-18
for the setting value).
Remarks 1.
For the alternate-function pin (TI0n0) settings, refer to
Table 4-16 Settings When Port Pins Are
Used for Alternate Functions
.
2.
For INTTM0n0 interrupt enable, refer to
CHAPTER 20 INTERRUPT/EXCEPTION PROCESSING
FUNCTION
.
The external event counter counts the number of clock pulses input to the TI0n0 pin from an external source by
using the TM0n register.
Each time the valid edge specified by the PRM0n register has been input, the TM0n register is incremented.
When the count value of the TM0n register matches the value of the CR0n0 register, the TM0n register is cleared
to 0000H and an interrupt request signal (INTTM0n0) is generated.
Set the CR0n0 register to a value other than 0000H (one-pulse count operation is not possible).
The edge is specified by the PRM0n.ESn00 and PRM0n.ESn01 bits. The rising, falling, or both the rising and
falling edges can be specified.
The valid edge is detected through sampling at a count clock cycle of f
XX
/4, and the capture operation is not
performed until the valid level is detected twice. As a result, noise with a short pulse width can be eliminated.
Cautions 1. The timer outputs (TO00 to TO03) cannot be used.
2. The value of the CR0n0 and CR0n1 registers cannot be changed during timer count
operation.
Remark
n = 0 to 3