Page 6 of 6

Re: "sleep" inside a loop

Posted: Sun Nov 24, 2024 5:02 pm
by mnfisher
Power consumption - I'm intrigued how you got it so low...

So using a PIC12F1840 as per original question - I connected a (sensitive) ammeter. I set the code to use sleep (as above) with a 4s (0b1100) WDT timeout - and pulsed a4 for 1ms (again using a WDT with a prescaler of 0)
When a4 not pulsed - I set to an input.
I set the clock to 31KHz (LF IntOsc) and also in 'Sleep' do:

Code: Select all

VREGCONbits.VREGPM = 1; 
CLRWDT();
SLEEP();
At 2.2V supply - I get a current draw of (average) 4.80mA - with a 'peak' of 4.85mA when the pulse is sent.

Below ~2V it fails to run (constantly restarting?) and at 5V - it's using 10.53mA.

These figures seem a bit 'high' (the PIC boasts nanoWatt technology?) - and I maybe should unplug the PicKit when testing?

I also tested using the standard 'clock' and a delay - and the results aren't dramatically different for example at 5V with 1s on / 1s off at 16MHz I get ~11.7mA (clock etc is correct as I get a nice 1s blinkie on the scope)

So - maybe my measurement technique is 'off' - I'd certainly hoped to see better savings using sleep... Testing 'sleep' (using a 256s WDT timeout and 1ms pulse averages 10.48mA at 5V :-( )

Martin

Re: "sleep" inside a loop

Posted: Sun Nov 24, 2024 5:23 pm
by mnfisher
Looks like unplugging the PicKit is key...

Unplugged I get 12.56uA at 2V when in sleep mode... And it is still working at 1.8V :-) (Not quite at the 300nA in the datasheet though?)

Just rewired and tidied - and seem to be in the right ballpark for sleep ~300nA and with nothing attached to the MCU apart from the power supply.

Martin

Re: "sleep" inside a loop

Posted: Mon Nov 25, 2024 12:49 am
by chipfryer27
Hi Martin

You seem currently drawn in and it will soon consume your time if not energy.... :)

Regards

Re: "sleep" inside a loop

Posted: Tue Nov 26, 2024 4:02 am
by ELECTRONICA67
Hello :)

It's an interesting topic that I think will be useful in some project sooner or later. It's taken me a few weeks, but I still think it's worth learning, and I think there's more to learn; but as Lain says, it takes time. . . ;)

Best Regards