S12ZVL32 ADC Multiple Channel Read

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S12ZVL32 ADC Multiple Channel Read

384 Views
chaitanya_kalyani
Contributor III

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.

ADC_Cfg_Done.PNG

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;
Fun0(adc_ch0Val);

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

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

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


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.

0 Kudos
1 Reply

299 Views
danielmartynek
NXP TechSupport
NXP TechSupport

Hi chaitanya.kalyani@seoyonelec-rnd.in,

Could you configure all four samples:

pastedImage_1.png

BR, Daniel

0 Kudos