"sleep" inside a loop

For general Flowcode discussion that does not belong in the other sections.
mnfisher
Valued Contributor
Posts: 1453
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: "sleep" inside a loop

Post 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

mnfisher
Valued Contributor
Posts: 1453
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 135 times
Been thanked: 707 times

Re: "sleep" inside a loop

Post 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

chipfryer27
Valued Contributor
Posts: 1528
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 353 times
Been thanked: 549 times

Re: "sleep" inside a loop

Post by chipfryer27 »

Hi Martin

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

Regards

ELECTRONICA67
Posts: 127
Joined: Wed Dec 02, 2020 3:59 pm
Has thanked: 24 times
Been thanked: 9 times

Re: "sleep" inside a loop

Post 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

Post Reply