CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

use of watch-dog

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
volcane



Joined: 23 Feb 2008
Posts: 29

View user's profile Send private message

use of watch-dog
PostPosted: Sat May 02, 2009 7:33 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 02, 2009 9:15 am     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 02, 2009 2:22 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 02, 2009 3:11 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Sat May 02, 2009 6:56 pm     Reply with quote

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?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group