I'm using PSoC BLE Pioneer,
Reading ADC documentation of PSoC I've found this:
float32 (uint32 chan, int16 adcCounts)
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.
chan: ADC channel number.
adcCounts: Result from the ADC conversion
Result in Volts
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,
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.
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).