while(1)
{
//Read data
if(USARTRxReady())
{
data=USARTReadChar();
//test with the new data the commands
if(strstr(rx_buffer,"COMMAND1"))
{
//match found! do something and then clear buffer
rx_buffer[rx_ptr=0]=0;
}
else if(strstr(rx_buffer,"COMMAND12))
{
//match found! do something and then clear buffer
rx_buffer[rx_ptr=0]=0;
}//if no command found what to do?
//eco
//USARTWriteChar('{');
USARTWriteChar(data);
//USARTWriteChar('}');
}//endif
//do the rest of stuff here, like the timer to clear the rx_ptr if no data has been received for a while...
}