Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430



Ads

Discussion Groups

Discussion Groups | MSP430 | Re: Re: Low power modes

The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.

Re: Re: Low power modes - Paddu Koti - Jul 3 19:05:48 2008

Thankyou for the reply,
should I clear the flag (P1IFG ) inside the if loop or else in the main()..

----- Original Message ----
From: bb_stefan
To: m...@yahoogroups.com
Sent: Thursday, July 3, 2008 11:00:02 PM
Subject: [msp430] Re: Low power modes
You will always end up in LPM3, because inside your ISR you first
reset P1IFG to zero and after that you check if the corresponding bit
in P1IFG is zero! So the first condition for S1 one is always true!

--- In msp430@yahoogroups. com, "paddu.koti" wrote:
>
> Hi,
>
> I need to check the power consumption of MSP430F413 in low power
> modes LPM3 and LPM4,I have written a code in which the MSP430 goes
> to LPM3,4 if the switches s1,s2 are pressed.
> The LED glows properly if I press switch but the power consumption
> at both modes are same(0.6uA).
> If anybody has an idea about how to correct the below prog please
> help me...
>
> //Program to check the low power modes LPM3,LPM4 MSP430F413
> #include
> void main()
> {
>
> WDTCTL = WDTPW +WDTHOLD; // Stop WDT
> //reset all the port
>
> P1DIR=0x01; // Set P1.0 to output direction
>
> //pushbutton S1
> P1DIR &= ~0x08; //P1.3 Input for interrupt
> P1IES |= 0x08; //P1.3 interrupt edge high to low
> P1IE |= 0x08; //Enable P1.3 interrupts
> //pushbutton S2
> P1DIR &= ~0x10; //P1.4 Input for interrupt
> P1IES |= 0x10; //P1.4 interrupt edge high to low
> P1IE |= 0x10; //Enable P1.4 interrupts
>
> _EINT(); // Enable interrupts
> while(1);
> }
>
> //interrupt handler
> #pragma vector=PORT1_ VECTOR
> __interrupt void PORT1 (void)
> {
>
> P1IFG &= ~0x08; //Clear interrupt flag
> P1IFG &= ~0x10; //Clear interrupt flag
>
> // PORT PIN 1.3 PUSH BUTTON S1
> if((P1IFG & 0x08)==0)
> {
> P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
> _BIS_SR(LPM3_ bits+ GIE); // Enter LPM3 w/ interrupts
> }
> // PORT PIN 1.4 PUSH BUTTON S2
> if((P1IFG & 0x10)==0)
> {
> P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
> _BIS_SR(LPM4_ bits+ GIE); // Enter LPM3 w/ interrupts
>
> }
>
> }
>

[Non-text portions of this message have been removed]
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )


Re: Low power modes - bb_stefan - Jul 4 18:59:36 2008

You should clear IFG's at the end of your interrupt handler!

BTW: As OCY said before, you might probably run into some other
trouble, because you do not debounce S1 and S2.
But it may work for you, since you only want to measure supply current
in LPM3/4.
--- In m...@yahoogroups.com, Paddu Koti wrote:
>
> Thankyou for the reply,
> should I clear the flag (P1IFG ) inside the if loop or else in the
main()..
>
> ----- Original Message ----
> From: bb_stefan
> To: m...@yahoogroups.com
> Sent: Thursday, July 3, 2008 11:00:02 PM
> Subject: [msp430] Re: Low power modes
> You will always end up in LPM3, because inside your ISR you first
> reset P1IFG to zero and after that you check if the corresponding bit
> in P1IFG is zero! So the first condition for S1 one is always true!
>
> --- In msp430@yahoogroups. com, "paddu.koti" wrote:
> >
> > Hi,
> >
> > I need to check the power consumption of MSP430F413 in low power
> > modes LPM3 and LPM4,I have written a code in which the MSP430 goes
> > to LPM3,4 if the switches s1,s2 are pressed.
> > The LED glows properly if I press switch but the power consumption
> > at both modes are same(0.6uA).
> > If anybody has an idea about how to correct the below prog please
> > help me...
> >
> > //Program to check the low power modes LPM3,LPM4 MSP430F413
> >
> >
> > #include
> > void main()
> > {
> >
> > WDTCTL = WDTPW +WDTHOLD; // Stop WDT
> > //reset all the port
> >
> > P1DIR=0x01; // Set P1.0 to output direction
> >
> > //pushbutton S1
> > P1DIR &= ~0x08; //P1.3 Input for interrupt
> > P1IES |= 0x08; //P1.3 interrupt edge high to low
> > P1IE |= 0x08; //Enable P1.3 interrupts
> >
> >
> > //pushbutton S2
> > P1DIR &= ~0x10; //P1.4 Input for interrupt
> > P1IES |= 0x10; //P1.4 interrupt edge high to low
> > P1IE |= 0x10; //Enable P1.4 interrupts
> >
> > _EINT(); // Enable interrupts
> > while(1);
> > }
> >
> > //interrupt handler
> > #pragma vector=PORT1_ VECTOR
> > __interrupt void PORT1 (void)
> > {
> >
> > P1IFG &= ~0x08; //Clear interrupt flag
> > P1IFG &= ~0x10; //Clear interrupt flag
> >
> > // PORT PIN 1.3 PUSH BUTTON S1
> > if((P1IFG & 0x08)==0)
> > {
> > P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
> > _BIS_SR(LPM3_ bits+ GIE); // Enter LPM3 w/ interrupts
> > }
> >
> >
> > // PORT PIN 1.4 PUSH BUTTON S2
> > if((P1IFG & 0x10)==0)
> > {
> > P1OUT ^= 0x01; // Toggle P1.0 using exclusive-OR
> > _BIS_SR(LPM4_ bits+ GIE); // Enter LPM3 w/ interrupts
> >
> > }
> >
> > }
> >
>
>
> [Non-text portions of this message have been removed]
>

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )