cbTIn()

Reads an analog input channel, linearizes it according to the selected temperature sensor type, if required, and returns the temperature in units determined by the Scale argument.

Function Prototype

C/C++

int cbTIn(int BoardNum, int Chan, int Scale, float *TempVal, int Options)

Visual Basic

Function cbTIn(ByVal BoardNum&, ByVal Chan&, ByVal Scale&, TempVal!, ByVal Options&) As Long

Arguments

BoardNum

The number associated with the board when it was installed with InstaCal or created with cbCreateDaqDevice(). BoardNum may be 0 to 99.

Chan

Input channel to read.

Scale

Specifies the temperature scale that the input will be converted to. Choices are CELSIUS, FAHRENHEIT, KELVIN, VOLTS, and NOSCALE.

TempVal

The temperature in units determined by the Scale argument is returned here.

Options

Bit fields that control various options. Refer to the constants in the "Options argument values" section below.

Returns

Options argument values

FILTERWhen selected, a smoothing function is applied to temperature readings, very much like the electrical smoothing inherent in all hand held temperature sensor instruments. This is the default. When selected, 10 samples are read from the specified channel and averaged. The average is the reading returned. Averaging removes normally distributed signal line noise.
NOFILTERIf you use the NOFILTER option then the readings will not be smoothed and you will see a scattering of readings around a mean.
WAITFORNEWDATAWaits for new data to become available.

Refer to the board-specific information in the Universal Library User's Guide to determine if your hardware supports these options.

Notes

Scale options

Refer to board-specific information in the Universal Library User's Guide to determine if your hardware supports these options.

Using CIO-EXP boards

For CIO-EXP boards, the channel number is calculated using the following formula, where:

ADChan is the A/D channel that is connected to the multiplexer.

MuxChan is a number ranging from 0 to 15 that specifies the channel number on a particular bank of the multiplexer board.

Chan = (ADChan × 16) + (16 + MuxChan)

For example, you have an EXP16 connected to a CIO-DAS08 via the CIO-DAS08 channel 0. (Remember that DAS08 channels are numbered 0, 1, 2, 3, 4, 5, 6 and 7). If you connect a thermocouple to channel 5 of the EXP16, the value for Chan would be (0 × 16) + (16 + 5)= 0 + 21 = 21.

CJC channel

The CJC channel is set in the InstaCal installation and configuration program. If you have multiple EXP boards, the Universal Library will apply the CJC reading to the linearization formula in the following manner:

For example: You have four CIO-EXP16 boards connected to a CIO-DAS08 on channel 0, 1, 2 and 3. You choose CIO-EXP16 #1 (connected to CIO-DAS08 channel 0) to have its CJC read on CIO-DAS08 channel 7, AND, you leave the CIO-EXP16's 2, 3 and 4 CJC channels to NOT SET. Result: The CIO-EXP boards will all use the CJC reading from CIO-EXP16 #1, connected to channel 7 for linearization. It is important to keep the CIO-EXP boards in the same case and out of any breezes to ensure a clean CJC reading.

Specific Errors

If an OUTOFRANGE or OPENCONNECTION error occurs, the value returned in TempVal is -9999.0. If a NOTREADY error occurs, the value returned in TempVal is -9000.

Important!

For an EXP board connected to an A/D board that does not have programmable gain (DAS08, DAS16, DAS16F), the A/D board range is read from the configuration file (cb.cfg). In most cases, set hardware-selectable ranges to ±5 V for thermocouples, and to 0 to 10 V for RTDs. Refer to the board-specific information in the Universal Library User's Guide or in the user manual for your board. If the board has programmable gains, the cbTIn() function sets the appropriate A/D range.