Hi,
From my experience, there are two methods to read data from peripherals, one is polling mode, another is interrupt mode.
The polling mode is like this:
while(uart_statusRegister(UART0)&FLAG_MASK) {}
char c=UART0_DATA;
Obviously, polling mode is blocking mode, which is not desired.
Interrupt mode:
bool flag;
void USART0_ISR()
{
flag=true;
}
main()
{
......
while(1)
{
if(flag)
{
1)read data from usart input data reg to char c
2)check if the chard c, if it is "return" char, execute command of string; otherwise, append the char c to a string.
clear uart status flag bit
}
}
}
Hope it can help you
BR
XiangJun Rong