beautypg.com

11 sample applications – NEC PD78214 User Manual

Page 219

background image

190

µ

PD78214 Sub-Series

7.3.11 Sample Applications

(1) Interval timer operation (1)

By free running 8-bit timer 2 (TM2), and adding a value to a compare register (CR20, CR21) in an interrupt
handling routine, 8-bit timer/counter 2 can be used as an interval timer whose period is as long as the added
value. (See Fig. 7-96.)

In addition, 8-bit timer 2 (TM2) has two compare registers, so that interval timers with two types of periods
can be produced.

Fig. 7-97 shows the setting of control registers. Fig. 7-98 shows the setting procedure. Fig. 7-99 shows
interrupt handling.

Fig. 7-96 Timing of Interval Timer Operation (1)

n

n

0H

TM2
count value

MOD(2n)

MOD(3n)

FFH

MOD(2n)

MOD(3n)

MOD(4n)

Timer starts

Compare register

(CR20)

INTC20

interrupt request

Rewriting by inter-
rupt program

Interval

Interval

Interval

Rewriting by inter-
rupt program

Rewriting by inter-
rupt program

FFH

Remark Interval = n

× x/f

CLK

, 1

≤ n ≤ FFH

x = 16, 32, 64, 128, 256, 512

This manual is related to the following products: