Page 1 of 1

Using Watchdog in 12F675

Posted: Fri Mar 12, 2010 9:45 am
by Benj
I need to use watchdog for 12F675 in project that is used outdoor with no one to to reset the MCU if it stop working.

Cannot manage to find any documentation on Flowcode V3 and this Forum about the usage.

Please help me on the usage in Flowcode V3.

Thanks in advance.

TanLS

Re: Using Watchdog in 12F675

Posted: Fri Mar 12, 2010 10:12 am
by Benj
Hello,

To allow the watchdog to work you should simply have to enable it in the chip -> configuration menu.

Then every so often if your program you will need to call the C function.

clear_wdt();

Re: Using Watchdog in 12F675

Posted: Fri Mar 12, 2010 12:18 pm
by tanlipseong
Thanks a lot Benj,

If i am using 4Mhz internal oscillator and let everything else default in Flowcode V3, how long before the watchdog reset occur?


Thanks in advance.
TanLS

Re: Using Watchdog in 12F675

Posted: Fri Mar 12, 2010 3:00 pm
by Benj
Hello,

It depends on what is the value of the prescaler.

You can change the prescaler by writing to the option register using C code.

Basically the formula would look like this.

max time period = 1 / ( clockspeed / 4 / prescaler / 256 )

Re: Using Watchdog in 12F675

Posted: Sat Mar 13, 2010 5:45 am
by tanlipseong
Benj

With Clock speed =4Mhz, the max time period to clear_wdt() = 0.032Sec.
if i use delay in the program that longer then above value, the watchdog will reset the MCU right?

how to go about using delay of say 0.5sec to blink LED while able to clear the watchdog timer?
do i need to use nested loop or there are better way?

Please help.
Thanks in advance
TanLS

Re: Using Watchdog in 12F675

Posted: Sat Mar 13, 2010 2:04 pm
by tanlipseong
Benj,

Earlier when i search for "watchdog" it returns only 1 hit, (that was during the time i can not post new topic).

now i do a search for "watchdog" it returns 170 hit. (and i found many info from there).

anyway thanks for helping.

Tq
TanLS