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
Bookmarks