User`s manual

116 digi.com The Virtual Driver
7.4 Watchdog Timers
Watchdog timers limit the amount of time your system will be in an unknown state.
7.4.1 Hardware Watchdog
The Rabbit CPU has one built-in hardware watchdog timer
i
. The Virtual Driver hits the watchdog timer
(WDT) periodically. The following code fragment could be used to disable this WDT:
#asm
ld a,0x51
ioi ld (WDTTR),a
ld a,0x54
ioi ld (WDTTR),a
#endasm
However, it is recommended that the watchdog not be disabled. The watchdog prevents the target from
entering an endless loop in software due to coding errors or hardware problems. If the Virtual Driver is not
used, the user code should periodically call hitwd().
When debugging a program, if the program is stopped at a breakpoint because the breakpoint was explic-
itly set, or because the user is single stepping, then the debug kernel hits the hardware watchdog periodi-
cally.
7.4.2 Virtual Watchdogs
There are 10 virtual WDTs available; they are maintained by the Virtual Driver. Virtual watchdogs, like the
hardware watchdog, limit the amount of time a system is in an unknown state. They also narrow down the
problem area to assist in debugging.
The function VdGetFreeWd(count)
allocates and initializes a virtual watchdog. The return value of
this function is the ID of the virtual watchdog. If an attempt is made to allocate more than 10 virtual
WDTs, a fatal error occurs. In debug mode, this fatal error will cause the program to return with error code
250. The default run-time error behavior is to reset the board.
The ID returned by VdGetFreeWd() is used as the argument when calling VdHitWd(ID) to hit a vir-
tual watchdog or VdReleaseWd(ID) to deallocate it.
The Virtual Driver counts down watchdogs every 62.5 ms. If a virtual watchdog reaches 0, this is fatal
error code 247. Once a virtual watchdog is active, it should be reset periodically with a call to
VdHitWd(ID) to prevent this. If count = 2 for a particular WDT, then VdHitWd(ID) will need to be
called within 62.5 ms for that WDT. If count = 255, VdHitWd(ID) will need to be called within 15.94
seconds.
The Virtual Driver does not count down any virtual WDTs if the user is debugging with Dynamic C and
stopped at a breakpoint.
i. Starting with the Rabbit 3000A, Rabbit microprocessors have secondary hardware watchdog timers. See
the users manual for your Rabbit processor for details, e.g., the Rabbit 3000 Microprocessor Users
Manual.