Software calibration, Initializing the calibration constants, Software calibration and zero compensation – Measurement Computing TempBook rev.3.0 User Manual
Page 51

Software Calibration and Zero Compensation
7
TempBook User’s Manual
Software Calibration and Zero Compensation 7-1
Note: The enhanced API commands do not work exactly like the standard API commands used in this chapter.
This section describes how to use the TempBook's software calibration and zero compensation functions to
correct for gain and offset errors. To use the calibration constants shipped with the board, DaqView users
should follow the instructions given on the calibration document containing these constants. The program
will automatically use these constants.
Programmers wishing to use the TempBook’s thermocouple linearization functions with auto-zero
compensation (rather than calling the zero compensation functions manually) should refer to the
Thermocouple Linearization chapter of this manual.
Both software calibration and zero compensation increase the accuracy of the TempBook and its expansion
cards by correcting for gain and offset errors. For example, when using a TempBook with software
calibration, accuracy better than 1°C can be achieved. The calibration operation removes static gain and
offset errors that are inherent in the hardware. This operation uses calibration constants, usually measured
at the factory, to adjust for gain and optionally offset errors. The calibration constants do not change during
the execution of a program but are different for each card and programmable gain setting.
Zero compensation removes offset errors while a program is running. This is useful in systems where the
offset of a channel may change due to temperature changes, long-term drift or hardware calibration changes.
By reading a shorted channel on the same card at the same gain as the desired channel, the offset can be
removed at run-time. Note: The TempBook has channel 18 permanently shorted for performing zero
compensation.
Software Calibration
Software calibration functions are designed to adjust TempBook readings to compensate for gain and offset
errors. Calibration constants are calculated at the factory by measuring the gain and offset errors of a card
at each programmable gain setting. These constants are stored in a calibration text file which can be read
by a program at runtime. This allows new boards to be configured for calibration by updating this
calibration file rather than re-compiling the program.
The calibration process is divided up into three steps:
•
Initialization consists of reading the calibration file.
•
Setup describes the characteristics of the data to be calibrated.
•
Conversion does the actual calibration of the data.
All of the functions prototypes, return error codes and definitions are located in the TempBook.H header
file (C language) or similar header file (other languages).
Initializing the Calibration Constants
Each TempBook is shipped with a disk containing a calibration constants file. The file is named
serial_no.cal where serial _no is the serial number of the TempBook for which the constants were
generated. This file should be copied into the directory from which the user’s program will be run. For
convenience, this file can be renamed tempbook.cal which is the default calibration filename.
The initialization function for reading in the calibration constants from the calibration text file is
tbkReadCalFile
. The C language version of tbkReadCalFile is similar to that of other languages
and operates as follows:
int tbkReadCalFile(char_*calfile)
char_*calfile
calfile contains the path (optional) and filename of the calibration file. If calfile is NULL
or empty (""), the default calibration file TempBook.CAL will be read.
This function, which is usually called once at the beginning of a program, 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 performing no calibration for
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 tbkReadCalFile function.