To pause or not to pause ?

212

Senior Member
I'm wanting to do something according to how much light is seen by an LDR. I wrote this to check the light, and it seems to work fine whether or not I use the pauses. The LDR is on pin 1 and the power for it comes from pin 0 when I put it high. I want this low power, so after I check the light, I turn pin 0 back off and put pin 1 back to an output and put it low. I used Dippy's trick after that, and turn off the ADC converter. I'm happy :) my meter shows only 1.8ua while sleeping, and I'll be changing that to a longer sleep...I just wonder if the pauses are needed here ???


main:

input 1
'pause 100
high 0
'pause 100
readadc 1,b1
'pause 100
low 0
low 1
POKE $1F,0

if b1 > 200 and b2 = 0 then night_time
if b1 < 200 and b2 = 1 then day_time
sleep 1
goto main
 

hippy

Technical Support
Staff member
Me neither.

You could also try without the "LOW 1" and then move "INPUT 1" to before 'main:' as that would save a little more execution time. I don't know if the current draw is more with pin1 as an input and pulled to 0V via the LDR/R or as an output low.
 

212

Senior Member
Thanks!

I was told, before, by someone else, that making all unused pins into outputs saves power, but I never tried what you said. Ill try it and see for myself. I'm just about getting to the point now, where I can use Picaxe for actual useful purposes...it's getting even more fun now :)
 

212

Senior Member
Well gee wiz... I see no difference on my good $4 meter. I had used pin 1 doing double duties on another project, and had needed it to be an output farther down the line. I have enough pins on this toy to leave it an input though. I don't know how long I would kept changing it back and forth without you mentioning it...thanks again...teach :)
 

Ralpht

New Member
Don't know about pins set as outpus saving power. I'd say that is an "old wives tale" but would probabaly depend on the internal design of the chip itself.

Under normal conditions it is far safer to have any unused bi-directional pin set as an input.
 
Last edited:

212

Senior Member
I added to what I found on here about slow, speed by measuring the current used. Sleep and nap are way less than this, and I did not see any change with the different speed when using them. I used an 08M with 3 AA's, and input tied low.

low 0
low 1
low 2
low 4

disablebod

pause 3000




'poke $8F,%00000000 '= 31 kHz ~19bps (UNDERCLOCKED)....22ua

'pause 300

'poke $8F,%00010000 '= 125 kHz 75bps (UNDERCLOCKED)....181ua

'pause 3000

'poke $8F,%00100000 '= 250 kHz 150bps (UNDERCLOCKED)....194ua

'pause 3000

'poke $8F,%00110000 '= 500 kHz 300bps (UNDERCLOCKED)....218ua

'pause 3000

'poke $8F,%01000000 '= 1 MHz 600bps (UNDERCLOCKED)....266ua

'pause 3000

'poke $8F,%01010000 '= 2 MHz 1200bps (UNDERCLOCKED)....362ua

'pause 30000

'poke $8F,%01100000 '= 4 MHz 2400bps (NORMAL)..........554ua

'pause 30000

'poke $8F,%01110000 '= 8 MHz 4800bps (OVERCLOCKED)......967ua

'pause 30000

'loop
 
Top