beautypg.com

Basic interval timer operation – NEC PD75402A User Manual

Page 79

background image

68

CHAPTER 5. PERIPHERAL HARDWARE FUNCTIONS

5.4.3

Basic Interval Timer Operation

The basic interval timer (BT) is constantly incremented by the clock from the clock generation circuit, and sets

the interrupt request flag (IRQBT) when it overflows. The BT count operation cannot be stopped.

Either of two times can be selected as the interrupt generation interval by setting the BTM (Fig. 5-22).

The basic interval timer and the interrupt request flag can be cleared by setting (1) bit 3 of BTM (directive to start

as interval timer).

The basic interval timer (BT) count status can be read by an 8-bit handling instruction. Data cannot be written

to the timer.

Note

When the basic interval timer contents are read, it may happen that unstable data in the process of count

updating is read. To prevent this, the read instruction should be executed twice, then the two read contents

should be compared. If a comparison of the two read contents shows appropriate values, the latter contents

are taken as the result of the read. If the values are completely different, the operation should be repeated

from the beginning.

Example

To read the BT count contents

MOV

HL, #TEMP

; Set table address to HL

LOOP:

MOV

XA, BT

; First read

MOV

TEMP, XA

; Save read value

MOV

XA, BT

; Second read

SKE

A, @HL

; Comparison of low-order 4 bits

BR

LOOP

INCS

L

XCH

A, X

SKE

A, @HL

; Comparison of high- order 4 bits

BR

LOOP

This manual is related to the following products: