beautypg.com

Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 132

background image

Function Usage

Selecting the Calibration Constants to Retrieve

Before calling this function, the daqOpen function should be used to open the device from which the
calibration constants will be retrieved, and the daqCalSelectCalTable function should be used to select
the calibration table from which the calibration constants will be retrieved. The internal tables are organized
into gain and calibration entries according to the channel, gain range and A/D range capabilities of the device.
The following need to be selected for each calibration gain and offset constant entries to be retrieved:

• The channel parameter should be set to the desired channel.
• The gain parameter should be set to the desired gain setting for the selected channel.
• The range parameter should be set to the desired range for the gain and channel selection.

Retrieving the Calibration Constants

The gains and offsets constants for the handle, channel, gain and range entries selected are set
for the device and stored in the memory pointed to by the corresponding parameters gainConstant and
offsetConstant

parameters respectively. The values returned are stored in a 16-bit data word which

applies to the current settings for the selected table entry. These values need to be calculated and set by the
calibration application according to the methods described below.

Interpreting Calibration Constant Values

These calibration constants are gains and offsets that are applied to the input data. After the data comes in, it is
multiplied by the gain, and then the offset is added to it. The resulting data has been converted from raw A/D
data to calibrated data. Each channel, gain, and bipolar/unipolar range setting has a different pair of gain and
offset values.

As mentioned above, the first three parameters of the daqCalSetConstants function specify which set of
constants are to be changed. The last two parameters are the actual constants. These constants are in a
particular binary format. The gain constant is 32,768 times the gain. For a gain of x1, the gain constant is
32,768 or 0x8000. The maximum gain is approximately x2 (65,535 / 32,768), and the minimum gain is x 0 (0 /
32,768). The offset (a left-justified signed 12-bit number) is added to the final result. A single least-significant
bit has an integer value of 16 or 0x0010. Setting the calibration constants affects subsequent acquisitions until
another daqOpen is performed. After daqOpen, the original calibration constants are re-read from the
NVRAM in the WaveBook and expansion chassis; then, the working copy as set by daqCalSetConstants
is overwritten.

Prototypes

C/C++

daqCalGetConstants(DaqHandleT handle, DWORD channel, DaqAdcGain gain,
DaqAdcRangeT range, PWORD gainConstant, PSHORT offsetConstant);

Visual BASIC

VBdaqCalGetConstants(ByVal handle&, ByVal channel, ByVal gain, ByVal
range, ByRef gainConstant, ByRef offsetConstant);

Program References

None

4.3-6 Daq API Command Reference

908494

Programmer’s

Manual