if(USART_GetITStatus(coms[n-1].com, USART_IT_RXNE) != RESET)
{
/* Read one byte from the receive data register */
coms[n-1].RxBuffer[coms[n-1].RxTail] = (USART_ReceiveData(coms[n-1].com) & 0xFF);
coms[n-1].RxTail=(coms[n-1].RxTail+1)&RxBufferSize;
/* Clear the USART1 Receive interrupt */
USART_ClearITPendingBit(coms[n-1].com, USART_IT_RXNE);
}
if(USART_GetITStatus(coms[n-1].com, USART_IT_TXE) != RESET)
{
/* Write one byte to the transmit data register */
if(coms[n-1].TxHead!=coms[n-1].TxTail)
{
USART_SendData(coms[n-1].com, coms[n-1].TxBuffer[coms[n-1].TxHead]);
coms[n-1].TxHead = (coms[n-1].TxHead+1)&TxBufferSize;
/* Clear the USART transmit interrupt */
USART_ClearITPendingBit(coms[n-1].com, USART_IT_TXE);
}