4watchdog and backlight, 1 watchdog example, Mopslcdlx software guide – Kontron MOPSlcdLX User Manual

Page 14

Advertising
background image

KTD-S0006-B

Page 11

Watchdog and Backlight


MOPSlcdLX Software Guide

4

Watchdog and Backlight

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

®

.

4.1

Watchdog Example

#include <dos.h>

#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, &regs, &regs);

}

void TriggerWatchdog (void)
{

union REGS regs;

regs.x.ax = WDT_TRIGGER;

int86 (JIDA16_INT, &regs, &regs);

}

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

}

Advertising