beautypg.com

5watchdog, digital i/o and backlight, 1 watchdog example, Jrex plus lx software guide – Kontron JRexplus-LX User Manual

Page 16

background image

KTD-S0004-A

Page 13

Watchdog, Digital I/O and Backlight


JRexplus LX Software Guide

5

Watchdog, Digital I/O and Backlight

The following examples (DOS programs) show the access to these three system components (C compiler:
BORLAND C++).
Note: These examples can't be run on Linux and Windows

®

.

5.1

Watchdog Example

#include

#define JIDA16_INT

0x15

#define WDT_INIT

0xE000

#define WDT_TRIGGER

0xE001

#define WDT_TIMEOUT

50 // timeout = 10 seconds (time base = 0.2 seconds)

#define WDT_DELAY

0

// no delay


void ActivateWatchdog (void)
{

union REGS regs;

regs.x.ax = WDT_INIT;

regs.x.bx = WDT_TIMEOUT;

regs.x.cx

=

WDT_DELAY;

regs.x.dx = 0;

// only RESET possible

int86 (JIDA16_INT, ®s, ®s);

}

void TriggerWatchdog (void)
{

union REGS regs;

regs.x.ax = WDT_TRIGGER;

int86 (JIDA16_INT, ®s, ®s);

}

void main (void)
{
int

i;

ActivateWatchdog

();

for (i = 0; i < 5; i++)

// wait half of expiry time (= 5 seconds)

delay (1000);

// wait 1 second

TriggerWatchdog ();

// trigger the watchdog - total expiry time now 15 seconds

}