Driver Development Kit (DDK)

Showing results for 
Search instead for 
Did you mean: 

AI scaling coefficients



i am using MHDDK samples to access a PCI-6250 card.


The correction for offset and gain is always done in the function "aiPolynomialScaler", which returns a physical value. For my project however, I do not need a physical value. Instead, I need the raw 16-bit values from AI, corrected for offset and gain.


Unfortunately, the gain and offset data is located in the EEPROM as a floating point number, with no additional information in the documentation.


void aiGetScalingCoefficients (const u8 *eepromMemory, u32 intervalIdx, u32 modeIdx, u32 channel, tScalingCoefficients *scaling)
    u32 calOffset = 0;
    calOffset = getCalibrationAreaOffset (eepromMemory);
    u32 modeOffset = calOffset + kAiModeBlockStart + (modeIdx*kAiModeBlockSize);
    tMode mode;
    mode.order = eepromMemory[modeOffset++];
    mode.c[0] = getF32FromEeprom (eepromMemory, modeOffset);
    modeOffset += 4;
    mode.c[1] = getF32FromEeprom (eepromMemory, modeOffset);
    modeOffset += 4;
    mode.c[2] = getF32FromEeprom (eepromMemory, modeOffset);
    modeOffset += 4;
    mode.c[3] = getF32FromEeprom (eepromMemory, modeOffset);
    tInterval interval; 
    u32 intervalOffset = calOffset + kAiIntervalBlockStart + (intervalIdx*kAiIntervalBlockSize);
    interval.gain = getF32FromEeprom (eepromMemory, intervalOffset);
    intervalOffset += 4;
    interval.offset = getF32FromEeprom (eepromMemory, intervalOffset);

    scaling->order = mode.order;
    for (u32 i=0; i <= mode.order; i++)
        scaling->c[i] = mode.c[i] * interval.gain;
        if (i == 0)
            scaling->c[i] = scaling->c[i] + interval.offset;


How can I get the raw gain and offset values?

Or is there any other (easier) way to do this?


Best regards

0 Kudos
Message 1 of 1