Creating a Virtual Channel in NI-DAQmx and Using it in LabVIEW

Publish Date: Nov 13, 2017 | 19 Ratings | 3.16 out of 5 | Print | 3 Customer Reviews | Submit your review

Table of Contents

  1. Overview
  2. Application Examples
  3. Local Virtual Channels and Global Virtual Channels
  4. Example Code
  5. Additional Resources

 The National Instruments Getting Started with NI-DAQmx Series is aimed at helping you learn NI-DAQmx programming fundamentals. Through video and text tutorials, this series will take you from verifying your device's operation in Measurement & Automation Explorer (MAX) to programming data acquisition applications using LabVIEW. It is intended for both the beginner who wants to learn how to use the DAQ Assistant, as well as the experienced user who wishes to take advantage of advanced NI-DAQmx functionality.

1. Overview

A virtual channel is a collection of settings such as a name, a physical channel, input terminal connections, the type of measurement or generation, and can include scaling information.

In NI-DAQmx, virtual channels are integral to every measurement. You can create virtual channels with the DAQmx Create Channel VI or with the DAQ Assistant. You can also use the DAQ Assistant, accessible from Measurement & Automation Explorer or NI application software, to configure channels and measurement tasks. To name the virtual channel, use the following guidelines:

  • Use any alphanumeric characters.
  • Do not use non-alphanumeric characters with the following exception:
    Spaces are allowed.
  • You can use underscores within the channel name, but you cannot use leading underscores, such as _Dev1.
  • You must use no more than 256 characters.

Back to Top

2. Application Examples

I want to measure temperature in the range 50°C to 200°C using a J-type thermocouple that is wired to channel 0 on an E Series device configured as Device 1. Should I use a physical channel or a virtual channel?

Data acquisition using the physical channel will acquire data as a voltage even though the E Series device is connected to a thermocouple. However, this voltage actually corresponds to a real-world temperature value, which would normally require you to add a separate conversion routine to your existing program. A virtual channel returns the data as a temperature without any additional routines.

I want to expand my application from above. I want to measure temperature at a rate of 1000 samples/sec beginning only after the temperature reaches 75°C. What would the differences be between using a virtual channel or a task?

A virtual channel will return data that has been properly scaled and has the unit of °C. However, with virtual channels, it is up to you to explicitly program the other details of timing and triggering in setting up the application. A task encapsulates all of the information in the virtual channel plus the timing and triggering information.

Back to Top

3. Local Virtual Channels and Global Virtual Channels

In NI-DAQmx, you can configure virtual channels as part of a task or separate from a task. Virtual channels created inside a task are local virtual channels. Virtual channels defined outside a task are global virtual channels.

You can create global virtual channels in MAX or in your application software and save them in MAX. Global virtual channels are listed in MAX under the DAQmx Channel tree. You can use global virtual channels in any application or add them to a number of different tasks. If you modify a global virtual channel, the change affects all tasks in which you reference that global virtual channel.

Local virtual channels are created inside a task. If you create the same local virtual channel in three separate tasks, the local virtual channels are considered to be three distinct virtual channels. If one local virtual channel is modified, the other two local virtual channels remain unchanged.

Back to Top

4. Example Code

  1. Open the Measurement & Automation Explorer by going to Start » All Programs » National Instruments » Measurement & Automation
  2. Open LabVIEW  Start » All Programs» National Instruments » LabVIEW » LabVIEW.
  3. Open the VI attached to this document, found on the right side and use with the Additional Resources Below.

Back to Top

5. Additional Resources

 

Back to Top

Customer Reviews
3 Reviews | Submit your review

Video missing  - Apr 17, 2017

link to the video is missing

No Video at the web link  - Apr 7, 2017

No Video at the web link ....

Need this as text, not video  - Nov 3, 2011

Summary says it all. I don't do video - too lame.

Bookmark & Share


Downloads


Ratings

Rate this document

Answered Your Question?
Yes No

Submit