ADC SAR & ADC Delsig reading deviation

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
MiCo_4221156
Level 2
Level 2
5 likes given First like received First like given

Hi there, I am reading voltage from the potensiometer and feed it to adc SAR (12 bit res) and adc Delsig (20 bit res).

  • When i compere the value to the multi meter i see that there is deviation of 0.2V (im using FLUKE 287), i am not sure if i used the API's correctly, or if i made other mistake.

#include "project.h"

    unsigned a=0; // a is a global int

    unsigned b=0; // a is a global int

int main(void)

{

    CyGlobalIntEnable; /* Enable global interrupts. */

   

    LCD_Start();

    ADC_SAR_Start();

    ADC_DS_Start();

    ADC_DS_StartConvert();

    ADC_SAR_StartConvert();

   

    LCD_Position(0u, 0u);

    LCD_PrintString("V SAR:");

    LCD_Position(1u, 0u);

    LCD_PrintString("V DS:");

            

    for(;;)

    {

        

        LCD_Position(0u, 13u);

        LCD_PrintString("mV");

        LCD_Position(1u, 13u);

        LCD_PrintString("mV");

     

         if(ADC_SAR_IsEndConversion(ADC_SAR_RETURN_STATUS))      // wait for the conversion to end 

        {

           a = ADC_SAR_CountsTo_mVolts(ADC_SAR_GetResult16());

       

           LCD_Position(0u, 8u);

           LCD_PrintNumber(a);

        }  

       

         if(ADC_DS_IsEndConversion(ADC_DS_RETURN_STATUS))         // wait for the conversion to end

        {

           b = ADC_DS_CountsTo_mVolts(ADC_DS_GetResult32());

       

           LCD_Position(1u, 6u);

           LCD_PrintNumber(b);

        }

    }

}

thank you,

Michael

0 Likes
1 Solution
lock attach
Attachments are accessible only for community members.

Michael,

I'll try to unravel your many questions.  Let's start with 3).

3) The deviation gets larger when voltage gets bigger.

The issue is that you need to adjust for gain of you input circuit path.  This could be because of the tolerances of your external components or if you are using Opamps or input gain on the ADC.

In the data above if you assume your multimeter is your Voltage reference, then the PSoC SAR value needs to be multiplied by 0.9502 and the PSoC DS needs to multiplied by 0.9549.

If you are familiar with using the SetGain() function, you can achieve this.  I usually prefer to use the gain correction afterwards and store this gain factor in EEPROM.

2).  I'm confused.   You state:  "when i measuring between 0V-1V i get the numbers in 10^(-4) for example - when Multimeter shows 0.37 i get 3862 on the Psoc instead of 0368."  How are you getting PSoC values with 10^(-4)?  GetResults32() provides values in ADC counts.  ADC_DS_CountsTo_mVolts() in mV [10^(-3)] and ADC_DS_CountsTo_mVolts() in uV [10^(-6)].

For your ADC configuration are you using Alignment = Left or = Right?  I normally recommend Alignment = Right.

1) SetOffset() and SetGain() only take integers that operate on ADC counts to convert to mV or uV conversions.  I tend to prefer post-conversion Gain and Offset calculations instead.

To perform a Offset calibration, you only need one point.  Assuming a linear line in the full-scale reading, you can pick any point.  Some people use a 0.0V (grounded) input reading.  The result is the offset.

To perform a Gain calibration, you need two points.  Preferably a minimum and maximum full-scale reading (FSR) is used.

I used your supplied data to calibrate the gain corrections for the SAR and DS and have attached a .xlsx file  for you.

Len

Len
"Engineering is an Art. The Art of Compromise."

View solution in original post

9 Replies