SBC comm SBC-350A ユーザーズマニュアル

ページ / 52
Appendix A Programming the watchdog timer    39
Watchdog Timer Delay Values
Delay Time
Value (Hex)
Delay Time
Value
(Hex)
0 ~ 2
E
16 ~ 18
6
2 ~ 4
D
18 ~ 20
5
4 ~ 6
C
20 ~ 22
4
6 ~ 8
B
22 ~ 24
3
8 ~ 10
A
24 ~ 26
2
10 ~ 12
9
26 ~ 28
1
12 ~ 14
8
28 ~ 30
0
14 ~ 16
7
The following demo program illustrates the programming steps
required to enable, set the time-out interval and disable the
watchdog timer.
#include<stdio.h> #include<dos.h> #include <conio.h> #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 Sec-30 Sec)”);
 /* Set watchdog timer time-out interval */
 scanf(“%2d”,&dog);
   /* Input watchdog timer time-
 out interval (Sec) */
 dog=dog/2;
   /* Convert time-out interval
 to designated Hex */
 dog=15-dog;
 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 */