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.

MSP430g2553 UART connection for LCD serial backpack

Other Parts Discussed in Thread: MSP430G2553

Hi! I need urgent help with a code i'm working on, to send info via UART connection to a serial module attached to a 16x2 LCD. The thing is that i've made a very simple code but i'm new in microcontrollers programming; i'm using the launchpad and i'v read a lot about this but the LCD screen doesn't respond.

I think my problem is on the serial communication implementation; i'm not really good at this microcontroller stuff yet

My code:

#include <msp430g2553.h>


volatile unsigned char TXByte; // Value sent over UART when Transmit() is called
void Transmit(void);

int main(void) {
WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
BCSCTL1 = CALBC1_1MHZ; // Set range
DCOCTL = CALDCO_1MHZ; // SMCLK = DCO = 1MHz

P1DIR |= BIT2; // P1.2 Output
P1SEL |= BIT2; // P1.2 Options select

UCA0CTL0 |= UCMODE_0;
UCA0CTL1 |= UCSSEL_2;
UCA0BR0 = 104;
UCA0BR1 = 0;
UCA0MCTL = UCBRS_0;

//UCSYNC = 0; // Asíncrono
//UCMODEx = 00; // Modo UART

TXByte = 0x0C;
Transmit();

return 0;
}


//Transmits the value currently in TXByte. The function waits till it is finished transmitting before it returns.

void Transmit()
{
//while (!(IFG2 & UCA0TXIFG));
TXByte |= 0x100; // Add stop bit to TXByte
TXByte = TXByte << 1; // Add Start bit to TXByte
UCA0TXBUF = TXByte;
}

**Attention** This is a public forum