Appendix B
73
BEM-100F series User’s Manual
Appendix B
WatchDog Timer Sample Code
//============================================
//BEM-100F DOS Watchdog sample program
//Please compile with Turbo C 3.0 to utilized the program
//============================================
#Co., Ltd.lude<stdio.h>
int main()
{
int value;
//Enter the MB PnP Mode
outp(0x2E,0x87);
outp(0x2E,0x01);
outp(0x2E,0x55);
outp(0x2E,0x55);
//Setting Logical Device Number to 0x07
outp(0x2E,0x07);
outp(0x2F,0x07);
//Set Timer unit
//(0x72 bit7(0: Minute, 1: Secont) of watchdog timer by setting this bit)
outp(0x2E,0x72);
value = inp(0x2F) & 0x5F;
value = value | 0x80;//set unit sec.
outp(0x2F,value);
//Set WDT output through KRST
//(0x72 bit6(1: Enable, 0: Disable))
outp(0x2E,0x72);
value = inp(0x2F) & 0xBF;
value = value | 0x40;//Enable WDT output
outp(0x2F,value);
//Set Timer Value
//(0x73 Time of watchdog timer)
outp(0x2E,0x73);
outp(0x2F,0x14);//set to 20 sec (0x14)