6 program example for watchdog timer, Program example for watchdog timer – FUJITSU F2MC-8L F202RA User Manual

Page 149

Advertising
background image

133

CHAPTER 6 WATCHDOG TIMER

6.6

Program Example for Watchdog Timer

Programming examples for the watchdog timer are provided below.

Programming Examples of Watchdog Timer

Processing specification

Activate the watchdog timer immediately after the program starts.

Clear the watchdog timer whenever the loop of the main program is run.

Ensure that the time necessary for running the main loop once, including interrupt handling, is shorter

than the minimum time interval (approximately 335.5 ms: operating at 12.5 MHz) of the watchdog

timer.

Coding example

WDTC EQU

0009H

;

Address of watchdog control register

WDT_CLR EQU 00000101B

VECT

DSEG

ABS

;

[DATA SEGMENT]

ORG

0FFFEH

RST_V DW

PROG

;

Setting reset vector

VECT

ENDS

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

CSEG

;

[CODE SEGMENT]

PROG

;

Initialization routine upon reset

MOVW

SP,#0280H

;

Setting initial value of stack pointer (for interrupt)

:

Initializing interrupt or other peripheral functions

:

INIT

MOV

WDTC,#WDT_CLR

;

Activating watchdog timer

MAIN

MOV

WDTC,#WDT_CLR

;

Clearing watchdog timer

:

User processing (interrupt may occur in this processing.)

:

JMP

MAIN

;

Ensure that the time necessary for running the loop is

shorter than the minimum time interval of the watchdog

timer.

ENDS

;---------------------------------------------------------------------------------------------------------------------

END

Advertising
This manual is related to the following products: