ADC_CountsTo_Volts on PSoC

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

cross mob
Anonymous
Not applicable

I'm using PSoC BLE Pioneer,

   

Reading ADC documentation of PSoC I've found this:

   

float32 (uint32 chan, int16 adcCounts)

   

Description:

   

Converts the ADC output to Volts as a floating point number. For example, if the ADC measured 0.534 volts, the return value would be 0.534. The calculation of voltage depends on the value of the voltage reference. When the Vref is based on Vdda, the value used for Vdda is set for the project in the System tab of the DWR.

   

Parameters:
chan: ADC channel number.
adcCounts: Result from the ADC conversion

   

Return Value:
Result in Volts

   

Side Effects:
None

   

My question, why I have to pass ADC channel number?  The channel is already implicit on Resultfrom the ADC conversion.

   

 

   

My actual reading is:

   

        Ref_16 = ADC_GetResult16(1u);
        Ref = ADC_CountsTo_Volts(1u, Ref_16);

   


so, ADC channel number seem redundant.

   

Thanks for help,

   

Fabrizio

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You may define per APIs for every channel offset and conversion factor to ease sensor calibration. So you need to tell additionally which channel the conversion has to be made for.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Thanks Bob,
what you say makes me think that there are methods to calibrate input analog values from ADC. Only I have to discover how? That's right?

   

Fabrizio

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

The conversion function is a linear equation of the usual form y = mx + b

   

There are (afair) two APIs that let you chose an m and a b for each channel. You will need to measure the sensor's output (ADC input) at two different levels and calculate m and b from the resulting ADC counts (x) of the ADC to give the correct calculated volts (y).

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Your help was precious , now I understand this function ADC_SetGain and this too ADC_SetOffset().

   

Thanks Fabrizio

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You are always welcome.

   

 

   

Bob

0 Likes