Configuring & Reading a Thermocouple
T-series devices have various configurable features as part of the Analog Input Extended Feature (AIN-EF) system. The following example demonstrates how to configure and read a thermocouple input in the Kipling Register Matrix.
The T4 does not support the thermocouple AIN_EF configured in this example.
1. First connect the thermocouple between AIN0 and GND. In Kipling, navigate to the Register Matrix page and type ain0 in the search bar.
2. Add the following registers to the active register list:
AIN0_EF_INDEX
AIN0_EF_CONFIG_A
AIN0_EF_READ_A
These are the AIN-EF registers for configuring thermocouple measurement.
Kipling has special high-level support for AIN-EF configuration on the Analog Inputs tab for the T4, T7/T7-Pro, and T8, but for the purpose of this tutorial we are using the Register Matrix instead.
3. Configure the thermocouple input by writing the following values to each of the pinned registers.
Write 21
to INDEX
to set AIN0 to use the AIN-EF for Thermocouple type J:AIN0_EF_INDEX = 21
We write 1
to CONFIG_A
so that the output is in deg C:AIN_EF_CONFIG_A = 1
4. The AIN0_EF_READ_A
register should be outputting the scaled temperature value in degC.
5. To save the configuration so the AIN-EF thermocouple feature will be configured at device boot-up, go to the Power-Up Defaults tab and click Configure Power-up Defaults
. Make sure that Current Device Settings
option is selected.
This step is recommended for LJLogM, LJStreamM, and other simple polling programs because they don't configure AIN-EF. If you're writing your own software, however, you can configure AIN-EF programmatically.
Reading a Thermocouple Input in LJLogM
Once the AIN extended feature is configured (above), you can read AIN0_EF_READ_A
using any row in LJLogM.
Close the connection in Kipling before opening LJLogM. A LabJack can only be opened via USB by one software process.
Reading a Thermocouple Input in LJStreamM
AIN Extended Features are not supported in Stream mode. LJStreamM cannot read thermocouple inputs while streaming.
Reading a Thermocouple in DAQFactory
To configure a thermocouple input you can use steps 1-5 above or write AIN0_EF_INDEX = 21
(for Type-J) and AIN0_EF_CONFIG_A = 1
(for deg C) in DAQFactory. See "Device Configuration" on the DAQFactory for LJM page.
To read the temperature look in the AIN0_EF_READ_A
register. See "Linking LabJack Inputs/Outputs to DAQFactory Channels" on the DAQFactory for LJM page.
Reading a Thermocouple in Your Program
Use steps 1-5 above to configure, or write the desired configuration registers at the start of your program with a couple calls to eWriteName or a single call to eWriteNames.
To get a temperature reading read the register AIN0_EF_READ_A
with a call to eReadName.
Or, in the applicable LJM example archive, look for an example called "Write Read Loop with Config" that can be used to both configure and read the timer.