if(RI == 1) /* Receiver Interrupt Flag -- SBUF has the character */
{
RI = 0 ; /* Clear the Receive Interrupt Flag */
SDE = 0 ; /* Clear the Error Flag */
if(sp_nRx < SP_RX_SIZE) /* Check to see if there is room */
{
if(FE == 1) /* Check for Framing Errors */
{
FE = 0 ; /* Clear the framing error bit */
++g_RxFramingError ;
ACC = SBUF ; /* Check for BREAK */
if(ACC == 0) BREAK = 1 ;
}
else
{
sp_RxBuffer[sp_RxPut] = SBUF ;
sp_RxPut = (sp_RxPut + 1) & (SP_RX_SIZE - 1) ;
++sp_nRx ;
}
}
else /* One space remains */
{
if(FE == 1)
{
FE = 0 ; /* Clear the framing error bit */
++g_RxFramingError ;
ACC = SBUF ; /* Check for BREAK */
if(ACC == 0) BREAK = 1 ;
}
else
{ /* Continue to overwrite the last character
** Don't increment the pointer
** Don't increment the count of characters in the queue
*/
sp_RxBuffer[sp_RxPut] = SBUF ;
++g_RxDataOverrun ;
LSDE = SDE = 1 ;
}
}
}