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

sleep and wake up once a second

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



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

sleep and wake up once a second
PostPosted: Wed Mar 25, 2009 7:49 am     Reply with quote

I'm using a pic16f876A and 3.249. Is there a way for the pic to sleep for a certain amount of time then wake up? I see you can wake up from an external event but I want to wake up, check some stuff and go back to sleep.
I'm thinking maybe wake up once a second or so.
Ringo
_________________
Ringo Davis
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 9:10 am     Reply with quote

You can use the WDT to wake up from sleep.
You can either use the hardware WD which cannot be turned off so you need to kick it while the prog is running and just before going to sleep.

I use the software WD,
turn it on -> sleep -> (WDT) -> wakeup -> turn it off.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 9:13 am     Reply with quote

ok, I know how to set up the watchdog to go off after a second a that will reboot the board, if you are sleeping does it wake you up instead of rebooting, or is there something special to do to wake up instead?
Ringo
_________________
Ringo Davis
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 10:31 am     Reply with quote

The WDT will wake the pic up from a sleep but reset if the pic was awake Smile

Check the datasheet on the pic you are using. If I remember the info is in there but a bit subtle Smile
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 10:34 am     Reply with quote

Page 155, 14.13

"During normal operation, a WDT time-out generates a
device Reset (Watchdog Timer Reset). If the device is
in Sleep mode, a WDT time-out causes the device to
wake-up and continue with normal operation (Watchdog
Timer Wake-up)"
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 10:45 am     Reply with quote

Cool, but this looks too easy :-)
_________________
Ringo Davis
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 1:57 pm     Reply with quote

It is actually easy. Of course the WDT hasn't a precise timing, it's not suitable as a real time clock.

If RTC like precision is required, SEC_IDLE mode with PIC18 can use a watch crystal as time base, but power consumption is considerably higher than with an external RTC chip, that also can provide an 1 Hz wakeup signal.
Ringo42



Joined: 07 May 2004
Posts: 263

View user's profile Send private message

PostPosted: Wed Mar 25, 2009 1:58 pm     Reply with quote

Thanks, I'm not using it for timing, just power saving so this will be just fine.
Thanks again
_________________
Ringo Davis
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