EmbeddedRelated.com
Forums
Memfault Beyond the Launch

dynamic C programming

Started by reis6805 May 26, 2013
I am new to C programming in general. Can anyone explain the arguments of this,
voltage = (value - _adcCalibS[channel][GAINSET].offset)*(_adcCalibS[channel][GAINSET].kconst)
I am sure the answer is obvious to all but me.....

This is from the A to D converter routine using RCM3400.

Thanks,
Ron

Hi Ron,

The line of code in question is applying a calibration factor in the form of an offset and a gain factor to translate the raw value into a correct voltage. This is done by subtracting the offset (for the appropriate channel) from the raw value and then scaling with the appropriate gain.

_adcCalibS is a 2 dimensional array of calibration structs which is organised by channel first and then gain code.

Regards,
Peter

--- In r..., "reis6805" wrote:
>
> I am new to C programming in general. Can anyone explain the arguments of this,
> voltage = (value - _adcCalibS[channel][GAINSET].offset)*(_adcCalibS[channel][GAINSET].kconst)
> I am sure the answer is obvious to all but me.....
>
> This is from the A to D converter routine using RCM3400.
>
> Thanks,
> Ron
>


Memfault Beyond the Launch