beautypg.com

Rpbasic-52 programming guide, Wdog – Remote Processing BASIC 52 User Manual

Page 137

background image

RPBASIC-52 PROGRAMMING GUIDE

2-118

WDOG

Syntax:

W D O G [time]
Where: time = 0, 1, or 2

no parameter = toggle watchdog timer
0 = turn off watch dog timer
1 = set timeout interval to 0.38 seconds
2 = set timeout interval to 2.8 seconds

Function:

Resets or sets w atchdog tim er.

Mode:

Run

Use:

W D O G

Cards:

All. Cards use this command in different ways. Refer to your hardware manual to verify operation.

D E S C R IP T I ON

The w atchd og tim er is a su pervis ory fun ction fo r applic ations that ca nnot a fford to " crash" .

WDO G 1 or WDO G 2 enables the watchdog and sets the interval. WDOG is executed periodically by your
program to p revent the card from resetting. WD OG 0 turn s off the watchd og timer.

Different cards m ay use different tim e out periods. Re fer to your hardw are manu al.

RELATED

none

E R R O R

BAD A RGUM ENT when time is out of range

EXAMPLE

The fo llowin g exam ple sho ws ho w O NTI CK can be used to reset th e tim er. The watc hdog t imer is set for 2.8
seconds.

10 WDOG 2
20 CLEAR TICK(0)
30 ONTICK 2,200
40 GOTO 40
200 PRINT TICK(0)
210 WDOG
220 RETI

When a watchdo g timeout oc curs, only the CP U is reset. The e ffect is the same as performing a hardware
reset, except a ha rdware reset pu lse is not issued. Digital I/O at J3 does not cha nge. Digital lines L 0 - L8 are
reset to powe r up conditions as is the display port.