Documentation Number ATxWDT-1303
Appendix B
B-1
B&B Electronics Mfg Co – 707 Dayton Rd - PO Box 1040 - Ottawa IL 61350 - Ph 815-433-5100 - Fax 815-433-5104
B&B Electronics Ltd – Westlink Comm. Pk – Oranmore, Galway, Ireland – Ph +353 91-792444 – Fax +353 91-792445
Appendix B: QuickBASIC Example
Note: An additional test program for the WDT is available on
B&B’s ftp site at ftp.bb-elec.com/bb-elec/software.
B&B Electronics Mfg. Co.
Watchdog Timer QuickBASIC Example Program
This code is an example of how the WDT is addressed from
within a program. This code would be used when the TIMER RESET
INPUT jumper is in the "CODE" position.
PCWDTaddress = &H300
'hex address chosen for the PCWDT
LatchValue = &H7
'hex latch value chosen, in this
'case about a 16 second timeout
'Main loop of your program
DO WHILE INKEY$ = ""
'repeat loop until keypressed
OUT PCWDTaddress, LatchValue 'This statement must be executed
'within the timeout period (17
'seconds for this example) or the
'PCWDT will reboot the computer.
X = inp(PCWDTaddress)
‘this statement reads the WDT
‘registers
X = X AND 31
‘This Statement masks out the 5
‘Least Significant bits
Print HEX$(X)
‘convert to hex
LOOP
Start = TIMER
‘start the timer
DO WHILE INKEY$ = ""
‘loop to print time for timeout
Print using “###.#”; (TIMER – Start):Print “ Seconds”
LOOP
X = inp(PCWDTaddress)
X = X AND 31
Print HEX$(X)
OUT PCWDTaddress, 0
'disable PCWDT before ending
END