Hello everyone,
I have tried a program of UART reception in msp430f5529 launchpad but I have not got any output.I have attached the program below. Do I have to change anything?
#include<msp430.h>
void main(void)
{
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
//WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR |= (BIT0 ); //Set P1.0 and P1.6 to outputs
P1OUT&=~(BIT0);
P3SEL = BIT3+BIT4; // P3.4,5 = USCI_A0 TXD/RXD
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 6; // 1MHz 9600 (see User's Guide)
UCA0BR1 = 0; // 1MHz 9600
UCA0MCTL = UCBRS_0 + UCBRF_13 + UCOS16; // Modln UCBRSx=0, UCBRFx=0,
// over sampling
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
// P1OUT |= BIT0;
UCA0IE |= UCRXIE; //Enable RX interrupt
__bis_SR_register(CPUOFF + GIE); //Enter LPM0 with interrupts
}
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
if(UCA0RXBUF == 65) //Toggle red LED if "A" RXed
{
P1OUT ^= BIT0;
}
if(UCA0RXBUF == 66) //Toggle green LED if "B" RXed
{
P1OUT ^= BIT6;
}
}