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

PIC 16f877a sleep

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



Joined: 15 Jan 2009
Posts: 60

View user's profile Send private message Visit poster's website

PIC 16f877a sleep
PostPosted: Thu Apr 15, 2010 6:09 am     Reply with quote

Hi,

I need to use sleep mode for PIC 16f877a for particular time and have to wake up the microcontroller after 5 seconds. Which commands can be used for these actions? Can you help me?

thanks,

Varadharaj.E
_________________
embedding innovation in engineers
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Thu Apr 15, 2010 10:03 am     Reply with quote

No instructions.
To give a time, requires an external oscillator (A RTC chip, with an alarm output for example). The PIC itself, does not have this ability.

The 'nearest' you can get, is first to use Timer1, running with a watch crystal between C0, and C1, disable T1SYNC, and you can then get an interrupt after a maximum of 65536 cycles of this (typically 2 seconds, with a 32768Hz crystal), Do this twice, then set the timer 'on' to 32768 counts, and the next interrupt will be after only one second, giving the five seconds required. So the chip will have actually woken three times, but for such a short duration, that the power consumption will be miniscule.
So the 'minimum' solution would be to add such a crystal, and use this ability, but with the downside that the chip will wake three times.

Other possible solution without hardware, is the watchdog, but this is terribly inaccuracte. It's 'nominal' time period is 18mSec, but this varies from 7mSec to 33mSec. Using the maximum prescaler (/128), gives a nominal 2.3 seconds, but this varies between chips, temperature, and power voltage, down to 0.896 seconds, and up to up to 4.2 seconds. Repeating the time twice to get close to 5 seconds, will give times from under 2 seconds, up to over 8 seconds...

So if you want an accurate 5 second timeout, best choice, is to add an externall RTC, with a programmable alarm, and set this to give 5 seconds.

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