NEC PD75402A Manuale Utente

Pagina di 195
69
CHAPTER  5.  PERIPHERAL  HARDWARE  FUNCTIONS
5.4.4
 Examples 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
MOV A, #1011B
MOV BTM, A
Module 1
Processing termination within 31.25 ms
MOV A, #1011B
MOV BTM, A
Module 2
Processing termination within 31.25 ms
SEL
MB15
; or CLR1 MBE
MOV
A, #1011B
MOV
BTM, A
; Interval setting and counter start
EI
EI
IEBT
………
………