#include<stdio.h> #include<dos.h> #include<conio> #include <time.h> #include<graphics.h> void mydelay(void);
/* MAIN PROGRAM */ void main (void) { unsigned int dog=0
run_time=0;
char inkey;
clrscr();
gotoxy(15, 6);printf("AAEON TECHNOLOGY, INC."); gotoxy(15, 7);printf("WATCHDOG TIMER TEST & DEMO PROGRAM");
gotoxy(15, 9);printf("Please setup watchdog delay time:(2
/* Set watchdog timer
scanf("%2d",&dog); | /* Input watchdog timer time- |
out interval (Sec) */ |
|
dog=dog/2; | /* Convert |
to designated Hex */ |
|
| |
outportb (0x443,dog); | /* Enable watchdog timer */ |
/* Setup screen display format */ | |
gotoxy(15,11);printf("Now enable watchdog!"); |
gotoxy(15,12);printf("You can put keyboard reset or disable watchdog.");
gotoxy(15,13);printf(" [1]. Reset watchdog."); gotoxy(15,14);printf(" [2]. Disable watchdog."); gotoxy(15,15);printf(" [3]. Return to O.S."); /* Read key pressed */
while(1){
if(kbhit()){
inkey=getch();
switch(inkey){
case '1': /* Reset Watchdog timer */ gotoxy(15,11);printf("Now enable watchdog timer!"); outportb(0x443,dog); run_time=0;
break;
case '2': /* Disable Watchdog timer */ gotoxy(15,12);printf("Now disable watchdog timer!"); outportb (0x80,dog);
return;
default : break;
}
}