Appendix B
36
QBOX-1010 User’s Manual
Appendix B
WatchDog Timer Sample Code
//============================================
//QBOX-1010 DOS watchdog sample program
//Please compile with Turbo C 3.0 to utilized the program
//============================================
int main()
{
//Initialized the WDT program
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 Value(0x73 is LSB while 0x74 is MSB)
outp(0x2e,0x73);
outp(0x2f,0x14);//set to 20 sec (0x14)
//Set Timer Unit to Second/Minute(Bit 7 equal to 1 is second/0 is minute)
//Enable WDT (Bit 6 equal to 1 is enable/0 is disable)
outp(0x2e,0x72);
outp(0x2f,0xd0);//The unit is set as second
return 0;
}