Example Code

Taking Measurements in NI LabVIEW with Your NI USB-TC01

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • USB-TC01

Code and Documents

Attachment

Description

Overview


LabVIEW provides an easy-to-use application development environment designed specifically for the needs of engineers and scientists. Without any prior programming experience, you can use LabVIEW to take measurements from your USB-TC01 and create custom software functionality.

LabVIEW Graphical Programming

A LabVIEW application is called a virtual instrument (VI) because software user interfaces (with knobs, buttons, dials, and graphs) are used to emulate the control panels of traditional instruments. A VI consists of a Front Panel, where you create custom user interfaces by dragging and dropping graphs and controls, and a Block Diagram, where you design software functionality by wiring together function blocks.


Figure 1. LabVIEW applications consist of a Front Panel (left) and Block Diagram (right).

Taking a Measurement with LabVIEW

Follow these steps to take your first measurement.

Don’t have LabVIEW?  Try it free for 7 days.

Download includes NI-DAQmx driver software

1. Start LabVIEW and open a blank VI, which is a new LabVIEW program.


Figure 2. Start programming with a blank LabVIEW VI.

 

2. On the white window (the Block Diagram), right-click and select Input » DAQ Assistant.


Figure 3. The DAQ Assistant is a Configuration Wizard for DAQ devices.

 

3. Once you place the DAQ Assistant on the Block Diagram, the Configuration Wizard pops up to provide step-by-step instructions for the most common measurement types. Select Analog Input » Temperature » Thermocouple.


Figure 4. This shows the DAQ Assistant with Thermocouple selected.

 

4. Select the USB-TC01 as the measurement device.


Figure 5. Configure the device and channel to measure.

 

5. The final configuration window provides all the parameters for the thermocouple measurement task.


Figure 6. Assign all temperature measurement task configuration parameters with the DAQ Assistant.

 

6. Right-click the Block Diagram, select Exec Control » While Loop, and drag the loop around the DAQ Assistant.


Figure 7. Continually take measurements by adding a while loop around the DAQ Assistant.

 

7. Right-click the Block Diagram, select Exec Control » Time Delay, and place it in the while loop. Right-click the Delay Time input and select Create » Indicator to add a control to the Front Panel.


Figure 8. Use the Delay Time Express VI to control the rate that you take samples from the USB-TC01.

 

8. Right-click the Front Panel, select Graph Indicators » Chart, and place it on the Front Panel. Wire the output of the DAQ Assistant to the chart.


Figure 9. Add a chart display to view the data on the Front Panel.

 

9. Your basic LabVIEW application is complete. Press the run arrow in the top left corner to start taking measurements and display the results.


Figure 10. The run button starts your LabVIEW application.

 

Download the LabVIEW Code

tc01_taking_measurements.vi

Try LabVIEW Free for 7 Days


7-day trial version of LabVIEW and NI-DAQmx driver software
System Requirements: Windows 2000 or later

What Else Can You Do with LabVIEW?

  1. Take Measurements
  2. Data Logging
  3. Conditional Logging
  4. Custom Alarms
  5. Signal Analysis
  6. Report Generation
  7. Custom User Interfaces

 

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.