I am trying to make a switch from Arduino over to IT and trying to work my way through serial communication to my pc. I am currently using this code
#include "msp430x22x4.h"
#define LED1 BIT1
volatile unsigned int i;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1DIR = 0xFF; // All P1.x outputs
P1OUT = 0; // All P1.x reset
P2DIR = 0xFF; // All P2.x outputs
P2OUT = 0; // All P2.x reset
P3SEL = 0x30; // P3.4,5 = USCI_A0 TXD/RXD
P3DIR = 0xFF; // All P3.x outputs
P3OUT = 0; // All P3.x reset
P4DIR = 0xFF; // All P4.x outputs
P4OUT = 0; // All P4.x reset
UCA0CTL1 |= UCSSEL_1; // CLK = ACLK
UCA0BR0 = 0x03; // 32kHz/9600 = 3.41
UCA0BR1 = 0x00; //
UCA0MCTL = UCBRS1 + UCBRS0; // Modulation UCBRSx = 3
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
while(1)
{
IE2 |= UCA0TXIE;
P1OUT |= 0x01; // Set P1.0 LED on
for (i = 5000; i > 0; i--); // Delay
P1OUT &= ~0x01;
for (i = 5000; i > 0; i--);
}
}
// Transmit the letter u to your heart's content :)
#pragma vector = USCIAB0TX_VECTOR
__interrupt void USCI0TX_ISR(void)
{
UCA0TXBUF = 'u';
IE2 &= ~UCA0TXIE;
}