beautypg.com

6 program examples of watchdog timer, Program examples of watchdog timer – FUJITSU F2MCTM-16LX User Manual

Page 224

background image

208

CHAPTER 12 WATCHDOG TIMER

12.6

Program Examples of Watchdog Timer

Program example of watchdog timer is given below:

Program Examples of Watchdog Timer

Processing specification

The watchdog timer is cleared each time in the loop of the main program.

The main program must be executed once within the minimum interval time of the watchdog timer.

Coding example

WDTC EQU 0000A8H ;Watchdog timer control

register

WTE EQU WDTC:2 ;Watchdog control bit

;

;---------Main program-------------------------------------

CODE CSEG

START: ;Stack pointer (SP), already

;initialized

MOV I:WDTC,#00000011B ;Start up of watchdog timer

;Select interval time 2

21

+2

18

;cycle

LOOP:

CLRB I:WTE ;Clear watchdog timer

ÅE

User processing

ÅE

BRA LOOP

;---------Vector setting------------------------------------------

VECT CSEG ABS=0FFH

ORG 00FFDCH ;Reset vector setting

DSL START

DB 00H ;Setting to single chip mode

VECT ENDS

END START