Quantcast
Channel: MSP low-power microcontroller forum - Recent Threads
Viewing all articles
Browse latest Browse all 21934

I want to receive a string or a character through UART in msp430g2553 but not able to receive even a single character it. If a character arrives my IFG2 flag is not getting set so what should i do in this code ?

$
0
0

Following is my routine code to receive a string.

void UART_GETSTRING(unsigned char * string, int length)
{
    unsigned int i=0;
    while(i<length)
        {
            string[i]=UART_GETCHAR();
            i++;
        }
}

unsigned char UART_getchar()                //Waits for a valid char from the UART
{

   check=0;
    IE2 |= UCA0RXIE;
while(1)
 {
     if(check==1)
     { check=0;
         break;
     }

 }

    IE2 &= ~UCA0RXIE;

    return rx_char;
}



#pragma vector=USCIAB0RX_VECTOR
__interrupt void USCI0RX_ISR(void)
{
  while (!(IFG2&UCA0RXIFG));                 // USCI_A0 TX buffer ready?
  rx_char=UCA0RXBUF;

  check=1;
}


Viewing all articles
Browse latest Browse all 21934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>