This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
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
Hi Rupesh,
I'm not quite shure what your problem is!
This example SW RECEIVES data (RX interrupt is used, NOT TX) from the terminal (i.e. hyperterminal) and echos it back to the PC (USCI0RX_ISR copys the received data (stored in UCA0RXBUF) to the transmit buffer UCA0TXBUF). Have you tried the code as is to see if there a problem with your terminal setting (Baudrate, ..)?
Pls clearify what you want the MCU to do, and pls provide info (source code) on what you do with LEDtypeAON, LEDallOFF, .. since this info is lacking (and maybe your problem is there).
Rgds
aBUGSworstnightmare
thanks for reply
baud rate and all the setting for terminal are same as concern to the code "LEDTYPE A ON " it has a seperate LED connected to one of the port just to indicate whether the code jumps to RX handler or not
Hi,
can you pls post the source code of the macros (LEDTYPE A ON) you're using?
Rgds
aBUGSworstnightmare
**Attention** This is a public forum