This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

consumes msp430g2553

Other Parts Discussed in Thread: MSP430G2553

Hello, how could reduce consumption msp430g2553? I use the following code:

// Timer example with Low Power Mode
#include <msp430.h>
#define ONE_SECOND 511

void main(void) {
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
P1DIR |= BIT0; // Set P1.0 to output direction

P1OUT |= BIT3;
P1REN |= BIT3;

P1IE |= BIT3; // P1.3 interrupt enabled
P1IES |= BIT3; // P1.3 Hi/lo edge
P1IFG &= BIT3; // P1.3 IFG cleared

P2DIR ^= P2DIR;
P2OUT ^= P2OUT;
P2REN ^= P2REN;

// Set up 32768Hz external crystal
BCSCTL1 |= DIVA_3; // divide by 8
BCSCTL3 |= XCAP_3; // select 12pF caps

// initialize Timer0_A
TA0CCR0 = 5 * ONE_SECOND; // set up terminal count for 10s
TA0CTL = TASSEL_1 + ID_3 + MC_1; // configure and start timer

// enable interrupts
TA0CCTL0 |= 0x0010; // set CCIE bit

__bis_SR_register(LPM3_bits + GIE); // set GIE anf LPM3 low power mode in SR

// while (1){};
}

#pragma vector = TIMER0_A0_VECTOR
__interrupt void myTimerISR(void) {
TA0CCR0 = 5*ONE_SECOND;
P1OUT ^= BIT0;
__delay_cycles(100000); // flash LED1
P1OUT ^= 0x01;
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void) { //INTERRUPCION CAMBIO SELECTOR
P1OUT ^= BIT0; // P1.0 = toggle
P1IFG &= ~BIT3; // P1.3 IFG cleared
}

With this code consumes approximately 110uA.

  • Hi David!

    You could, for example, lower the CPU clock or use another source, disabling the DCO completely.

    #pragma vector = TIMER0_A0_VECTOR
    __interrupt void myTimerISR(void) {
      TA0CCR0 = 5*ONE_SECOND;
      P1OUT ^= BIT0;
      __delay_cycles(100000); // flash LED1
      P1OUT ^= 0x01;
    }

    The __delay_cycles function keeps the processor alive only to have the LED on for some time. Use a timer for that. Set the LED on, start a timer and CPU into sleep. In the timer ISR, disable the LED and back to sleep.

    Dennis

**Attention** This is a public forum