Tool/software: Code Composer Studio
Hello,
Here is my code, after interrupt the next process in main program is not running..in my code
the highlighted part is not running plz resolve this issue...
#include <msp430.h>
#include "lcd.h"
void tx_string(char *s);
int e,flag;
char Q[15];
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop Watchdog
lcdini();
DCOCTL = 0; // Select lowest DCO settings
BCSCTL1 = CALBC1_1MHZ; // Set DCO to 1 MHz
DCOCTL = CALDCO_1MHZ;
P1SEL = BIT1 + BIT2 ; // Select UART RX/TX function on P1.1,P1.2
P1SEL2 = BIT1 + BIT2;
UCA0CTL1 |= UCSSEL_2; // UART Clock -> SMCLK
UCA0BR0 = 104; // Baud Rate Setting for 1MHz 9600
UCA0BR1 = 0; // Baud Rate Setting for 1MHz 9600
UCA0MCTL = UCBRS_1; // Modulation Setting for 1MHz 9600
UCA0CTL1 &= ~UCSWRST; // Initialize UART Module
while(1)
{
IE2 |= UCA0RXIE; // Enable RX interrupt
__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, Enable Interrupt
tx_string("before if");
if(flag==1)
{
tx_string("inside while");
flag=0;
}
}
}
#pragma vector=USCIAB0RX_VECTOR // UART RX Interrupt Vector
__interrupt void USCI0RX_ISR(void)
{
if(flag==0)
{
flag=1;
while(e<9)
{
while (!(IFG2 & UCA0RXIFG));
Q[e] = UCA0RXBUF;
Q[e+1]='\0';
e++;
}
e=0;
}
}
void tx_string(char *s)
{
while(*s != '\0')
{
while (!(IFG2 & UCA0TXIFG));
UCA0TXBUF = *s;
s++;
}
}