View previous topic :: View next topic |
Author |
Message |
PIC16F917 sleep mode Guest
|
too high power consumption in sleep mode |
Posted: Mon Jul 16, 2007 3:20 pm |
|
|
Hi, I am experiencing the power consumption problem when PIC16F917 goes to sleep mode. Assume the circuit is correctly. How can I prepare a simple code which just runs to sleep and make it run on the lowest power consumption. Here's my code, but it shows too high of power consumption...
//#fuses NOWDT,INTRC_IO, NOPUT, NOPROTECT, NOMCLR, NOCPD, BROWNOUT, NOIESO, NOFCMEN, NODEBUG
void main()
{
while(TRUE)
{
set_tris_a(0x00);
set_tris_b(0x00);
set_tris_c(0xFF);
set_tris_d(0xFF);
set_tris_e(0xFF);
setup_comparator(NC_NC_NC_NC);
B_ANSEL=0x00;
SLEEP(); //Get in Sleep mode
}
}
I appreciate anyone can give any idea of it.
Thanks.
Bob |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Bill Boucher
Joined: 04 Feb 2005 Posts: 34 Location: Chatham,ON,CA
|
|
Posted: Tue Jul 17, 2007 10:32 am |
|
|
Also be aware that if your ANx pins are set to digital mode, don't leave them floating or the logical input buffers may draw excess current. Unused and unconnected pins can be forced to a valid high or low state by programming them as outputs. That will prevent floating so that no external pullup or pulldown resistors are needed. If you want to leave them floating (for some unknown reason) then program them as analog mode (that's the default mode I think) and the input buffers will be shut off and that will also prevent undue current draw. |
|
|
|