ENDAT-3857 USERS MANUAL
UNICORN COMPUTER CORP.
24
Sample code
(using TurboC/C++ 3.0):
#include <stdio.h>
#include <dos.h>
#include <dir.h>
void show_ver();
void main()
{
unsigned int tt;
clrscr();
show_ver();
tt=0;
while((tt==0)||(tt>255))
{
printf("\n\nPlease key in how many seconds you want to reset system (1~255):");
scanf("%d",&tt);
}
outportb(0x2e,0x87); //Unlock register
outportb(0x2e,0x87); //Unlock register
outportb(0x2e,0x07); //set Logic Device number pointer
outportb(0x2f,0x08); //set Logic Device number
outportb(0x2e,0x30); //set WDTO active
outportb(0x2f,0x01); //set reg value active (bit0 =1 active,0 inactive )
outportb(0x2e,0xf2); //set WDTO Control Mode
outportb(0x2f,0x00); //set register value Default :00h
//bit7 Mouse interrupt reset enables watch-dog timer reload
// 0: Watchdog Timer I is not affected by mouse interrupt.
// 1: Watchdog Timer I is reset by mouse interrupt.
// bit6 Keyboard interrupt reset enables watch-dog timer reload
// 0: Watchdog Timer I is not affected by keyboard interrupt.
// 1: Watchdog Timer I is reset by keyboard interrupt.
outportb(0x2e,0xf0); //set WDTO Control Mode
outportb(0x2f,0x00); //set register value Default :00h
// (bit3=1: minute. =0: second)
outportb(0x2e,0xf1); //set WDT Counter
outportb(0x2f,tt);
//set time out value of WDT
}
void show_ver()
{
unsigned
char
tmp0;
printf("Designed by attila of UNICORN computer corp. \n2014/10/10 release
version:1.0a\n");
printf("This program is design for test Watch Dog Timer for ENADT-3857 (NCT6106D).\n");
}