Watchdogreset in Flowcode

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

Moderators: Benj, Mods

Post Reply
Rosenbaum
Flowcode V4 User
Posts: 25
Joined: Thu Feb 22, 2007 3:20 pm
Has thanked: 1 time
Been thanked: 5 times
Contact:

Watchdogreset in Flowcode

Post by Rosenbaum »

Wow I can reset the watchdog in flowcode, or how I can bring in the clrwdt-command into flowcode ?

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

Post 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).

Rosenbaum
Flowcode V4 User
Posts: 25
Joined: Thu Feb 22, 2007 3:20 pm
Has thanked: 1 time
Been thanked: 5 times
Contact:

Post 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.

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

Post by Steve »

Oops, sorry about that! Try this instead:

Code: Select all

clear_wdt();

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Post by Mark »

Steve,

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

Thanks,

Mark
Go with the Flow.

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

Post 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.

Mark
Posts: 209
Joined: Thu Oct 19, 2006 11:46 am
Location: Bakewell, UK
Has thanked: 20 times
Been thanked: 16 times
Contact:

Post 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.?
Go with the Flow.

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

Post 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!).

Post Reply