Kontron MOPSlcdLX Uživatelský manuál Strana 14

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 31
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 13
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
}
Zobrazit stránku 13
1 2 ... 9 10 11 12 13 14 15 16 17 18 19 ... 30 31

Komentáře k této Příručce

Žádné komentáře