Hello,
I'm interfacing MSP430 with PC using UART, to send a single character. MSP430 is sending signals to the PC through the TTL 232 interface.I'm seeing garbage along with received single character. Code is shown below,
#include "msp430g2553.h"
char rx;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
BCSCTL1 = CALBC1_1MHZ;
DCOCTL = CALDCO_1MHZ;
P1DIR = 0x41; // P1.0 = UART TX LED ,P1.6= UART RX LED, 0100 0001
P1OUT =0x00;
P1SEL |= BIT1 + BIT2; // P1.1 UART rx operation selected ==>p1sel, psel2 =1
P1SEL2 |= BIT1 + BIT2; // P1.2 UART tx operation selected ==>p1sel, psel2 =1
UCA0CTL1 |= UCSSEL_2 + UCSWRST; // CLOCK = SMCLK,REGISTER IS RESET
UCA0BR0 = 109; // baud rate =9600
UCA0BR1 = 0;
UCA0MCTL = UCBRS_1; // Modulation value = 1
// UCA0STAT |= UCLISTEN; // loop back mode enabled
UCA0CTL1 &= ~UCSWRST; // Clear UCSWRST to release USCI_A0 for operation
IE2 |= UCA0TXIE + UCA0RXIE; // Enable the Transmit interrupt
_BIS_SR(GIE); // Enable the global interrupt
UCA0TXBUF = 'M'; // Transmit a byte
}
#pragma vector = USCIAB0TX_VECTOR
__interrupt void TXInterrupt(void)
{
P1OUT ^= BIT0;//light up P1.0 Led on Tx
}
#pragma vector = USCIAB0RX_VECTOR
__interrupt void RXInterrupt(void)
{
P1OUT ^= BIT6; // light up P1.6 LED on RX
}
Any suggestions?
Thank you,
Regards,