lpcware

Problem with ADC1763 ADC

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by alexxx on Tue Jun 25 23:31:01 MST 2013

Hi!


 


I read ADC every 10ms, inside systick interrupt. It is ADC 0. The problem is that every now and then (something like once or twice in a minute), the ADC returns 0xFFF. I investigated with the oscilloscope, but there is nothing wrong with hardware line on ADC0. Has anyone experienced a similar problem? I am using LPC1763, IAR compiler. My code is:


void initialize_adc (void)


{


  ADC_Init(LPC_ADC, 100000);  //100KHz


  ADC_IntConfig(LPC_ADC,ADC_ADINTEN0,DISABLE);


  ADC_ChannelCmd(LPC_ADC,ADC_CHANNEL_0,ENABLE);



 


unsigned int return_adc_channel ( const unsigned char CHANNEL_SETUP )   //CHANNEL_SETUP is always 0 for this project


{    


  _UINT temp;<span class="Apple-tab-span" style="white-space: pre;"> </span>//this is a union


 


  // Start conversion


  ADC_StartCmd(LPC_ADC,ADC_START_NOW);


  


  //Wait conversion complete


  while (!(ADC_ChannelGetStatus(LPC_ADC,CHANNEL_SETUP,ADC_DATA_DONE)));


  


  //get ADC data


  temp.ivalue = ADC_ChannelGetData(LPC_ADC,CHANNEL_SETUP);


  return temp.ivalue;


 


}


 


So the problem is that this temp.ivalue returns a 0xFFF, but the voltage on ADC0 doesn't change. After this faulty measurement in the next ADC conversion, the returned value is again OK.

Outcomes