The following program shows how you might program the watchdog timer in BASIC:
10REM Watchdog timer example program
20X=Out &H443, 1 REM Enable and refresh the watchdog
30GOSUB 1000 REM Task #1, takes 1 second to complete
40X=Out &H443, 1 REM Refresh the watchdog
50GOSUB 2000 REM Task #2, takes 1 second to complete
60X=Out &H443, 0 REM Disable the watchdog
70 END
1000 REM Subroutine #1, takes 1 second to complete
.
.
.
1070 RETURN
2000 REM Subroutine #2, takes 1 second to complete
.
.
.
2090 RETURN
Appendix E Programming the Watchdog Timer | 109 |