#if 1 //i could delete the routine for some season.
if(usart0_receive_ok)
{
return; //discard the received data or send a error command
//to report communication over-run
}
#endif
if(usart0_receiveing)
{
if(usart0_received_len)//receive the data
{
usart0_recive_buf[usart0_received_length] = temp;
usart0_received_length++;
usart0_expect_receive_len--;
if(usart0_expect_receive_len==0)
{
usart0_receive_ok = TRUE;
USART_LED = LED_OFF;
}
return;
}
else //receive the length for data
{
usart0_expect_receive_len = temp;
usart0_recive_buf[1] = temp;
usart0_received_length = 2;
usart0_received_len = TRUE;
return;
}
}
else if(temp == RECEIVE_BOOT_CODE)//receive boot code
{
usart0_receiveing = TRUE;
usart0_recive_buf[0] = RECEIVE_BOOT_CODE;
USART_LED = LED_ON;
usart0_RS232_1s = 0;
return;
}
//return; //discard the received data
}
}