08M2 hibernate?

netpilot

New Member
Hi, I am trying to place a battery powered 08M2 project into a 'sleep' mode after a certain period of inactivity (say 15 seconds).
The system will eventually use an air pressure sensor but I am currently using a push button in place of the sensor.
I would like to use the sensor to trigger the system initially, for the system to detect if the sensor has been inactive, then bring it out of sleep mode if triggered again.
I have looked through the forum and read the PicAxe help files, and I believe that hibernate is the best option.
Unfortunately, I do not understand how to initially trigger the system on, then how to 'hibernate' the system, and finally how to bring it out of it's sleep mode.
I hope this makes sense?
Thanks for any help.
 

PhilHornby

Senior Member
The "M2" range doesn't have a 'hibernate' function, but it does have 'sleep' and 'nap' which are close. Although not completely hibernated, I would assume that it will still miss any (polled) interrupts that are defined so hardware events won't wake it up (or be delivered later, when it does wake). I've never actually tried it, so an experiment is in order...

I think you can use the IOCAN/IOCAP/IOCAF SFRs to implement something close to what you want though. The responsiveness required, will define the maximum length of the sleep you can have.
Have a look at posts #4 and #5 in this thread: http://www.picaxeforum.co.uk/showthread.php?19534-sr-latch-usage&highlight=IOCAP to see how the Interrupt-on-change flags can be used to record any hardware events that have happened while the Picaxe was sleeping.

Read in conjunction with the Microchip datasheet for the 12F1840 (available here: http://ww1.microchip.com/downloads/en/DeviceDoc/40001441F.pdf )

Alternatively, have a look at processors from the "X2" range, which have more functionality in this area.
 

netpilot

New Member
Thanks PhilHornby,
I am trying to keep the package/pin count as small as possible-hence the 08M2 rather than X2 which start at 14 pins.
Looks like I need to re-think how to do this.
The Microchip 12F1840 appears to have increased functionality, most of which my application has no need of.
The 08M2 is currently fitted in an AXE021 prototyping board which is ideal, but there doesn't seem to be an equivalent for the Microchip device.
Would you recommend this alternative device?
I am a complete novice, so any help/advice would be great.
 

PhilHornby

Senior Member
The Microchip 12F1840 when programmed with Rev. Ed. firmware is called the Picaxe 08M2; they're the one and the same. :) The link to the datasheet was so you could see the technical details behind the 'Interrupt-on-change' stuff.

You might not need it though...

If you've got a Picaxe that's been 'asleep' for a second or two, the interrupt-on-change system is great for capturing a momentary event, such as a push switch being pressed during that sleep - that's what I've used it for. But a signal from an Air Pressure sensor might well persist until its responded to in some way (I'm imagining it being used to sense water level for example, as in washing machines).

It might just be a case of 'sleep'; check if signal is present; if YES, then do something; else loop (go back to 'sleep').
 
Top