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...
The code...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
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


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.


Bookmarks