Page 1 of 1

Watchdogreset in Flowcode

Posted: Thu Apr 05, 2007 12:38 pm
by Rosenbaum
Wow I can reset the watchdog in flowcode, or how I can bring in the clrwdt-command into flowcode ?

Posted: Thu Apr 05, 2007 1:01 pm
by Steve
You can add a C icon with the text "clr_wdt();" in it to clear the watchdog timer.

The problem is that any delay routines (e.g. the delay icon) will not reset the watchdog timer. You would need to create a long-ish delay this in another way (e.g. by calling multiple small delays with the "clr_wdt();" statement between them).

Posted: Fri Apr 13, 2007 11:30 am
by Rosenbaum
Hello,
I tried your solution. but it is not working for me.

I got an error-message:

error: unknown identifier 'clr_wdt'
error: failed to generate expression


Can you help me to reset the watchdog.

Posted: Fri Apr 13, 2007 11:38 am
by Steve
Oops, sorry about that! Try this instead:

Code: Select all

clear_wdt();

Posted: Mon Apr 23, 2007 4:02 pm
by Mark
Steve,

Could we have a Clear WDT flowfunction in the next update? Should be fairly easy to implement?

Thanks,

Mark

Posted: Mon Apr 23, 2007 4:08 pm
by Steve
Hello Mark,

Unfortunately it's not that easy because the 'C' delay functions do not reset the watchdog timer - so as soon as you add a 1 second delay, the watchdog timer will be triggered.

There may be a way around this, by modifying the delays code so that a shorted delay is called multiple times within a loop that also resets the watchdog timer. I will look into how easy this would be to do.

Posted: Sat May 12, 2007 11:33 pm
by Mark
Hi Steve,

I am not sure that you can stop misapplication of the WDT. After all, if the prescaler is used with Timer0 or the prescaler timeout is short, even though assigned to the WDT, the same problems will occur with even shorter delays than 1s (or even with the ASC at low clock speeds).

The WDT functionality is present anyway and accessible via the config dialog. I would suggest making sure that when WDT is selected in the Config dialog that an 'only if you know what you are doing' dialog pops up, or the option is coloured red etc. This would in any case save the perennial forum post from newbies not being able to get their programs working (and those who just never get as far as the forum and give up?).

On the other hand, chips like the 16F88X have WDT timeouts of very many seconds (if you want it).

The CLRWDT icon can be simply that command, it is just that I only want to use 'C code specials' in Flowcode when I have to and not for trivia like CLRWDT or for that matter SLEEP. If you ever do contemplate adding such a flowsymbol then incorporating in it an automatic calculation/estimate of WDT timeout period (from prescaler assignment and nominal WDT clock speed) would give it added value.

Regards

Mark

ps the SLEEP icon would need a check box to optionally add a NOP after the Assembler sleep command (see data sheet).

pps In any case, these two suggestions give you just about the easiest 'win' in adding useful functionality to Flowcode that I can imagine and would be more widely usable than, say I2C etc.?

Posted: Mon May 14, 2007 9:43 am
by Steve
Thanks for your thoughts, Mark

I think our position on this has to be that use of the watchdog timer, and the sleep function for that matter, are advanced features.

This functionality is easily accessible via a 'C' icon with a simple line or two, which is easy enough to implement by the majority of Flowcode users (with information and help gained via this forum!).