Fujitsu MB89950/950A Pager User Manual


 
119
CHAPTER 6 WATCHDOG TIMER
6.6 Program Example for Watchdog Timer
This section gives a program example for the watchdog timer.
Program example for watchdog timer
Processing description
Activates the watchdog timer immediately after the program.
Clears the watchdog timer in each loop of the main program.
The processing time for the main loop, including interrupt processing, must be less than the minimum
interval time of the watchdog timer (approximately 419.43 ms at 5 MHz operation).
Coding example
WDTC EQU 0009H ; Address of the watchdog timer control register
WDT_CLR EQU 00000101B
VECT DSEG ABS ; [DATA SEGMENT]
ORG 0FFFEH
RST_V DW PROG ; Set reset vector.
VECT ENDS
;-----Main program---------------------------------------------------------------
CSEG ; [CODE SEGMENT]
PROG ; Initialization routine after a reset
MOVW SP,#0280H ; Set initial value of stack pointer
(for interrupt processing).
:
Initialization of peripheral functions (interrupts), etc.
:
INIT MOV WDTC,#WDT_CLR ; Activate the watchdog timer.
:
MAIN MOV WDTC,#WDT_CLR ; Clear the watchdog timer.
:
User processing (interrupt processing may occur during this cycle)
:
JMP MAIN ; The loop must be executed in less than the
minimum interval time of the watchdog timer.
ENDS
;--------------------------------------------------------------------------------
END