keil_examples/ADC/adc.c
/******************************************************************************
** Function name:		ADC_IRQHandler
**
** Descriptions:		ADC interrupt handler
**
** parameters:			None
** Returned value:		None
** 
******************************************************************************/
Function name:         ADC_IRQHandler
Descriptions:          ADC interrupt handler

None
Returned value:                None
Function name : ADC_IRQHandler Descriptions : ADC interrupt handler None Returned value : None
void ADC_IRQHandler (void) 
{
  uint32_t regVal;
  volatile uint32_t dummy;
  int i;
  regVal = LPC_ADC->STAT;		
  if ( regVal & 0x0000FF00 )	
  {
	OverRunCounter++;
  	for ( i = 0; i < ADC_NUM; i++ )
  	{
  	  regVal = (regVal & 0x0000FF00) >> 0x08;
      if ( regVal & _BV(i) )
  	  {
        dummy = LPC_ADC->DR[i];
  	  }
  	}
	LPC_ADC->CR &= ~((0x7<<24)|(0x1<<16));	 
  	ADCIntDone = 1;
  	return;	
  }
  for ( i = 0; i < ADC_NUM; i++ )
  {
    if ( regVal & _BV(i) )
	{
	  ADCValue[i] = ( LPC_ADC->DR[i] >> 4 ) & 0xFFF;
	}
  }
#if BURST_MODE
  BurstCounter++;
  channel_flag |= (regVal & 0xFF);
  if ( (channel_flag & 0xFF) == 0xFF )
  {
	LPC_ADC->CR &= ~(0x1<<16);	 
  	channel_flag = 0; 
	ADCIntDone = 1;
  }
#else
  LPC_ADC->CR &= ~(0x7<<24);	 
  ADCIntDone = 1;
#endif
  return;
}
void ADC_IRQHandler ( void ) { uint32_t regVal ; volatile uint32_t dummy ; int i ; regVal = LPC_ADC -> STAT ; if ( regVal & 0x0000FF00 ) { OverRunCounter ++ ; for ( i = 0 ; i < ADC_NUM ; i ++ ) { regVal = ( regVal & 0x0000FF00 ) >> 0x08 ; if ( regVal & _BV ( i ) ) { dummy = LPC_ADC -> DR [ i ] ; } } LPC_ADC -> CR &= ~ ( ( 0x7 << 24 ) | ( 0x1 << 16 ) ) ; ADCIntDone = 1 ; return ; } for ( i = 0 ; i < ADC_NUM ; i ++ ) { if ( regVal & _BV ( i ) ) { ADCValue [ i ] = ( LPC_ADC -> DR [ i ] >> 4 ) & 0xFFF ; } } #if BURST_MODE BurstCounter ++ ; channel_flag |= ( regVal & 0xFF ) ; if ( ( channel_flag & 0xFF ) == 0xFF ) { LPC_ADC -> CR &= ~ ( 0x1 << 16 ) ; channel_flag = 0 ; ADCIntDone = 1 ; } #else LPC_ADC -> CR &= ~ ( 0x7 << 24 ) ; ADCIntDone = 1 ; #endif return ; }
Function name:         ADC_IRQHandler
Descriptions:          ADC interrupt handler
Function name : ADC_IRQHandler Descriptions : ADC interrupt handler
/* Read ADC will clear the interrupt */ /* check OVERRUN error first */ /* if overrun, just read ADDR to clear */ /* regVal variable has been reused. */ /* stop ADC now, turn off BURST bit. */ /* All the bits in have been set, it indicates all the ADC 
	channels have been converted. */ /* Clear BURST mode, stop ADC now */ /* stop ADC now */