# TInScan()

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.

The CJC channel, the gain, and temperature sensor type are read from the configuration file. Use the InstaCal configuration program to change any of these options.

Member of the MccBoard class.

## Function Prototype

VB .NET

Public Function TInScan(ByVal lowChan As Integer, ByVal highChan As Integer, ByVal scale As MccDaq.TempScale, ByVal dataBuffer As Single(), ByVal options As MccDaq.ThermocoupleOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo TInScan(int lowChan, int highChan, TempScale scale, float[] dataBuffer, MccDaq.ThermocoupleOptions options)

##### Deprecated methods

The following methods are deprecated, and should only be used for legacy applications. The methods above are preferred, and must be used for 64-bit application development.

VB .NET

Public Function TInScan(ByVal lowChan As Integer, ByVal highChan As Integer, ByVal scale As MccDaq.TempScale, ByRef dataBuffer As Single, ByVal options As MccDaq.ThermocoupleOptions) As MccDaq.ErrorInfo

C# .NET

public MccDaq.ErrorInfo TInScan(int lowChan, int highChan, MccDaq.TempScale scale, out float dataBuffer, MccDaq.ThermocoupleOptions options)

## Parameters

lowChan

Low channel of the scan.

highChan

High channel of the scan.

scale

Specifies the temperature scale that the input is converted to. All scale settings are MccDaq.TempScale enumerated constants. 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. Set it to one of the constants in the "options parameter values" section below.

## Returns

- An ErrorInfo object that indicates the status of the operation.
- dataBuffer[] - Temperature values in degrees are returned here for each channel in the scan.

### options parameter values

All of the options settings are MccDaq.ThermocoupleOptions enumerated constants. To set a variable to one of these constants, you must refer to the MccDaq object and the ThermocoupleOptions enumeration (for example, variable = MccDaq.ThermocoupleOptions.Filter or variable = MccDaq.ThermocoupleOptions.NoFilter).

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. Ten samples are read from the specified channel and averaged. The average is the reading returned. Averaging removes normally distributed signal line noise.
NoFilter | When selected, the temperature readings are not smoothed, resulting in 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. 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!

If the EXP board is connected to an A/D that does not have programmable gain (DAS08, DAS16, DAS16F) then the A/D board range is read from the configuration file (CB.CFG). In most cases, hardware selectable ranges should be set to ±5 V for thermocouples, and 0–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 TIn() method will set the appropriate A/D range.