keil_examples/UART/uart.c
/*****************************************************************************
** Function name:		UART0_IRQHandler
**
** Descriptions:		UART0 interrupt handler
**
** parameters:			None
** Returned value:		None
** 
*****************************************************************************/
Function name:         UART0_IRQHandler
Descriptions:          UART0 interrupt handler

None
Returned value:                None
Function name : UART0_IRQHandler Descriptions : UART0 interrupt handler None Returned value : None
void UART0_IRQHandler (void) 
{
  uint8_t IIRValue, LSRValue;
  uint8_t Dummy = Dummy;
  IIRValue = LPC_UART0->IIR;
  IIRValue >>= 1;			
  IIRValue &= 0x07;			
  if ( IIRValue == IIR_RLS )		
  {
	LSRValue = LPC_UART0->LSR;
	if ( LSRValue & (LSR_OE|LSR_PE|LSR_FE|LSR_RXFE|LSR_BI) )
	{
	  UART0Status = LSRValue;
	  Dummy = LPC_UART0->RBR;		
	  return;
	}
	if ( LSRValue & LSR_RDR )				
	{
	  UART0Buffer[UART0Count] = LPC_UART0->RBR;
	  UART0Count++;
	  if ( UART0Count == BUFSIZE )
	  {
		UART0Count = 0;		
	  }	
	}
  }
  else if ( IIRValue == IIR_RDA )	
  {
	UART0Buffer[UART0Count] = LPC_UART0->RBR;
	UART0Count++;
	if ( UART0Count == BUFSIZE )
	{
	  UART0Count = 0;		
	}
  }
  else if ( IIRValue == IIR_CTI )	
  {
	UART0Status |= 0x100;		
  }
  else if ( IIRValue == IIR_THRE )	
  {
	LSRValue = LPC_UART0->LSR;		
	if ( LSRValue & LSR_THRE )
	{
	  UART0TxEmpty = 1;
	}
	else
	{
	  UART0TxEmpty = 0;
	}
  }
}
void UART0_IRQHandler ( void ) { uint8_t IIRValue , LSRValue ; uint8_t Dummy = Dummy ; IIRValue = LPC_UART0 -> IIR ; IIRValue >>= 1 ; IIRValue &= 0x07 ; if ( IIRValue == IIR_RLS ) { LSRValue = LPC_UART0 -> LSR ; if ( LSRValue & ( LSR_OE | LSR_PE | LSR_FE | LSR_RXFE | LSR_BI ) ) { UART0Status = LSRValue ; Dummy = LPC_UART0 -> RBR ; return ; } if ( LSRValue & LSR_RDR ) { UART0Buffer [ UART0Count ] = LPC_UART0 -> RBR ; UART0Count ++ ; if ( UART0Count == BUFSIZE ) { UART0Count = 0 ; } } } else if ( IIRValue == IIR_RDA ) { UART0Buffer [ UART0Count ] = LPC_UART0 -> RBR ; UART0Count ++ ; if ( UART0Count == BUFSIZE ) { UART0Count = 0 ; } } else if ( IIRValue == IIR_CTI ) { UART0Status |= 0x100 ; } else if ( IIRValue == IIR_THRE ) { LSRValue = LPC_UART0 -> LSR ; if ( LSRValue & LSR_THRE ) { UART0TxEmpty = 1 ; } else { UART0TxEmpty = 0 ; } } }
Function name:         UART0_IRQHandler
Descriptions:          UART0 interrupt handler
Function name : UART0_IRQHandler Descriptions : UART0 interrupt handler
/* skip pending bit in IIR */ /* check bit 1~3, interrupt identification */ /* Receive Line Status */ /* Receive Line Status */ /* There are errors or break interrupt */ /* Read LSR will clear the interrupt */ /* Dummy read on RX to clear 
							interrupt, then bail out */ /* Receive Data Ready */ /* If no error on RLS, normal ready, save into the data buffer. */ /* Note: read RBR will clear the interrupt */ /* buffer overflow */ /* Receive Data Available */ /* Receive Data Available */ /* buffer overflow */ /* Character timeout indicator */ /* Character Time-out indicator */ /* Bit 9 as the CTI error */ /* THRE, transmit holding register empty */ /* THRE interrupt */ /* Check status in the LSR to see if
									valid data in U0THR or not */