English
Language : 

UPD784938 Datasheet, PDF (347/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 11 TIMER/EVENT COUNTER 2
11.9 Examples of Use
11.9.1 Operation as interval timer (1)
When timer counter 2 (TM2) is made free-running and a fixed value is added to the compare register (CR2n: n = 0,
1) in the interrupt service routine, TM2 operates as an interval timer with the added fixed value as the cycle (see Figure
11-35).
The control register settings are shown in Figure 11-36, the setting procedure in Figure 11-37, and the processing in
the interrupt service routine in Figure 11-38.
Figure 11-35. Interval Timer Operation (1) Timing
FFH
FFH
MOD (3n)
TM2
count value
n
MOD (2n)
0H
Compare register
(CR20)
Timer start
n
MOD (2n)
MOD (3n)
MOD (4n)
INTC20
interrupt request
Interval
Rewritten by
interrupt program
Interval
Remark Interval = n × x/fXX
1 ≤ n ≤ FFH, x = 4, 8, 16, 32, 64, 128, 256, 512, 1,024
Rewritten by
interrupt program
Interval
Rewritten by
interrupt program
Preliminary User’s Manual U13987EJ1V0UM00
347