How does the µC/DSP watchdog work with VisSim?
Submitted by francois on Tue, 09/22/2009 - 19:02
How does the watchdog work with VisSim in the DSP? In a µC, it consists of an interrupt that resets the computer automatically if the watchdog is not disarmed before the end of a predefined time period. It means that the programmer must arrange to periodically reset the watchdog timer to prohibit the watchdog from resetting the DSP.
The watchdog is used to detect infinite looping in the software. The VisSim watchDog block lets you set the period of the watchdog. How do I give it the reset codes? Does it require any interrupt management? Can VisSim do interrupt handling?
Answers
-
Submitted by Richd on Tue, 09/22/2009 - 19:22.
In VisSim, just insert a watchdog block to activate the watchdog. This will generate code to enable the watchdog circuitry and send the watchdog timer reset codes at the user designed control rate. Just make sure that your watchdog Time Until Reset interval is bigger than your main control rate interrupt interval (from Simulate>Simulation Properties...>Time Step). If Time Until Reset is less than the time between executions of the watchDog block, then the watchdog will be constantly rebooting.
Occasionally, you may want to force a reboot. You can do this by 'starving' the watchdog (withholding the watchdog timer reset codes). This is done in VisSim by checking the use Input to Enable option, and creating a Boolean condition connected to the resulting input pin that is false when you want a reset to occur.Yes, VisSim can handle generic interrupts, but that's a post for another discussion.
0