Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Problem with _BIC_SR(LPM3_EXIT);

$
0
0

Hi!

I am new to the MSP430. I asked a question month before and you told me there where a lot of errors in the code. I could not find it, because CCS dont tell it to me. But i wanted to make it good, so i used the command line tool on the Raspberry pi to program for the MSP430 and then a lot of errors where shown.

So i wrote the whole new code again step by step modified to be error free. Our project (an alarm clock) works now but it got some issues. But that is not the reason for my question. I want to modify the Interrupt handling and there is a thing i do not understand.

I use _BIC_SR(LPM3_EXIT); to leave the LPM3 in the interrupt and compile with CCS = no error and working blinking LED.

I use the command line on the Pi = error, invalid use of void expression.

The error is caused by the _BIC_SR(LPM3_EXIT); i think, because the error does not occur if i comment it out. What means the button cant wake up the MSP from sleep.


What can i do?


Enclosed the code. I use the clock crystal that came with the Lauchpad. The Button i use is an external, because Button2 on the Launchpad does not work here.

#include <msp430g2553.h>
int i;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 |= DIVA_3; // ACLK/8
BCSCTL3 |= XCAP_3; //12.5pF cap- setting for 32768Hz crystal
P1DIR |= (BIT0 + BIT6);
P1OUT &= ~(BIT0 + BIT6);
P1IE |= BIT4;
P1IFG &= ~BIT4;
P1OUT |= ~BIT4;
P1IES |= BIT4;
P1REN |= BIT4;
CCTL0 = CCIE; // CCR0 interrupt enabled
CCR0 = 512; // wenn man den Wert auf 512 setzt taktet er jede 1 sec, bei 30720 jede 1 min, bei 1-> 256 mal pro sekunde
TACTL = TASSEL_1 + ID_3 + MC_1; // ACLK, /8, upmode
__enable_interrupt();
_BIS_SR(LPM3_bits + GIE);

for(;;)
{
//P1OUT^=BIT6;
for( i = 0; i < 1000; i++){
__delay_cycles(100000);
P1OUT^= BIT0;
}
P1OUT &= ~BIT0;
_BIS_SR(LPM3_bits + GIE);
}
}
// Timer A0 interrupt service routine
#pragma vector=TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
P1OUT^= BIT6;
}
#pragma vector=PORT1_VECTOR
__interrupt void Port_1(void)
{
P1IFG &= ~BIT4;
P1IES ^= BIT4;
_BIC_SR(LPM3_EXIT);
}



Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>