By rupesh vishwakarma in MSP430 Ultra-Low Power Microcontrollers
I tried the following code on MSP2417 controller
void UARTset(void) //Uses USCI_A0
{
P3SEL |= BIT4 + BIT5; /* P3.4, P3.5 UART mode */
P3DIR |= BIT4; /* P3.4 - output */
P3DIR &= BIT5;
UCA0CTL1 |= UCSWRST; /* disable UART */ //Universal serial communication interface reset)
UCA0CTL0 = 0x00;
UCA0CTL1 |= UCSSEL_2; // SMCLK
UCA0BR0 = 0xA; // 115200//1.1MHZ
UCA0BR1 = BAUD1;
UCA0MCTL = 0; //
UCA0CTL1 &= ~UCSWRST; // **Initialize USCI state machine**
IE2 |= UCA0RXIE; // Enable USCI_A0 RX interrupt
__bis_SR_register(GIE); // Enter LPM0, interrupts enabled
}
#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
LEDtypeAON; //just to see whether code jumps to ISR
while (!(IFG2&UCA0TXIFG)); // USCI_A0 TX buffer ready?
UCA0TXBUF = UCA0RXBUF; // TX -> RXed character
}
void main(void) {
unsigned char command[10],lastStatus,b;
// initialize peripherals
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
LEDallOFF; //all LED are OFF
LEDportSET;
UARTset();
while(1)
{
delay_ms(100);
}
}
so according to the example in the http://www.ti.com/lit/zip/slac151 MSP430x261x_uscia0_uart_03.c the code should echo the characters I typed on the hyperterminal . even the code does not jump to the ISR . I get the TX interrupt fine and I can print the characters on the terminal but how to recieve it???
RUPESH
IITKANPUR