Watchdog

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

Post Reply
echase
Posts: 429
Joined: Mon Jun 11, 2007 11:55 am
Has thanked: 49 times

Watchdog

Post by echase »

Just about everything you read about PICs says turn the watcrchdog off. What is the purpose of the watchdog then?

I have had a few cases of the PIC freezing up (at least the LCD freezes up, not absolutely sure if this means the PIC has stopped running too, or is just stuck in a continouos loop) and I’d like the watchdog to detect this and reboot the PIC. Will it do this if I turn it on?

What kind of things does the watchdog detect? E.g a divide by zero?

Ideally I’d find the cause of this freezing, but just in case, it’s safer in my case to continuously reboot than to freeze up.
Last edited by echase on Mon Sep 17, 2007 12:56 pm, edited 1 time in total.

User avatar
Steve
Matrix Staff
Posts: 3433
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times

Post by Steve »

The WDT basically used an internal timer that resets your program if this timer overruns. You use it within your program by making sure the watchdog timer is constantly reset throughout your program (using the C function clrwdt).

Unfortunately, Flowcode (or specifically, the C compiler "underneath" Flowcode) does not reset the WDT during the delay instruction. This means you cannot realistically use the WDT within Flowcode.

Post Reply