I am new in embedded how can i use i2c, uart, spi and understand.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi Manoj,
I think there is no other way except study the user guide and here especially the eUSCI chapters for serial communication.

If you absolutely new to MSP430 micro controllers the following slide set can also help:
i have studied both document and i see the example of uart in examples code.
but how to understand which data is transmission and receive.
data written to UCAxTXBUF (transmit buffer) will be transmitted once written
data which are read can be found in the UCAxRXBUF once the receive interrupt flag UCRXIFG inside the UCAxIFG register is set
You can find code examples in product folder on the web:
Here is the example code for UART echo with 9600 baud using the ACLK. It simply sends back what it received. So if you use a hyperterminal program on your PC and connect it to the RS232 or a USB UART bridge you can communicate already with you hyperterminal.
// MSP430F552x Demo - USCI_A0, Ultra-Low Pwr UART 9600 Echo ISR, 32kHz ACLK
//
// Description: Echo a received character, RX ISR used. Normal mode is LPM3,
// USCI_A0 RX interrupt triggers TX Echo.
// ACLK = 32768Hz crystal, MCLK = SMCLK = DCO ~1.045MHz
// Baud rate divider with 32768Hz XTAL @9600 = 32768Hz/9600 = 3.41
// See User Guide for baud rate divider table
//
// MSP430F552x
// -----------------
// /|\ | XIN|-
// | | | 32kHz
// ---|RST XOUT|-
// | |
// | P3.3/UCA0TXD|------------>
// | | 9600 - 8N1
// | P3.4/UCA0RXD|<------------
//
// Bhargavi Nisarga
// Texas Instruments Inc.
// April 2009
// Built with CCSv4 and IAR Embedded Workbench Version: 4.21
//******************************************************************************
#include <msp430.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P3SEL = BIT3+BIT4; // P3.4,5 = USCI_A0 TXD/RXD
//.......................
// P5SEL |= BIT4+BIT5; // Select XT1
//
// UCSCTL6 &= ~(XT1OFF); // XT1 On
// UCSCTL6 |= XCAP_3; // Internal load cap
// UCSCTL3 = 0; // FLL Reference Clock = XT1
//
// // Loop until XT1,XT2 & DCO stabilizes - In this case loop until XT1 and DCo settle
// do
// {
// UCSCTL7 &= ~(XT2OFFG + XT1LFOFFG + DCOFFG);
// // Clear XT2,XT1,DCO fault flags
// SFRIFG1 &= ~OFIFG; // Clear fault flags
// }while (SFRIFG1&OFIFG); // Test oscillator fault flag
//
// UCSCTL6 &= ~(XT1DRIVE_3); // Xtal is now stable, reduce drive strength
//
// UCSCTL4 |= SELA_0 + SELS_4 + SELM_4; // ACLK = LFTX1
// // SMCLK = default DCO
// // MCLK = default DCO
//
//................
UCA0CTL1 |= UCSWRST; // **Put state machine in reset**
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32kHz/9600=3.41 (see User's Guide)
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRS_3+UCBRF_0; // Modulation UCBRSx=3, UCBRFx=0
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
UCA0IE |= UCRXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, interrupts enabled
__no_operation(); // For debugger
}
// Echo back RXed character, confirm TX buffer is ready first
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
switch(__even_in_range(UCA0IV,4))
{
case 0:break; // Vector 0 - no interrupt
case 2: // Vector 2 - RXIFG
while (!(UCA0IFG&UCTXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
break;
case 4:break; // Vector 4 - TXIFG
default: break;
}
}
**Attention** This is a public forum