P104-WDG-CSM User Manual
17
To Program the Watchdog Interval
1. Disable the counters.
2. Program the counter modes
3. Program the desired time delays.
4. Enable the counters.
Once the counters have been enabled, the computer will reset if the 32-bit counter (counters 0
and 1) decrements all the way to zero. (Note: An alternative use of the reset signal is to simply
notify an external device that a reset is necessary.)
Debug Script to Initialize the Counter/Timers
The following debug script will initialize the counter/timers for a reasonable delay with a 2mS
positive pulse at pin 11 and an active-low (open-collector) signal at pin 12 on the I/O
connector. For suggestions regarding base address determination see page 11.
I BASE+7 ;DISABLE THE COUNTERS
I BASE+C ;SELECT THE 16MHz COUNTER CLOCK
O BASE+3 36 ;COUNTER 0 MODE
O BASE+0 FF ;COUNTER 0 DIVISOR LSB
O BASE+0 00 ;COUNTER 0 DIVISOR MSB
O BASE+3 76 ;COUNTER 1 MODE
O BASE+1 16 ;COUNTER 1 DIVISOR LSB
O BASE+1 00 ;COUNTER 1 DIVISOR MSB
O BASE+3 B6 ;COUNTER 2 MODE
O BASE+2 FF ;COUNTER 2 DIVISOR LSB
O BASE+2 FF ;COUNTER 2 DIVISOR MSB
And then send
O BASE+7 0 ;START THE WATCHDOG
OR
O BASE+F 01 ;START THE WATCHDOG
To pet the watchdog, reload counters 0 and 1 before they time-out.
Foreground Watchdog Mode
In order to prevent the reset, the software program must periodically reload Counter 1 with the
initial load value (or any other suitable load value). The maximum delay between Counter 1
reloads is determined by the load values of the concatenated counters minus a suitable fudge
factor. (Note: It is not necessary to re-load Counter 0 because it will simply recycle. Also note
that loading Counter 0 with full-scale is customary, as exact timing is rarely a requirement of a
watchdog function.)
Counter 0 must be programmed for mode 3. Counter 1 and 2 must be programmed for mode
2. The card was designed specifically for these modes. Any other modes may cause
unpredictable behavior. See Appendix A for details on how to program the counters.
In Summary:
1. Disable Watchdog Read BASE+7
2. Program CTR0 for Mode 3 See Appendix A
3. Program CTR1 and 2 for Mode 2 See Appendix A
Commentaires sur ces manuels