Lowest Power for 40X2 - Hibernate?

Oliverar

Member
Hi,
I am working on a 40X2 project where I am trying to use the least possible power. I have found the hibernate command which seems ideal for what I want, as it uses very little power when it isn't running and is only awoken when an external stimulus is applied. However, it doesn't seem that this is possible with the 40X2 ? If this is the case, could you advise if there is a similar or equivalent command for the X2, or at least which is the lowest power mode the X2 will support.

Many Thanks.
 

hippy

Technical Support
Staff member
For the X2 parts, "SLEEP 0" is probably the lowest power option. That will put the PICAXE into permanent sleep, only woken by a hardware interrupt (e.g. hint pin change) or hard-reset.
 

bryanl

Member
here's something that seems to work on a 28x2
Code:
	hintsetup %00000001		; interrupt 0 (on port label B.0) on falling edge

doit_loop:
	setintflags %00000001,%00000001	; interrupt on B.0
	Disablebod	; disable brownout detect to save power
	Sleep 0		; wait for hardware interrupt
	Enablebod

	; gosub do whatever you need to do between interrupts

Goto doit_loop
END

; interrupt handling
; just pull it out of sleep and let main routine do all processing

Interrupt:
   ; if need be check flags to see what caused the interrupt
   ; and set user registers so doit_loop knows what is going on
Return
I haven't yet made comparisons on current consumption between this, polling, and polling with short sleep on a clock exercise (I have to use an ammeter that gets down to the milliamp range)

Exactly what PICAXE is doing with interrupts is not clear to me. The actual hardware side of things is behind (underneath?) the user code so response, trigger flags, and interrupt control are not like you'd do in talking directly to the mcu.
 
Top