minimising 18F basic operational current!
Hi,
Now that I've had help with the WDT, the other issue is the minimisation of the running current when the device is awake. I have an 18F26J53 on a bit of strip board with a couple of LEDs. When sleeping, my 'cheap' multimeter reads 0.03 mA (nice!), but when not sleeping, but simply in a pause for 3 seconds, it's drawing just over 10 mA! The LEDs are not powered on, as far as I can tell, I've powered down all the possible internal modules with PMDIS0-3, switched ports to digital and set all low.
What is drawing 10 mA?!!!
If I can resolve this I'm onto a winner!
Best regards to all fellow PBP'ers!
Cheers
Jimbo
The .inc file...
Code:
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F26J53, r = dec, w = -311, f = inhx32
INCLUDE "P18F26J53.INC" ; MPASM Header
CONFIG XINST = OFF
CONFIG PLLDIV = 2; 4
CONFIG WDTPS = 512;512
CONFIG WDTEN = ON
CONFIG OSC = INTOSCPLL ;HSPLL;
CONFIG ADCSEL = BIT12
CONFIG RTCOSC = T1OSCREF
CONFIG IESO = OFF
CONFIG CFGPLLEN = ON
CONFIG CPUDIV = OSC1
CONFIG CLKOEC = OFF
CONFIG SOSCSEL = LOW
CONFIG DSBOREN = OFF
NOLIST
endif
LIST
BLOCK_SIZE EQU 64
The code...
Code:
Include "modedefs.bas"
DEFINE OSC 24
ancon0 = %11111111
ancon1 = %00011111
intcon = 0
intcon2 = %11110101
intcon3 = %00000000
ADCON0 = 0
ADCON1 = 0
trisa = %00000000
trisb = %00000000
trisc = %00000000
low porta
low portb
low portc
pmdis0 = %11111111
pmdis1 = %11111111
pmdis2 = %11111111
pmdis3 = %11111111
WDTCON.0 = 1
main:
pause 3000
@ sleep
@ nop
goto main
Re: minimising 18F basic operational current!
ok, just realised I can't say 'low port a' etc so have switched that to porta = %00000000 etc...
I've also disabled USB I think with UCON = %00010000 and UCFG = %00001000
but still, this circuit is drawing 10 mA doing nothing but pausing. I'm really stuck :(
Re: minimising 18F basic operational current!
Hi Jimbo,
pause does not put the chip in any kind of sleep state. It is busy counting. And from page 520 :) of the data sheet, it says at 48 mhz, the chip will use 19.5 ma. So, at 24 mhz, it should use half that, which is equal to about what you are seeing. To use minimal power put it in a sleep mode for as long as you can, and just do periodic work with the chip awake.
Re: minimising 18F basic operational current!
Hi there,
Spot on, and many thanks for your help! I used the internal osc, turned off PLL etc and got it to a couple of mA in the end. One final issue now which I'll start a new thread for... SD cards!!!
Best regards
Jimbo