CHAPTER 5. PERIPHERAL HARDWARE FUNCTIONS

5.4.4Examples of Basic Interval Timer Applications

Example

1.

In this example the basic interval timer is enabled, and the interrupt generation interval is set to 1.95

 

 

ms (at 4.19 MHz operation).

 

 

 

SEL

MB15

 

 

 

MOV

A, #1111B

 

 

 

MOV

BTM,A

; Setting and start

 

 

EI

 

; Enable interrupts

 

 

EI

IEBT

; Enable BT interrupts

Example

2.

Example of watchdog timer application

When used as a watchdog timer, the basic interval timer’s function of generating an interrupt (INTBT) at set intervals is used.

First, the standard time generated by the basic interval timer is decided.

Next, the program is divided into a number of modules whose processing should terminate within the standard time, and the counter (BT) and interrupt request flag (IRQBT) are cleared each time a module ends. A program is written such that an interrupt (INTBT) is not generated if operation is normal. In other words, if an interrupt is generated, this is interpreted as indicating inadvertent program looping.

The interrupt generation interval is set to 31.25 ms (in 4.19 MHz operation) so that the processing time for each module is less than 31.25 ms.

Initial

Setting

Module 1

Module 2

SEL

MOV

MOV

EI

EI

………

MOV A, #1011B

MOV BTM, A

………

MOV A, #1011B

MOV BTM, A

MB15 ; or CLR1 MBE

A, #1011B

BTM, A ; Interval setting and counter start

IEBT

Processing termination within 31.25 ms

Processing termination within 31.25 ms

69

Page 80
Image 80
NEC PD75P402, PD75402A user manual Examples of Basic Interval Timer Applications, Mov Btm,A, Iebt, Sel Mov, MOV BTM, a