Hello! I need to read a string from UART, there's code below:
unsigned char GetChar(void)
{
while(!RI)
;
RI = 0;
return SBUF;
}
int Readfstr(void)
{
char first_s, last_s;
unsigned short int i=0;
first_s = GetChar();
if (first_s=='m')
{
uart_buf[i] = first_s;
while (last_s!='E')
{
i++;
last_s = GetChar();
uart_buf[i]=last_s;
}
return 1;
} else return 0;
}
But it doesn't work