User`s manual

Table Of Contents
PCM-3347 User’s Manual 74
Appendix A Programming the Watchdog
Timer
A.1 Programming the watchdog timer
The default configuration of the timer is enabled with system reset.
To enable the watchdog timer, you must make a program which writes 1
to I/O port address 443 (hex) at regular intervals. The first time your pro-
gram reads the port, it enables the watchdog timer. After that, your pro-
gram must write 1 to port 443 at time intervals of less than 1.6 seconds.
Otherwise, the watchdog timer will activate and reset the CPU. When you
want to disable the watchdog timer, your program should write 0 to port
443.
If CPU processing comes to a standstill because of EMI or a software
problem, your program's signals to I/O port address 443 of the timer will
be interrupted. The timer will then automatically reset the CPU, and data
processing will continue normally.
You must make your program so that it writes 1 to I/O port 443 at an
interval shorter than the timer's preset interval. The timer's intervals have
a tolerance of ± 30%, so you should program an instruction that will
refresh the timer about every second.
The following example shows how you might program the watchdog
timer in BASIC:
10 REM Watchdog timer example program
20 X=Out &H443,1 REM Enable and refresh the watchdog
30 GOSUB 1000 REM Task #1, takes 1 second to complete
40 X=Out &H443,1 REM Refresh the watchdog
50 GOSUB 2000 REM Task #2, takes 1 second to complete
60 X=Out &H443,0 REM Disable the watchdog
70 END
1000 REM Subroutine #1, takes 1 second to complete
.
.
.