View previous topic :: View next topic |
Author |
Message |
shardul
Joined: 12 Nov 2010 Posts: 8
|
more power consumed in sleep mode 18f25k20 |
Posted: Tue Aug 07, 2012 7:28 am |
|
|
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 |
|
|
Gabriel
Joined: 03 Aug 2009 Posts: 1067 Location: Panama
|
|
Posted: Tue Aug 07, 2012 8:13 am |
|
|
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
|
|
Posted: Tue Aug 07, 2012 8:19 am |
|
|
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
|
tried that too |
Posted: Tue Aug 07, 2012 8:34 am |
|
|
thanks for replying
i've tried your way before too .... no success
floating pin consume current ? idk
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
thanks |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
|