AnsweredAssumed Answered

FRDM-K20D50M - ADC Voltage Measurement with processor expert

Question asked by Srividhya Umashanker on Apr 7, 2015
Latest reply on Apr 8, 2015 by Srividhya Umashanker

I am trying to connect an external battery for some voltage calculation. Have enabled ADC0_SE14 (P0)  as my input pin.

When i am not connected to the battery in the A0 pin, should i expect a 0 value  when calling AD1_GetMeasuredValues() ?

But i am getting a value ranging between 17000 -  30000 everytime. Why is that. All the examples provided match the configuration and code that i have done.


Please help.



Here is my AD1_LDD Configuration in processor expert

 

adc_setting.png

 

Here is the code in my main.c for reading the single voltage value.

 

  /* Write your code here */

  /* For example: for(;;) { } */

  AD1_SelectSampleGroup(adcDevData, 0U);

  AD1_StartSingleMeasurement(adcDevData);

 

  uint16_t value;

    printf("----Checking Status...... --------\n");

   

    while (!AD1_GetMeasurementCompleteStatus(adcDevData))

     {

         printf("---running...\n");

     }

    AD1_GetMeasuredValues(adcDevData, &value);

    printf("----Final Data... -----%d---\n", value);

 

 

The output show a value ranging from 17000 ~ 25000   without connecting anything to the board..

 

----Checking Status...... --------                                             

----Final Data... -----21526---                                                

Outcomes