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

sleep mode

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



Joined: 07 Feb 2012
Posts: 34

View user's profile Send private message

sleep mode
PostPosted: Thu Mar 29, 2012 6:53 am     Reply with quote

Hello guys !!
I would like to know how to use external 32khz for sleep mode.
When I press button pic go to sleep and after 5 mins will wake up.
How to make 32khz tics count 5 mins?????
(pic18f452 /20mhz )
_________________
NOway!!
jeremiah



Joined: 20 Jul 2010
Posts: 1342

View user's profile Send private message

PostPosted: Thu Mar 29, 2012 7:06 am     Reply with quote

I've only ever done it for the PIC24, but here is the general idea:

1. See if any of your fuses affect the pins you use for the external oscillator. For example, on the PIC24FJ64GA004, there is a fuse setting for making the pins I/O versus external clock sources

2. If you are using a crystal (uses both in and out pins), then you may have to write a quick assembly block that turns on the secondary oscillator. If you are using a self powered oscillator (only uses the in pin), then you won't need that code

3. Setup your timer, it usually has to be timer1. Make sure it has an asynchronous mode, or it won't work. You would set it up for an external clock and will want to divide it down to as slow as you need for 5 mins. If you can't get it that slow, slow it down so you can get to an even divisor of 5, then use the interrupt + counter to get 5 mins + self maintained flag when it hits 5 mins.
Ttelmah



Joined: 11 Mar 2010
Posts: 19470

View user's profile Send private message

PostPosted: Thu Mar 29, 2012 7:55 am     Reply with quote

Have a look at the example posted by PCM_Programmer here:

<http://www.ccsinfo.com/forum/viewtopic.php?t=28158&start=8>

Best Wishes
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 29, 2012 12:22 pm     Reply with quote

Here is a better program that shows how to sleep for the specfied number
of seconds. It uses an external 32.768 KHz crystal (+ 2 capacitors)
and Timer1 to make an RTC that runs while the PIC is in sleep mode:
http://www.ccsinfo.com/forum/viewtopic.php?t=45458&start=5

Here is a deep sleep wake-up program. It doesn't apply to your PIC
(18F452), but it's included for reference:
http://www.ccsinfo.com/forum/viewtopic.php?t=45139&start=3
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