AnsweredAssumed Answered

ADC calibration

Question asked by Kewal Deshpande on Sep 30, 2015
Latest reply on Oct 8, 2015 by jeremyzhou

I am trying to read the voltage level of 12V and 3.3V and I am not sure where I am going wrong,... There is a 3V VRefH and VRefL is GND.

 

ADC16_DRV_StructInitUserConfigDefault(&adcUserConfig);

 

ADC16_DRV_Init(ADC16_INSTANCE, &adcUserConfig);

 

adc16_chn_config_t chnConfig;

 

    // Configure the conversion channel

    // differential and interrupt mode disable.

chnConfig.chnIdx     = (adc16_chn_t)ADC16_VM12;

#if FSL_FEATURE_ADC16_HAS_DIFF_MODE

    chnConfig.diffConvEnable = false;

#endif

    chnConfig.convCompletedIntEnable  = false;

 

 

    // Software trigger the conversion.

    ADC16_DRV_ConfigConvChn(ADC16_INSTANCE, ADC16_CHN_GROUP, &chnConfig);

 

 

    // Wait for the conversion to be done.

    ADC16_DRV_WaitConvDone(ADC16_INSTANCE, ADC16_CHN_GROUP);

 

 

    adcValue = 0;

    // Fetch the conversion value.

    adcValue = ADC16_DRV_GetConvValueSigned(ADC16_INSTANCE, ADC16_CHN_GROUP);

 

     double voltage;

    voltage = (int)(adcValue * 0.00000000069849);

 

 

 

I am not able to correctly read the adcValue, Is there something which I need to calibrate to get the correct ADC readings.

Outcomes