SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on how to get your MSP JTAG programmer up and running.
By vincent fung
#108522
Hello,

This is my first time using msp430 series. I am using the MSP430FG4618 experimenter's board and I would like to have RS232 communication. After developing my own program, it doesn't work. Therefore, I tried with the TI sample code.

With the sample code from msp430xG46x_uscia0_uart_9600.c developed by TI, I still cannot transmit signal through RS232 via terminal. I don't know whether the setting in the program has something wrong or the hardware.

Can anyone give me help? I have tried to debug and the program can actually run into the interrupt.

#include "msp430xG46x.h"

void main(void)
{
volatile unsigned int i;

WDTCTL = WDTPW+WDTHOLD; // Stop WDT
FLL_CTL0 |= XCAP18PF; // Configure load caps

P5OUT&=~BIT1;
P5DIR|=BIT1;
P2SEL = BIT4|BIT5; // P2.4,5 = USCI_A0 RXD/TXD

UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32k/9600 - 3.41
UCA0BR1 = 0x00;
UCA0MCTL = 0x06; // Modulation
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE+UCA0TXIE; // Enable USCI_A0 RX interrupt

_BIS_SR(GIE);
while(1);
}

// Echo back RXed character, confirm TX buffer is ready first
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCIA0RX_ISR (void)
{
P5OUT^=BIT1;
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
}

#pragma vector=USCIAB0TX_VECTOR
__interrupt void USCIA0TX_ISR (void)
{
}