181 of 307
ZBasic System Library 171 ZX Microcontroller Family OpenWatchDog Type Subroutine Invocation OpenWatchDog(timeout) Parameter Method Type Description timeout ByVal Byte Specifies a timeout value (see discussion). Discussion This subroutine prepares the watchdog timer for use. Once it is opened, the WatchDog() routine must be called from time to time. If the period between WatchDog() calls exceeds the timeout value, the system will be reset. The timeout value is 16.384 milliseconds times 2 to the N power where N is the value of the timeout parameter limited to the range shown in the table below. Note that the timeout value varies with processor voltage. It is slightly longer at 3.0 volts than at 5.0 volts. Consult the Atmel documentation for more specific information. WatchDog Timeout Parameter Range ZX Models Timeout Range Max. Time ZX-24, ZX-40, ZX-44 0-7 2 sec ZX-24a, ZX-40a, ZX-44a, ZX-24p, ZX-40p, ZX-44p, ZX-24n, ZX-40n, ZX-44n 0-9 8 sec ZX-328n, ZX-328l, ZX-32n, ZX-32l, ZX-1281, ZX-1281n, ZX-1280, ZX-1280n 0-9 8 sec ZX-24e, ZX-128e, ZX-128ne 0-7 2 sec ZX-24ae, ZX-24pe, ZX-24ne, ZX-1281e, ZX-1281ne, ZX-328nu 0-9 8 sec When the processor is reset, the register value Register.ResetFlags contains bit flags indicating the source of the reset. It is important to note that the occurrence of a system fault (e.g. a stack overflow) will also cause a WatchDog reset as will calling ResetProcessor(). See the section on Run Time Stack Checking in the ZBasic Reference Manual for more information on stack overflow detection. The watchdog timer can be turned off using CloseWatchDog. Compatibility BasicX doesn’t support Register.ResetFlags or CloseWatchDog. See Also WatchDog, CloseWatchDog, ResetProcessor