AnsweredAssumed Answered

Do ADC_GetConversionValue read the current ADC value?

Question asked by shan on Nov 23, 2013
Latest reply on Oct 28, 2016 by Clive One
Hi all,

I'm recently building an application which asks for the current analog input at each poll.  It only reads the ADC value when it receives the request, which means that my STM32L will not read the ADC value all the time.  

And here's my question,  I found out that the ADC value I read at the current request is always the value read in the previous request.

So I did a simple test like this: I wrote a for loop that will read the ADC value for ten times.  In the meanwhile, I tuned my power supply which gives the analog input. (e.x. 0V-3V-0V-3V-0V-3V...)  And then I found out the same thing that it only prints out the previous ADC value instead of the current one. (e.x. 0-0-4096-0-4096-0...)  
 
for (i = 0; i < 10; i++) {
    /* Read ADC conversion result */
    ADCdata = ADC_GetConversionValue(ADC1);
    printf("%4u\n", ADCdata);
    printf("change value now\n");
    Delay(0xfffff);
    Delay(0xfffff);
    Delay(0xfffff);
    Delay(0xfffff);
    Delay(0xfffff);
    Delay(0xfffff);
  }

Does anyone know how I could read the current ADC value?

Thanks a lot!


Outcomes