English
Language : 

UPD784938 Datasheet, PDF (293/733 Pages) NEC – 16-Bit Single-Chip Microcontrollers
CHAPTER 10 TIMER/EVENT COUNTER 1
10.7 Examples of Use
10.7.1 Operation as interval timer (1)
When timer counter 1 (TM1) is made free-running and a fixed value is added to the compare register (CR1n: n = 0, 1) in the
interrupt service routine, TM1 operates as an interval timer with the added fixed value as the cycle (see Figure 10-19).
Since TM1 has two compare registers, two interval timers with different intervals can be constructed.
The control register settings are shown in Figure 10-20, the setting procedure in Figure 10-21, and the processing in the
interrupt service routine in Figure 10-22.
Figure 10-19. Interval Timer Operation (1) Timing
FFH
FFH
MOD (3n)
TM1
count value
n
MOD (2n)
0H
Compare register
(CR10)
Timer start
n
MOD (2n)
MOD (3n)
MOD (4n)
INTC10
interrupt request
Interval
Rewritten by
interrupt program
Interval
Rewritten by
interrupt program
Interval
Rewritten by
interrupt program
Remark Interval = n × x/fXX, 1 ≤ n ≤ FFH
x = 4, 8, 16, 32, 64, 128, 256, 512, 1,024
Preliminary User’s Manual U13987EJ1V0UM00
293