
CHAPTER 8 8-BIT TIMER/EVENT COUNTERS 2 TO 5
User’s Manual U15905EJ2V1UD
246
8.4
Operation
8.4.1
Operation as interval timer (8 bits)
8-bit timer/event counter n operates as an interval timer that repeatedly generates interrupts at the interval of the
count value preset in 8-bit timer compare register n (CRn).
If the count value in 8-bit timer counter n (TMn) matches the value set in the CRn register, the value of the TMn
register is cleared to 0 and counting is continued, and at the same time, an interrupt request signal (INTTMn) is
generated.
Setting method
<1>
Set each register.
 TCLn register: Selects the count clock (t).
 CRn register: Compare value (N)
 TMCn register: Stops count operation and selects the mode in which clear & start occurs on a match
between the TMn register and CRn register (TMCn register = 0000xxx0B,
×: don’t
care).
<2>
When the TMCEn bit of the TMCn register is set to 1, the count operation starts.
<3>
When the values of the TMn register and CRn register match, INTTMn is generated (TMn register is
cleared to 00H).
<4>
Then, INTTMn is repeatedly generated at the same interval. To stop counting, set TMCEn = 0.
Interval time = (N + 1)
× t: N = 00H to FFH
Caution
During interval timer operation, do not rewrite the value of the CRn register.
Figure 8-2. Timing of Interval Timer Operation (1/2)
Basic operation
t
Interval time
00H
N
01H
00H
N
01H
00H
Clear
Interrupt acknowledgment Interrupt acknowledgment
Clear
Count clock
TMn count value
CRn
TMCEn
INTTMn
Count start
Remark
n = 2 to 5