HI., am doing a serial communication program on msp430fg4618 experimental board.
here is my code., but am not getting the correct output. somr garbage data is transmitting from my controller.
#include <msp430fg4618.h>
void delay(unsigned int ms)
{
unsigned int i, j;
for (i = 0; i <= ms; i++)
{
for (j = 0; j<=255; j++);
}
}
void main(void)
{
unsigned int i;
//WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P2SEL |= 0x30; // P2.4,5 = USART0 TXD/RXD
IE2 |= UTXE1 + URXE1; // Enable USART0 TXD/RXD
UCA0CTL0 |= CHAR; // 8-bit character
UCA0CTL1 |= SSEL1; // UCLK = ACLK = 32.768kHz
UCA0BR0 = 0x03; // 32.768kHz/9600 - 3.41
UCA0BR1 = 0x00;
UCA0MCTL = 0x4A; // Modulation
while (1)
{ for (i = 0x41; i <= 0x5A ; i++)
{
UCA0CTL0 &= ~SWRST; // Initialize USART state machine
while (!(IFG1 & UTXIFG1));
U1TXBUF = 'Z';
delay(100);
}
}
}
and i really didn't understand about the modulation control register.
thanks in advance.