11.6
Sample Program for the Watchdog Timer
This section contains a sample program for the watchdog timer.
■ Sample Program for the Watchdog Timer
●
Processing
• The watchdog timer is cleared every time in the main program loop.
• The main loop must make one iteration within the minimum watchdog timer interval.
●
Coding example
WDTC
WTE
;-------Main program------------------------------------------------------------------------------------------------------
CODE
START:
;
WDG_START:
;--------Main loop----------------------------------------------------------------------------------------------------------
MAIN:
;
;
;
CODE
;--------Vector setting-----------------------------------------------------------------------------------------------------
VECT
VECT
EQU
0000A8H
EQU
WDTC:2
CSEG
:
MOV
WDTC,#00000011B ;Activates watchdog timer
CLRB
I:WTE
:
User processing
:
JMP
MAIN
ENDS
CSEG
ABS=0FFH
ORG
0FFDCH
DSL
START
DB
00H
ENDS
END
START
CHAPTER 11 WATCHDOG TIMER
;Watchdog timer control register
;Watchdog control bit
;Assumes that stack pointer (SP) has already
been initialized
21
;Selects the interval 2
;Clears watchdog timer
Clears this bit regularly
;Loops in less time than the watchdog
timer interval
;Sets reset vector
;Sets single-chip mode
18
2
cycle
227