u8 RxBuff[20];
u8 RxBuffed[20];
u8 RxCount;
u8 RxLength;
void USART2_IRQHandler(void)
{
u8 i;
if(USART_GetITStatus(USART2, USART_IT_RXNE) != RESET)
{
USART_ClearITPendingBit(USART2, USART_IT_RXNE);
RxBuff[RxCount++] = USART_ReceiveData(USART2);
RxLength = 0;
if(RxBuff[RxCount-1] == 0x0a)
{
RxLength = RxCount-2;
RxCount = 0;
}
if(RxLength != 0)
{
for(i=0;i<RxLength;i++)
{
RxBuffed[i] = RxBuff[i];
}
for(i=RxLength;i<20;i++)
{
RxBuffed[i] = ' ';
}
}
}
}