# cbTInScan()

Reads a range of channels from an analog input board, linearizes them according to temperature sensor type, if required, and returns the temperatures to an array in units determined by the Scale argument.

## Function Prototype

C/C++

int cbTInScan(int BoardNum, int LowChan, int HighChan, int Scale, float DataBuffer[], int Options)

Visual Basic

Function cbTInScan(ByVal BoardNum&, ByVal LowChan&, ByVal HighChan&, ByVal Scale&, DataBuffer!, 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.

LowChan

Low channel of the scan.

HighChan

High channel of the scan.

Scale

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

DataBuffer

The temperature is returned in units determined by the Scale argument. Each element in the array corresponds to a channel in the scan. DataBuffer must be at least large enough to hold HighChan – LowChan + 1 temperature values.

Options

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

## Returns

- Error code or 0 if no errors
- DataBuffer[] - Temperature values in units determined by the Scale argument are returned here for each channel in the scan.

### Options argument values

FILTER | When 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.
NOFILTER | If you use the NOFILTER option then the readings will not be smoothed and you will see a scattering of readings around a mean.
WAITFORNEWDATA | Waits 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

- Specify the NoScale option to retrieve raw data from the device. When NoScale is specified, calibrated data is returned, although a cold junction compensation (CJC) correction factor is not applied to the returned values.
- Specify the Volts option to read the voltage input of a thermocouple.

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:

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

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.

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:

- If you have chosen a CJC channel for the EXP board that the channel you are reading is on, it will use the CJC temp reading from that channel.
- If you left the CJC channel for the EXP board that the channel you are reading is on to NOT SET, the library will use the CJC reading from the next lower EXP board with a CJC channel selected.

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. As you can see, 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

For most boards, if an OUTOFRANGE or OPENCONNECTION error occurs, the value in the array element associated with the channel causing the error returned will be -9999.0.

## 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.