Tool/software: Code Composer Studio
how to resend the received data from the serial port to UART in MSP430G2553
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.
Tool/software: Code Composer Studio
how to resend the received data from the serial port to UART in MSP430G2553
Hi Surya,
You can refer to our example code:
http://dev.ti.com/tirex/explore/node?node=AG6YJ478XsF4hb1dH6Y4nA__IOGqZri__LATEST
Best Regards
Johnson
Sir,
Thank you for your reply
This is my code to receive the transmitted data from terminal to MSP430G2553 without interrupt and using URXIFG0 flag.But not setting the mentioned flag and not getting the expected output. I am trying to do without using interrupt.
#include "msp430g2553.h"
#define TXLED BIT0
#define RXLED BIT6
#define TXD BIT2
#define RXD BIT1
unsigned int URXIFG0;
unsigned int i;
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
DCOCTL = 0; // Select lowest DCOx and MODx settings
BCSCTL1 = CALBC1_1MHZ; // Set DCO
DCOCTL = CALDCO_1MHZ;
P1DIR = BIT0;
P1OUT = BIT0+BIT6;
P2DIR |= 0xFF; // All P2.x outputs
P2OUT &= 0x00; // All P2.x reset
P1SEL |= RXD + TXD ; // P1.1 = RXD, P1.2=TXD
P1SEL2 |= RXD + TXD ; // P1.1 = RXD, P1.2=TXD
P1DIR |= RXLED + TXLED;
P1OUT &= 0x00;
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0x08; // 1MHz 115200
UCA0BR1 = 0x00; // 1MHz 115200
UCA0MCTL = UCBRS2 + UCBRS0; // Modulation UCBRSx = 5
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
while(1)
{
if(URXIFG0==1)
{
UCA0TXBUF = UCA0RXBUF;
}
P1OUT^=BIT0;
}
}
Hi Surya,
You should use those code in while(1) :
if(IFG2&UCA0RXIFG) { UCA0TXBUF = UCA0RXBUF; }
Best Regards
Johnson
**Attention** This is a public forum