Snap-Master’s Fast Binary Data Format (FBDF) stores the data in raw A/D units. When an FBDF file is replayed, the data must be rescaled to voltages using the information contained in the CAL.BLOCK section of the data file.
IMPORTANT
The following information applies to Keithley / MetraByte hardware ONLY! DO NOT use this information for data files acquired with other hardware.
Always backup your data files before attempting to modify or read them. HEM Data assumes no liability for any information provided in this application note or its usage.
To read the CAL.BLOCK, first declare the following structures:
struct sCalBlock
{
float fVersion; // Version of Cal Block
float fPrec; // Precision of DATA format
// 65536.0 max, 4096.0 = ls 12 bits
int nInterleave; // Channel interleave
WORD wMask; // Mask for Data (e.g. 0xFFF0)
struct MBSCALESTRUCT sScale[ 16 ];
struct MBCALTABLESTRUCT sCalTable[ 16 ];
enumMODEL eModel; // Board Model
};
struct MBSCALESTRUCT
{
float fLsb; // Voltage per A/D count
// (Weight of lsb)
float fLow; // Min A/D voltage
};
struct MBCALTABLESTRUCT
{
float fGain; // Gain adjustment
float fOffset; // Offset adjustment
};
The next step is to read the binary block out of the file with the following:
sCalBlock x;
_lread( nFile, x, sizeof( x ) );
Then apply this information to the data in the file with the following:
sCalBlock x;
int channel;
for( channel = 0; channel < x.nInterleave; channel++ )
{
float fFact, fOff;
unsigned index;
// calculate the factor
fFact = x.sScale[channel].fLsb * x.sCalTable[channel].fGain;
// calculate the offset
fOff = x.sScale[channel].fLow * x.sCalTable[channel].fGain +
x.sCalTable[channel].fOffset;
// apply the factor and offset to the raw data
for( index = channel; index < 32768U; index += x.nInterleave )
lpFloatData[ index ] = (float)(lpRawData[ index ] & x.wMask) * fFact + fOff;
}
Note that step 3 does not manage more than 32768 data points. You will have to add code as necessary in order to scale more than 32768 points.





