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
Using Watchdog in 12F675
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Using Watchdog in 12F675
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Using Watchdog in 12F675
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();
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();
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: Using Watchdog in 12F675
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
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
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Using Watchdog in 12F675
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 )
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 )
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: Using Watchdog in 12F675
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
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
- tanlipseong
- Posts: 31
- Joined: Thu Aug 27, 2009 3:11 pm
- Location: Malaysia
- Contact:
Re: Using Watchdog in 12F675
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
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