Pause = low power?

boriz

Senior Member
Can I save power by using PAUSE + interrupt_on_pin instead of DO:check_pin:LOOP on my 14M?

I’m currently using:
Code:
do:loop until pin3=0
It might remain in this loop for a few seconds or a few weeks.

Would I be saving a significant amount of power if I use this instead:
Code:
do:pause 65000:loop
With an interrupt on pin 3 going low?
 

Jeremy Leach

Senior Member
I can't see there would be any difference, because I'd imagine there is still low level code running for either option. I'd guess a pause is just a low level loop going on.
 

Technical

Technical Support
Staff member
No difference.
You could use small naps to make a difference:

do
nap 1
loop until pin3 = 0

The larger the nap value the better the power consumption, but also the slower the switch response.
 

Jeremy Leach

Senior Member
If it's a button push, and you don't need immediate code response, then perhaps could use a capacitor to 'latch' the switch state for a while after you release the button - in this way you might be able to use higher nap values. Just a thought.
 

dceejay

New Member
If you really want to save power look at disable brown out detection - disablebod - but of course you have wake up fast enough to detect whatever input you want - as interrupts will also be asleep.
 

boriz

Senior Member
Thanks.

I'm using this to detect the start of an IR remote signal, so Nap/Sleep is out of the question. Also slowing the AXE down is no good coz of the speed of the IR pulses.

Any other possibilities for extending battery life?
 

hippy

Technical Support
Staff member
You can drop to slow speed then increase it when you see the IR pulse. You may also be able to alter the IR being generated to suit whatever you need to do, but there are not many options when having to receive an IR stream which you cannot influence.

Some IR transmitters send their codes more than once so you may be able to tolerate a significant wake-up delay and catch a later repeat of the original message.

If bit-banging IR Receive you may be able to reconstruct codes even if you are late in responding to them and have lost the start of the code sent.
 

Jeremy Leach

Senior Member
If there is any preamble of IR, then could you perhaps feed the IR signal into a simple diode>Cap>Mosfet switch that controls the picaxe power??
 

boriz

Senior Member
@Jeremy
I rejected that idea because of the boot delay. I have never measured it though.

@Hippy
It’s the TV remote – room lights thingy from the other thread. Just doing a little optimising to the code while TechSupplies get around to making a Paypal account so I can buy some 08M’s.

I don’t have a storage scope, but on my CRO it looks like it’s sent once then it sends a couple of short, continuously repeating pulses, for as long as the button is held down.

Dropping to low speed for the pauses sounds promising. Any idea how much power I could save that way?

Would locking the AXE with a SERIN command use less power than PAUSE? (I’m assuming that you can interrupt out of a waiting SERIN)
 

hippy

Technical Support
Staff member
No SERIN won't help, nor can you interrupt out of it.

You could hack your remote to include an 08M or build a special purpose remote. Then you can send a preamble pulse to wake up your receiver then send the code repeatedly.

A "NAP 0" will go into low power mode for around 18ms so if waking and checking for IR takes 2ms that's 20ms in total, so it's in low-power mode for 90% of the time. If you can go to "NAP 1" you take that to 95%, "NAP 2" to 97%.

A "NAP 0" will nominally extend battery life by a factor of about 20.

I'm not sure on how that would compare to dropping to low speed. You could do both low speed and NAP whcih would be the best of both worlds.

An alternative is to re-think the problem. Taking the idea of having the IR power-up the PICAXE is a possibility. My non-PICAXE IR controlled lights have a simple one button remote and length of time pushed ( how long the micro is awake for ) determines what the micro does, toggle lights on-off or dim up or down. If you can get the PICAXE powered up it can keep itself powered up while IR is present and update Eeprom so it knows what it did last time.

It's a shame the Ultra-Low Power Wake-Up of the 12F683 is the 08M's Output 0 as that would otherwise be an ideal solution here. Set a long NAP and rather than use a capacitor, the IR could be used to trigger wake-up.
 

tiscando

Senior Member
I am experimenting on an IR protocol which is very reliable and can interrupt and wait for the reciever picaxe to respond, although slow in fuzzy conditions, and requires both ends to have a transmitter and a reciever, so it's bi-directional. also, it takes up at least 150 program bytes (about 50 lines), so it's not for the obsolete 08, 18, and 28 parts at all, but great for x and x1 parts.

If this is what you would really like, then you would have a choice:
!. master-slave: much like the I2C protocol, but data is sent via infrared both ways, rather than wired sda and scl lines. advantages: very flexible. however, unreliable at sequential writes as a datum could be written twice when not needed to.
". conversational: just like serin and serout, but through IR, and in 'morse dot and dash' code where a dot represents a 0, and a dash is a 1, so that makes it more reliable. In addition, the byte is sent twice, and the reciever would send an 'ack' when the two bytes match. but, to make it faster, rather than sending the byte twice, an even parity bit and an odd parity bit could be sent after the byte, or possibly an even one before and after the byte.

after anyone has shown me what of the above they want, and using picaxe vsm, I'll create and send the code for your need first.
 

manuka

Senior Member
Tiscando: Bravo- I've occasionally pondered pushing the 08M inbuilt IR TX/RX into other coms. fields, so PLEASE tell us more! Stan
 

tiscando

Senior Member
I should post my IR morse-pulse protocol codes into a new thread in the forum 'code snippets', otherwise not many guests and members are going to find it! Are you sure both the picaxes that are going to communicate in IR have both a transmitter (an infrared diode) and an IR reciever?
 
Top