View previous topic :: View next topic |
Author |
Message |
volcane
Joined: 23 Feb 2008 Posts: 29
|
use of watch-dog |
Posted: Sat May 02, 2009 7:33 am |
|
|
Hi!
if i want to use the watch-dog functions blockers in type "void get_string (char * s, unsigned int8 max)" contained in "input.c" i have to change the function or there are other systems to be implemented? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 02, 2009 9:15 am |
|
|
get_string() calls the getc() function. You can add the 'restart_wdt' parameter to the #use rs232() statement, and it will take care of it.
From the manual:
Quote: |
RESTART_WDT :
When specified in #use delay , #use I2c and #use RS232 statements like
this #use delay(clock=20000000, restart_wdt)
will cause the wdt to restart if it times out during the delay or i2c_read or getc. |
|
|
|
volcane
Joined: 23 Feb 2008 Posts: 29
|
|
Posted: Sat May 02, 2009 2:22 pm |
|
|
Hi
can also do so #use rs232(baud=9600, xmit=PIN_C6, rcv=PIN_C7, restart_wdt, ERRORS)
Thank you for the answers, but what do you think of using a timer interrupt to recharge the watch dog? |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat May 02, 2009 3:11 pm |
|
|
I think it's a bad idea. What if your program is stuck in a loop for some
reason ? The timer interrupt would keep restarting the Watchdog Timer
and you would never get a Watchdog reset. Your code would remain
stuck in the loop. This defeats the purpose of the Watchdog Timer. |
|
|
volcane
Joined: 23 Feb 2008 Posts: 29
|
|
Posted: Sat May 02, 2009 6:56 pm |
|
|
PCM programmer wrote: | I think it's a bad idea. What if your program is stuck in a loop for some
reason ? The timer interrupt would keep restarting the Watchdog Timer
and you would never get a Watchdog reset. Your code would remain
stuck in the loop. This defeats the purpose of the Watchdog Timer. |
Ok, thanks
you can use the same syntax for other functions blockers? |
|
|
|