Hi all,
Below is the simple code. Basically, I am waiting for a button to be pressed. I am still getting 16uA while in deep sleep.
How can I achive sub-micro amp power consumption when in deep sleep mode? Will LPM4_bits work on external interrupt?
Any other ideas to reduce power when MSP430 is not doing anything?
Thank you all.
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
P1DIR = 0xFF;
P1OUT = 0x00;
P2DIR = 0xFF;
P2OUT = 0x00;
// Configure GPIO
P1OUT &= ~BIT0; // Clear P1.0 output latch for a defined power-on state
P1DIR |= BIT0; // Set P1.0 to output direction
P1OUT |= BIT3; // Configure P1.3 as pulled-up
P1REN |= BIT3; // P1.3 pull-up register enable
P1IES |= BIT3; // P1.3 Hi/Low edge
P1IE |= BIT3; // P1.3 interrupt enabled
// Disable the GPIO power-on default high-impedance mode
// to activate previously configured port settings
PM5CTL0 &= ~LOCKLPM5;
P1IFG &= ~BIT3; // P1.3 IFG cleared
while(1)
{
__bis_SR_register(LPM3_bits | GIE); // Enter LPM3 w/interrupt
//__delay_cycles(10000); // Delay for 100000*(1/MCLK)=0.1s
//P1OUT |= BIT0; // P1.0 = toggle
//__delay_cycles(100000); // Delay for 100000*(1/MCLK)=0.1s
//P1OUT &= ~BIT0;
}
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1IFG &= ~BIT3; // Clear P1.3 IFG
__bic_SR_register_on_exit(LPM3_bits); // Exit LPM3
}