AnsweredAssumed Answered

Sampling multiple A/D inputs-Quick Question

Question asked by Rio on Feb 2, 2013
Latest reply on Feb 2, 2013 by Rio
Quick background: I'm using the STM32VL which has 1 ADC peripheral with a possible 18 channels inputs that are multiplexed to the actual ADC. I believe I have the configuration set up correctly for 2 analog inputs. My question lies in the sampling technique... The way I understand the ADC to work on this board is that it has a single data register, so when I scan multiple analog inputs, I have to read the data in between samples using either flags, interrupts or DMA. I chose to use the EOC flag. What I want to do is after the first sample is finished, store the data in ADCResult_1 and when the second sample is complete, store that into ADCResult_2. This is my code but I dont think is correct since this would store the same value in both ADCResult_1and ADCResult_2:

  while(ADC_GetFlagStatus  (ADC1, ADC_FLAG_EOC) == RESET);     
    ADCResult_1 = ADC_GetConversionValue(ADC1);    // sample 1               
    while(ADC_GetFlagStatus  (ADC1, ADC_FLAG_EOC) == RESET); 
    ADCResult_2 = ADC_GetConversionValue(ADC1);  // sample 2

Any suggestions on how to capture each successive sample repeatedly?