NI-DAQmx: Single Thermocouple Sample in .NET
Overview
This example demonstrates how to acquire one temperature reading from one or more thermocouples.
Downloads
Filename: acq_single_therm_sample.zip
Requirements: View
Example program:
AcqOneThermocoupleSample
Category:
AI
Description:
This example demonstrates how to acquire one temperature reading
from one or more thermocouples.
Instructions for running:
1. Specify the physical channel where you have connected the thermocouple.
2. Enter the minimum and maximum temperature values in degrees C that you
expect to measure. A smaller range will allow a more accurate
measurement.
3. Specify the type of thermocouple you are using.
4. Thermocouple measurements require cold-junction compensation (CJC) to
correctly scale them. Specify the source of your cold-junction
compensation.
5. If your CJC source is "Internal", skip the rest of the steps.
6. If your CJC source is "Constant Value", specify the value (usually room
temperature) in degrees C.
7. If your CJC source is "Channel", specify the CJC Channel name.
8. Specify the appropriate Auto Zero Mode. See your SCXI device's hardware
manual to find out if your device supports this attribute. E-Series
devices do not support this attribute.
Steps:
1. Create a new Task. Create a AIChannel object by using the
CreateThermocoupleChannel method.
2. Set the AutoZero mode. This attribute is set to compensate for input
offset errors and may not be supported by all devices.
4. Call AnalogMultiChannelReader.BeginReadSingleSample to install a callback
and begin the asynchronous read operation.
5. Inside the callback, call AnalogMultiChannelReader.EndReadSingleSample to
retrieve the data from the read.
6. Dispose the Task object to clean-up any resources associated with the
task.
7. Handle any DaqExceptions, if they occur.
I/O Connections Overview:
Connect your thermocouple to the terminals corresponding to the physical
channel value. For more information on the input and output terminals for
your device, open the NI-DAQmx Help, and refer to the NI-DAQmx Device
Terminals and Device Considerations books in the table of contents.
Requirements
Filename: acq_single_therm_sample.zip
Software Requirements
Language(s): Visual Basic .NET, C#
Additional Software: Visual Basic .NET, Visual C#, Visual Studio .NET 2005
Hardware Requirements
Hardware Group: Multifunction DAQ (MIO), SCXI
Driver: NI-DAQmx
Reader Comments | Submit a comment »
Legal
This example program (this "program") was developed by a National Instruments ("NI") Applications Engineer. Although technical support of this program may be made available by National Instruments, this program may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this program with each new revision of related products and drivers. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
