Appendix 2: Watchdog Programming Guide
watchdog reference code
(
ASM
)
--------------------------------------------------------------------------------------------------------------
Set the port to realize watchdog function through DEBUG order, so that it can carry out
Watchdog Timer’s various functions.
Port Instruction:
void main()
{
int indexp = 0x2e,datap = 0x2f;
unsigned char temp;
outportb(indexp,0x87);
outportb(indexp,0x87); //unlock
outportb(indexp,0x2d);
temp = (unsigned char)inportb(datap);
temp &= 0xfe;
outportb(indexp,0x2d);
outportb(datap,temp);
//set pin for watchdog
outportb(indexp,0x07);
outportb(datap,0x08);
outportb(indexp,0x30);
outportb(datap,0x01);
//enable logical device
outportb(indexp,0xf5);
outportb(datap,0x00);
//set second
/*outportb(datap,0x08); set minute*/
outportb(indexp,0xf6);
outportb(datap,0x03);
//set 3 seconds
44