![](/images/new-backgrounds/1166040/166040203x1.webp)
Programming the Watchdog Timer
In order to program the watchdog timer, you must write a program which writes I/O port address 443 (hex). The output data is a value of time interval. The value range is from 01(hex) to 3F(hex), and the related time interval is 1 sec. to 63 sec.
Data | Time | Interval |
01 | 1 | sec. |
02 | 2 | sec. |
03 | 3 | sec. |
044 sec.
.
.
.
3F | 63 sec. |
After data entry, your program must refresh the watchdog timer by rewriting the I/O port 443 (hex) while simultaneously setting it. When you want to disable the watchdog timer, your program should read I/O port 043 (hex).
The following example shows how you might program the watchdog timer in BASIC:
10REM Watchdog timer example program
20OUT &H443, data REM Start and restart the watchdog
30GOSUB 1000 REM Your application task #1
40OUT &H443, data REM Reset the timer
50GOSUB 2000 REM Your application task #2
60OUT &H443, data REM Reset the timer
70X=INP (&H043) REM Disable the watchdog
timer
80END
1000 REM Subroutine #1, you application task
.
.
.
1070 RETURN
2000 REM Subroutine #2, you application task
.
.
.
2090 RETURN
92 |