- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Your help was precious , now I understand this function ADC_SetGain and this too ADC_SetOffset().
Thanks Fabrizio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are always welcome.
Bob