Appendix B
58
KEEX-6100 Series User’s Manual
Appendix B
WatchDog Timer Sample Code
//============================================
//KEEX-6100 DOS Watchdog sample program
//Please compile with Turbo C 3.0 to utilized the program
//============================================
#include<stdio.h>
int main()
{
int value;
//Initialized the WDT program
outp(0x2E,0x87);
outp(0x2E,0x87);
//Setting Logical Device Number to 0x07
outp(0x2E,0x07);
outp(0x2F,0x07);
//0xF5 bit6
//If watchdog timeout event occurs, this bit will be set to 1.
//Write a 1 to this bit will clear it to 0.
outp(0x2F,0xF5);
value=inp(0x2F);
outp(0x2F,(value | 0x40));
//Set Timer unit
//(0xF5 bit3(0: 1sec, 1: 60 sec) of watchdog timer by setting this bit)
outp(0x2E,0xF5);
value=inp(0x2F);
outp(0x2F,(value & 0xF7));//set unit sec.
//Set Timer Value(0xF6 Time of watchdog timer)
outp(0x2E,0xF6);
outp(0x2F,0x14);//set to 20 sec (0x14)
//Enable WDT
outp(0x2E,0xF5);
value=inp(0x2F);
outp(0x2F,(value | 0x30));//