AnsweredAssumed Answered

ADC interrupt

Question asked by lpcware Employee on Jun 15, 2016
Latest reply on Jul 26, 2016 by R Sudjian
Content originally posted in LPCWare by Mallikarjuna on Mon Jun 06 06:34:59 MST 2016
Daer All


i want do adc with interrupt for that i did initialization mentioned below (void ADC_init(void) ); but it is not generating interrupt nor

not going to interrupt. please check initialization and let me know correct or not.?!

Thank you:-)
 

void ADC_Init (void) {
  LPC_SC->PCONP       |=  (1<<12);                  /* Enable power to ADC block */
  LPC_PINCON->PINSEL1 &= ~(1UL<<18);
  LPC_PINCON->PINSEL1 |=  (1UL<<18);        /* select AD2 pin */
  LPC_SC->PCLKSEL0  =     (0 << 24);           
  LPC_ADC->ADCR       =   (1 << 2)  |               /* select AD0.2 pin */
                                           (4 << 8)  |               /* ADC clock is 25MHz/4 */
           (5 << 16) |              /* Burst Bit */
           (1 << 21) |              /* enable ADC */
           (1 << 24) |              /*Start conversion now*/
           (1 << 27) ;              /*Start conversion on a falling edge*/

  LPC_ADC->ADINTEN = 0x00000004;
  NVIC_EnableIRQ(ADC_IRQn);
}



void ADC_IRQHandler(void)
{
uint32_t adGdr = 0,sTatus = 0,Dummy = 0;
sTatus = LPC_ADC->ADSTAT;
adGdr = LPC_ADC->ADGDR;
Dummy = LPC_ADC->ADDR2;
adGdr = ((adGdr >> 4) & ADC_VALUE_MAX);

}

Outcomes