Tool/software: Code Composer Studio
Hello guys this is my code,How to receive the data plz help me guys
#include <msp430.h>
const char string[] = { "Hello\r\n" };
unsigned int i,j; //Counter
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop the Watch dog
//------------------- Configure the Clocks -------------------//
/* if (CALBC1_1MHZ==0xFF) // If calibration constant erased
{
while(1); // do not load, trap CPU!!
}
CSCTL0 = 0x0201; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ; // Set DCO step + modulation*/
//---------------- Configuring the LED's ----------------------//
//P1DIR |= BIT0; // P1.0 and P1.6 output
P1DIR |= BIT1;
//P1OUT = BIT0; // P1.0 and P1.6 = 0
P1IN = BIT1;
//--------- Setting the UART function for P1.1 & P1.2 --------//
P1SEL0 |= BIT1; // P1.1 UCA0RXD input
P1SEL0 |= BIT0; // P1.2 UCA0TXD output
//------------ Configuring the UART(USCI_A0) ----------------//
UCA0CTL1 |= UCSSEL_2 + UCSWRST; // USCI Clock = SMCLK,USCI_A0 disabled
UCA0BR0 = 104; // 104 From datasheet table-
UCA0BR1 = 0; // -selects baudrate =9600,clk = SMCLK
UCA0MCTLW = UCBRS0; // Modulation value = 1 from datasheet
UCA0STATW |= UCLISTEN; // loop back mode enabled
UCA0CTL1 &= ~UCSWRST; // Clear UCSWRST to enable USCI_A0
//---------------- Enabling the interrupts ------------------//
//UCA0IE |= UCTXIE; // Enable the Transmit interrupt
//UCA0IE |= UCRXIE; // Enable the Receive interrupt
//__bis_SR_register( GIE ); // Enable the global interrupt
/*for(i=0;i<sizeof(string);i++)
{
UCA0TXBUF = string[i]; // Transmit a byte
//UCA0IE &= ~UCTXIE;
}*/
if(UCA0RXBUF == 'A')
{
j=5;
UCA0RXBUF; // Transmit a byte
UCA0IE &= ~UCRXIE;
}
__bis_SR_register(LPM0_bits + GIE); // Going to LPM0
}
//-----------------------------------------------------------------------//
// Transmit and Receive interrupts //
//-----------------------------------------------------------------------//
#pragma vector = USCIAB0TX_VECTOR
__interrupt void TransmitInterrupt(void)
{
P1OUT ^= BIT0;//light up P1.0 Led on Tx
}
#pragma vector = USCIAB0RX_VECTOR
__interrupt void ReceiveInterrupt(void)
{
P1OUT ^= BIT6; // light up P1.6 LED on RX
//IFG2 &= ~UCA0RXIFG; // Clear RX flag
}