low powerwise

212

Senior Member
08M

My cheap-o meter is toooo slow to know. Which one of these uses less power???


low 0
low 1
low 2
low 4

disablebod

standby:
do
nap 4
if pin3 = 1 then goto whatever
loop

whatever:
high 2
nap 7
low 2
goto standby




ORRRRRRR

low 0
low 1
low 2
low 4

disablebod
setint %00001000,%00001000

standby:
do
nap 4
loop

interrupt:
high 2
nap 7
low 2
setint %00001000,%00001000
return
 
Last edited:

hippy

Ex-Staff (retired)
I haven't tested it but I would expect it to be the second using interrupts.

In the first the PICAXE has to stay awake to execute the IF PIN3 command, in the second the check for Pin 3 high and interrupt is carried out within the Firmware itself everytime the NAP completes which is far quicker to execute.

PS : The "Goto standby" in the interrupt won't work; it won't re-enable interrupts. You need to end with a RETURN.
 

BeanieBots

Moderator
Get a largish capacitor, charge it to 5v and then power your circuit from it.
The one which runs the longest draws the least power.
 

212

Senior Member
Thanks for both replies. You don't mis anything hippy. I was mainly interested in the power the loop uses, but I should have written it properly anyway....fixed it :) (and thanks for watching that)

BeanieBots, I never thought of that, thanks! But I'm now wondering how I will know if it is still running??? I suppose it will run till the voltage goes too low on each, so I might be able to just stop the timer when the voltage drops to maybe 2 volts.

I bet hippy is right......... don't tell him, but he usually is....
 

212

Senior Member
Well...as far as I'm concerned they are a wash, but yes, the interrupt one is a little better. Using a 16 volt 220uf cap, and charging it to 4.45 volts, I get right under 2 minutes run time, stopping the timer at 3 volts. Far better than what I have been using, which takes only 20 seconds to drop to 3 volts.

low 0
low 1
low 2
low 4
disablebod

standby:

poke $8f,%00000000
if pin3 = 1 then check_light
goto standby

check_light:
goto standby
 
Last edited:
Top