How to change an ADC channel to another

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

How to change an ADC channel to another

599 Views
alejandrogarcia
Contributor I

How to change an ADC channel to another, I'm using two ADC channels, one differential and one common mode, with Processor Expert

//CHANNEL 0:

//--------------------------------------------

     clrReg32Bits(PORTE_PCR22, 0x01000700U);

        ADC_TP = ADC1_CreateSampleGroup(ADC1_DeviceData,1,1U);      

        ADC_TP = ADC1_StartSingleMeasurement(ADC1_DeviceData);

        while(!ADC1_GetMeasurementCompleteStatus(ADC1_DeviceData));

        ADC_TP  = ADC1_GetMeasuredValues(ADC1_DeviceData,&adc_buffer);

        adc_result =(uint16_t)adc_buffer;

        if(adc_result < 0x8000){adc_result = 0;

        }else{adc_result -= 0x8000;}

           

        Temp_hambiente = (adc_result * 0.000036621);

        Temp_hambiente -= 0.424;

        Temp_hambiente  = (Temp_hambiente / 0.00625);

//CHANNEL 1:

//--------------------------------------------

        clrReg32Bits(PORTE_PCR20, 0x01000700U); /* MUX=0x00U */

        clrReg32Bits(PORTE_PCR21, 0x01000700U); /* MUX=0x00U */

    

          ADC_TP = ADC1_CreateSampleGroup(ADC1_DeviceData,0,1U);      

        ADC_TP = ADC1_StartSingleMeasurement(ADC1_DeviceData);

        while(!ADC1_GetMeasurementCompleteStatus(ADC1_DeviceData));

        ADC_TP  = ADC1_GetMeasuredValues(ADC1_DeviceData,&adc_buffer);

        adc_result =(uint16_t)adc_buffer;


0 Kudos
Reply
1 Reply

420 Views
Petr_H
NXP Employee
NXP Employee

Hello,

Could you please post more details on which MCU do you use and which ADC channels do you use?

A sample project or a .pe file with components settings would be helpful.

best regards

Petr Hradsky

Processor Expert Support Team

0 Kudos
Reply