Part Number:MSP430F5528
Hi,
I am facing a problem with the interrupt handler. After servicing to the interrupt it not coming back to the main program continuously it is running the same isr.
#include <msp430.h> *********************************** //lcd initialization // // // //functions declaration for lcd *********************************** char data; int main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT lcd_init(); P4SEL = BIT4+BIT5; // P3.4,5 = USCI_A0 TXD/RXD UCA1CTL1 |= UCSWRST; // **Put state machine in reset** UCA1CTL1 |= UCSSEL_2; // SMCLK UCA1BR0 = 6; // 1MHz 9600 (see User's Guide) UCA1BR1 = 0; // 1MHz 9600 UCA1MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0, // over sampling UCA1CTL1 &= ~UCSWRST; // **Initialize USCI state machine** UCA1IE |= UCRXIE; // Enable USCI_A0 RX interrupt __bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled send_string(data); } // Echo back RXed character, confirm TX buffer is ready first #if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__) #pragma vector=USCI_A1_VECTOR __interrupt void USCI_A1_ISR(void) #elif defined(__GNUC__) void __attribute__ ((interrupt(USCI_A1_VECTOR))) USCI_A1_ISR (void) #else #error Compiler not supported! #endif { switch(__even_in_range(UCA1IV,4)) { case 0:break; // Vector 0 - no interrupt case 2: data = UCA1RXBUF; // Vector 2 - RXIFG while (!(UCA1IFG&UCTXIFG)); // USCI_A0 TX buffer ready? UCA1TXBUF = 52; // TX -> RXed character break; case 4:break; // Vector 4 - TXIFG default: break; } __bic_SR_register(LPM0_bits); }
In the above program I just want to display the received data on an LCD, but it is not executing that instruction,