Click here to Skip to main content
15,917,473 members

Comments by Gokul G Lekshman (Top 1 by date)

Gokul G Lekshman 15-Apr-19 16:13pm View    
First of all configure the register.
Then follow below code
char uart0_RxChar()
{
 char ch; 
while((U0LSR & 0x01)==0);
ch = U0RBR; 
 return ch;
}

void uart0_RxString(char *str)
{
short int I=0;
char x;
while(1)
{
x=uart0_RxChar() ;
if((x=='\n') || (x=='\r'))
{
str[I]=0;
break;
}
else
{
str[I]=x;
I++;
}
}
}