AnsweredAssumed Answered

LPC4330-Xplorer Development Board receiving the ADC values

Question asked by eugenr on Jun 19, 2017
Latest reply on Jul 3, 2017 by Kerry Zhou

I'm trying to retrieve the ADC value, and I am using the Chip_ADC_ReadValue() method. But he only enters the Handler method once and not always when the input at the ADC pin changes. I am still not totally aware of what I am doing since I am new in programming micro controllers. I hope somebody can help me.

 

This is my ADC_Init():

 

static void ADCInit(){
     uint32_t _bitRate = 400000;
     ADC_RESOLUTION_T _bitAccuracy = ADC_10BITS;

     Chip_ADC_Init(LPC_ADC0, &ADCSetup); //Initialize the ADC Pin
     Chip_ADC_EnableChannel(LPC_ADC0, ADC_CH1, ENABLE);
     Chip_ADC_Int_SetChannelCmd(LPC_ADC0, ADC_CH1, ENABLE);//Enable Channel 1 of the ADC0 Pin for Interrupt
     Chip_ADC_SetStartMode(LPC_ADC0, ADC_START_NOW, ADC_TRIGGERMODE_RISING);//Set it to trigger on the rising event, Set Mode on starting the conversion now

     Chip_ADC_SetSampleRate(LPC_ADC0, &ADCSetup, _bitRate);//Set the sample rate to 400kHz
     Chip_ADC_SetResolution(LPC_ADC0, &ADCSetup, _bitAccuracy);//Set the accuracy to 10 Bits if one is using more channels the accuracy has to be dropped


     /*Enable Interrupt*/
     NVIC_SetPriority( ADC0_IRQn, (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY));
     NVIC_EnableIRQ( ADC0_IRQn );

}

And this is my Interrupt Handler:

void ADC0_IRQHandler(void)
{
     uint16_t dataADC;
     /* Interrupt mode: Call the stream interrupt handler */
     Chip_ADC_Int_SetChannelCmd(LPC_ADC0, ADC_CH1, ENABLE);
     Chip_ADC_ReadValue(LPC_ADC0, ADC_CH1, &dataADC);
     SetADCValue(dataADC);
     storeItemInfftBuffer(dataADC);
}

Thanks in advance 

Outcomes