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.
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;
}
**Attention** This is a public forum