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 CCS Technical Support

Help with WDT and TOCKI

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



Joined: 03 Oct 2006
Posts: 17

View user's profile Send private message

Help with WDT and TOCKI
PostPosted: Thu Oct 12, 2006 6:41 pm     Reply with quote

I would like to "wake up" a pic16F54 every half a second and check the status of RA2.

As suggested by others, I'll have to use the watchdog Timer. My questions is how to set the "postscalar" and how I should configure the pins? That is, do I need to tie TOCKI to Vdd, Vss, or somehow use it?

Thanks.

And thank you all for all the help I've been given to date. I hope that I'll be good enough at this someday to pass on the favor to others.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Oct 12, 2006 9:30 pm     Reply with quote

The watchdog timer runs on its own internal RC oscillator. There's
no external oscillator.

To use the watchdog, enable it in the #fuses statement.
At the start of main(), put in a setup_wdt() statement.
Look near the end of the 16F54.H file and you'll see eight
#define statements that let you choose the nominal WDT
period. Put one of those constants into the setup_wdt()
function as a parameter.

You'll also have to put one or more restart_wdt() statements in
suitable location(s) in your program, to prevent the WDT
from resetting your program during normal operation.
Ttelmah
Guest







PostPosted: Fri Oct 13, 2006 3:16 am     Reply with quote

Remember though, that the watchdog is very innaccurate. It is fine, provided by 'half a second', you are prepared to accept that in some temperatures/chips, this may be anything from perhaps 1/4 second, to a second. If however the time is important, another route will be needed...

Best Wishes
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