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

more power consumed in sleep mode 18f25k20

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



Joined: 12 Nov 2010
Posts: 8

View user's profile Send private message

more power consumed in sleep mode 18f25k20
PostPosted: Tue Aug 07, 2012 7:28 am     Reply with quote

Hi,
ccs 4.120, device:-18f25k20
I'm trying to make it sleep by a simple sleep(); instruction
facing strange problem, before sleep it takes 1.2mA & after 8.41mA.

I've tried all oscillator configuration!

.h file contains following code
Code:

#include <18F25K20.h>
#device adc=10

#FUSES NOWDT                    //No Watch Dog Timer
#FUSES WDT128                   //Watch Dog Timer uses 1:128 Postscale
#FUSES INTRC_IO                    //Internal RC Osc
#FUSES NOBROWNOUT               //No brownout reset
#FUSES NOPBADEN                 //PORTB pins are configured as digital I/O on RESET
#FUSES NOLPT1OSC                //Timer1 configured for higher power operation
#FUSES NOHFOFST                 //High Frequency INTRC waits until stable before clocking CPU
#FUSES NOLVP                    //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOXINST                  //Extended set extension and Indexed Addressing mode disabled (Legacy mode)

#use delay(int=1M)

#use rs232(baud=9600,parity=N,xmit=PIN_C6,rcv=PIN_C7,bits=8)
#use i2c(Master,Fast,sda=PIN_C4,scl=PIN_C3)

Please guide me I'm stuck since a day Crying or Very sad
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Tue Aug 07, 2012 8:13 am     Reply with quote

keep pins from foating.. set them as outputs and tie them to V+or GND.. allowing them to float will consume alot of power.

turn OFF all prehipedrals your not using... ADC, WDT, TIMERS, COMPARATORS, UART... you get the point...

changing oscillator frequencies will help you conserve power while running...
in sleep, the oscillator is off...

G.
_________________
CCS PCM 5.078 & CCS PCH 5.093
FvM



Joined: 27 Aug 2008
Posts: 2337
Location: Germany

View user's profile Send private message

PostPosted: Tue Aug 07, 2012 8:19 am     Reply with quote

Gabriel has addressed the important aspects. Just a small correction, in sleep mode all oscillators except for WD and possibly 32 kKz crystal are off, digital modules aren't at risk to consume power.
shardul



Joined: 12 Nov 2010
Posts: 8

View user's profile Send private message

tried that too
PostPosted: Tue Aug 07, 2012 8:34 am     Reply with quote

thanks for replying
i've tried your way before too .... no success
floating pin consume current ? idk Confused
i have 3 empty pins which are configured as o/p and @ logic 0.... will that affect ?
also shutting down the peripherals which are/will not used.
made WDT off ... still same result

i have big doubt on Internal pullups of port b !
i didnt get much about oscillator specified in datasheet Embarassed
thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Aug 07, 2012 3:42 pm     Reply with quote

The following threads discuss how to reduce current usage in Sleep mode:
http://www.ccsinfo.com/forum/viewtopic.php?t=45094
http://www.ccsinfo.com/forum/viewtopic.php?t=44141
http://www.ccsinfo.com/forum/viewtopic.php?t=22402
http://www.ccsinfo.com/forum/viewtopic.php?t=19006&start=12
http://www.ccsinfo.com/forum/viewtopic.php?t=40938
Some of these threads are two pages long.


Gabriel wrote:

set them as outputs and tie them to V+or GND

You shouldn't tie pins configured outputs to the power rails.
It will burn out the pin if the levels don't match. Just set
unused pins to be outputs and set them to a low level.
For example, if pin B0 not used in your design, then do this:
Code:

output_low(PIN_B0);
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