View previous topic :: View next topic |
Author |
Message |
exodia505
Joined: 07 Feb 2012 Posts: 34
|
sleep mode |
Posted: Thu Mar 29, 2012 6:53 am |
|
|
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: 1349
|
|
Posted: Thu Mar 29, 2012 7:06 am |
|
|
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: 19520
|
|
Posted: Thu Mar 29, 2012 7:55 am |
|
|
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
|
|
|
|