
174
CHAPTER 7
8-BIT TIMER/EVENT COUNTERS 50, 51
User’s Manual U12790EJ2V0UD
7.4.2 Operation as external event counter
The external event counter counts the number of clock pulses input from an external source to the TI5n pin using
8-bit timer counter 5n (TM5n).
Each time the valid edge specified by timer clock select register 5n (TCL5n) is input to TI5n, the value of TM5n
is incremented. Either the rising or falling edge can be selected as the valid edge.
When the count value of TM5n matches the value of 8-bit compare register 5n (CR5n), TM5n is cleared to 0, and
an interrupt request signal (INTTM5n) is generated.
After that, each time the value of TM5n matches the value of CR5n, INTTM5n is generated.
[Setting]
<1> Set each register.
TCL5n: Select rising or falling edge of TI5n input.
Rising edge of TI5n
→ TCL5n = 00H
Falling edge of TI5n
→ TCL5n = 01H
CR5n:
Set a compare value.
TMC5n: Select count operation stop, clear & start mode on match between TM5n and CR5n, timer F/F
inverted operation disable, timer output disable.
(TMC5n = 0000
××00B, × = don’t care)
<2> When TCE5n = 1 is set, the number of pulses input from TI5n is counted.
<3> INTTM5n is generated when the values of TM5n and CR5n match (TM5n is cleared to 00H).
<4> After that, INTTM5n is generated each time when the values of TM5n and CR5n match.
Remark
n = 0 or 1
Figure 7-9. Operation Timing of External Event Counter (with Rising Edge Specified)
TI5n
TM5n count value
CR5n
INTTM5n
00
01
02
03
04
05
N
1
N
00
01
02
03
N
Remarks 1. N = 00H to FFH
2. n = 0 or 1