Sample Applications; Timing Of Interval Timer Operation (1) - NEC PD78212 User Manual

8-bit single-chip microcomputer sub-series
Table of Contents

Advertisement

7.1.9 Sample Applications

(1) Interval timer operation (1)
By free running 16-bit timer 0 (TM0), and adding a value to a compare register (CR00, CR01) in an interrupt
handling routine, the 16-bit timer/counter can be used as an interval timer whose period is as long as the added
value. (See Fig. 7-24.)
This interval timer has a resolution of 1.3 µ s, and can count up to 87.4 ms (at internal system clock f
MHz).
In addition, 16-bit timer 0 (TM0) has two compare registers, so that interval timers with two types of periods
can be produced.
Fig. 7-25 shows the setting of control registers. Fig. 7-26 shows the setting procedure. Fig. 7-27 shows
interrupt handling.
TM0
count value
0H
Timer starts
Compare register
(CR00)
INTC00
interrupt request
Remark Interval = n × 8/f
CLK
Fig. 7-24 Timing of Interval Timer Operation (1)
n
n
Interval
, 1 ≤ n ≤ FFFFH
Chapter 7 Timer/Counter Units
FFFFH
MOD(2n)
MOD(2n)
Rewriting by inter-
Rewriting by inter-
rupt program
rupt program
Interval
Interval
FFFFH
MOD(3n)
MOD(3n)
MOD(4n)
Rewriting by inter-
rupt program
= 6
CLK
7
129

Advertisement

Table of Contents
loading

Table of Contents