Hi.
I'm trying to set up some basic UART code to process commands from the Energia serial monitor. Right now I just have the basic initialization code and the interrupt, and I want to turn on the red LED on the launchpad when I enter the interrupt so I know that the command is being received. It doesn't seem to be entering the interrupt whenever I type something into the serial monitor. I have the serial monitor set for 9600 baud, and I think that's what I have in my code, but I could be wrong. My code is posted below. Any help would be appreciated. Thanks!
#include <msp430g2553.h>
#include <legacymsp430.h>
#include <io.h>
#include <stdlib.h>
#include <stdint.h>
#pragma vector= USCIAB0RX_VECTOR
__interrupt void USCIAB0RX_ISR(void){
digitalWrite(RED_LED, HIGH);
}
void uart_init(){
UCA0CTL1 |= UCSWRST;
UCA0CTL1 |= UCSSEL_2; //SMCLK
UCA0BR0 = 65; //9600 BAUD
UCA0BR1 = 3; //9600 BAUD
UCA0MCTL |= UCBRS_2; //Modulation
IE2 |= UCA0RXIE; //Enable interrupts
UCA0CTL1 &= ~UCSWRST;
}
void clock_init(){
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
BCSCTL1 = CALBC1_16MHZ & 0xBF;
BCSCTL2 = 0x00;
BCSCTL3 = 0x0C;
DCOCTL = CALDCO_16MHZ; //DCO set to 16MHz
}
int main(void){
clock_init();
uart_init();
__bis_SR_register(GIE); //Enable interrupts
pinMode(RED_LED, OUTPUT);
digitalWrite(RED_LED, LOW);
while(1){
}
}