beautypg.com

Measurement Computing Data Acquisition Systems rev.10.4 User Manual

Page 31

background image

Programmer’s Manual

988594

API Programming, General Models 2-21

1. Locate the diskette containing the calibration constants file.

2. Configure the card according to instructions found in the DBK documentation (included on your CD,

or in hardcopy).

3. Edit the calibration file, DAQBOOK.CAL, using a text editor.

4. Add the card number information within brackets, as listed in the calibration file.

5. Add the calibration constants immediately after the card number. (These should be entered in the

order given in the calibration file.)

6. Repeat steps 4 and 5 for each card.

7. Verify that no two cards are configured with the same card/channel number.

The table shows an example of a calibration file for configuring the main Daq device unit and two DBK19
cards connected to Daq device expansion channels 3 and 5.

The initialization function for reading in the calibration constants from the calibration text file is
daqReadCalFile. The C language version of daqReadCalFile is similar to other languages and works as
follows:

The filename with optional path information of the calibration file. If calfile is NULL or empty (“”), the
default calibration file DAQBOOK.CAL will be read. This function is usually called once at the beginning
of a program and will read all the calibration constants from the specified file. If calibration constants for a
specific channel number and gain setting are not contained in the file, ideal calibration constants will be
used (essentially not calibrating that channel). If an error occurs while trying to open the calibration file,
ideal calibration constants will be used for all channels and a non-zero error code will be returned by the

daqReadCalFile

function.

Once the calibration constants have been read from the cal file, they can be used by the

daqCalSetup

and

daqCalConvert

functions. The

daqCalSetup

function will configure the order and type of data to be

calibrated. This function requires data to be from consecutive channels configured for the same gain,
polarity, and channel type. The calibration can be configured to use only the gain calibration constant and
not the offset constant. This allows the offset to be removed at runtime using the zero compensation
functions described later in this section.

In this example, several Daq device channels will be read and calibrated. This example assumes the
calibration file has been created according to the initializing calibration constants section of this chapter.
Expansion cards can perform the same type of calibration if the calibration constants are available for the
card and a specified channel number. First list the configuration:

Channel

Channel Type

0

Voltage1 @ X1 gain

1

Voltage2 @ X2 gain

2

Voltage3 @ X2 gain

3

Voltage4 @ X2 gain

Now specify the scan (the sequence of channel numbers and gains that are to be gathered as one burst of
readings). In this example, all the channels at each gain will be read together (in consecutive order) to
make the calibration easier.

Scan

Position

Channel Type

Channel

Gain

Code

0

Voltage1 @ X1 gain

0

DgainX1

1

Voltage2 @ X2 gain

1

DgainX2

2

Voltage3 @ X2 gain

2

DgainX2

3

Voltage4 @ X2 gain

3

DgainX2