AnsweredAssumed Answered

S12ZVL32 ADC Multiple Channel Read

Question asked by Chaitanya Kalyani on Dec 4, 2019
Latest reply on Dec 6, 2019 by Daniel Martynek

I want to use 4 ADC channels of 10 bit. I have configured for 4 but getting output of only first channel.


I configured as below.


and written code 


uint16_t adc_ch0Val = 0;
uint16_t adc_ch1Val = 0;
uint16_t adc_ch2Val = 0;
uint16_t adc_ch3Val = 0;
uint16_t ADC_result0[1]; //Store the ADC result
uint16_t ADC_result1[1]; //Store the ADC result
uint16_t ADC_result2[1]; //Store the ADC result
uint16_t ADC_result3[1]; //Store the ADC result

void Read_ADC_Channesl(void)
ADC_MeasureChan(TRUE, 0);
ADC_GetChanValue(0, ADC_result0);
adc_ch0Val = *ADC_result0;

ADC_MeasureChan(TRUE, 1);
ADC_GetChanValue(1, ADC_result1);
adc_ch1Val = *ADC_result1;

ADC_MeasureChan(TRUE, 2);
ADC_GetChanValue(2, ADC_result2);
adc_ch2Val = *ADC_result2;

ADC_MeasureChan(TRUE, 3);
ADC_GetChanValue(3, ADC_result3);
adc_ch3Val = *ADC_result3;

void Fun0(uint16_t ain0)
//Some operation
void Fun1(uint16_t ain1)
//Some operation
void Fun2(uint16_t ain2)
//Some operation
void Fun3(uint16_t ain3)
//Some operation


but when I check variables value then getting same value that is only PAD1 value.


I am passing different channel numbers still getting only one pin output.


How I can access for ADC 4 channel.