Wait mode for HC12

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wait mode for HC12

3,223 Views
mdk
Contributor I
Hi
I would like to put the controller in wait mode. In order to consume less power, when normal supply is off and the controller is energised by akku.

-I will use XIRQ or IRQ to observe the normal supply.
-During Wait Mode I need the RTI (to run implemented watch)

It would be nice if any one can provide source code for wait mode.

Best regards
mdk
Labels (1)
0 Kudos
4 Replies

530 Views
Ilocano
Contributor I
This is how to do it with stop mode

tfr CCR,a
anda #%01111111 ;clear S-bit
tfr a,CCR
stop

probably the same for wait mode
0 Kudos

530 Views
imajeff
Contributor III
But there's no need for all the transfers:
 andcc #%01111111  ;clear S-bit
 stop

Disclaimer: I am not experienced with Stop / Wait while using interrupts. You would also consider any docs that explain limitations of certain hardware recovering from the low power states.
0 Kudos

530 Views
rhinoceroshead
Contributor I

To get into wait mode, you just use the assembly instruction:

WAI

or in C, you would do this:

asm WAI;

It's intended to be used with interrupts because the instruction stacks all of the registers for you.  It reduces the interrupt latency since when the interrupt arrives, the CPU has already stacked everything and it can go directly to the ISR.  The CPU clock stops so wait mode also saves some power.  Any interrupt that is configured and unmasked will automatically start the CPU going again and the RTI instruction at the end of the ISR will re-balance the stack.

0 Kudos

530 Views
Steve
NXP Employee
NXP Employee
For S12 if all you need is RTI and IRQ/XIRQ wakeup then you may be able to use Pseudo-STOP mode which is much less power than Wait mode.
 
General note on HC11/HC12/S12/S12X/S12XE XIRQ: The XIRQ pin will always wake the MCU from STOP (or Pseudo-STOP) when it is asserted even if the X bit is in the disabled state. Take care to review the documentation and ensure that the XIRQ is correctly configured in hardware if STOP mode is in use.
0 Kudos