Programming Using DAQExpress

Publish Date: Feb 21, 2018 | 13 Ratings | 2.00 out of 5 | Print | Submit your review


Included with many NI DAQ products, DAQExpress™ is designed with the needs of the R&D engineers, researchers, and scientists at the forefront - it allows you to quickly configure your measurement across multiple channels and instantly view, explore, and save data without needing to write code or build a user interface. DAQExpress gets you to your measurements quickly so you can iterate your experimental measurement setup to capture the right data to validate your designs/hypotheses.

These video tutorials cover how to automate data acquisition by transitioning to programming in DAQExpress. They will introduce the Diagram, where code is created, and the Panel, where data can be viewed. It will also introduce LabVIEW NXG, a fully featured programming environment that can be used when an application requires more functionality than DAQExpress can provide.

Table of Contents

  1. Introduction to Programming in DAQExpress
  2. Creating Custom Data Views in DAQExpress
  3. Transitioning from DAQExpress to LabVIEW NXG
  4. Learn More

1. Introduction to Programming in DAQExpress


Programming in DAQExpress grants greater control over the way data can be viewed and interacted with. You can customize the look and feel of the data you acquire or combine multiple types of data acquisition into one view. A program in DAQExpress is called a LabVIEW VI (Virtual Instrument) and offers a subset of the programming features that are available in LabVIEW NXG. A VI is a graphical program that consists of a panel and a diagram. The panel is a user interface with customizable knobs, buttons, slides and graphs that allow users to view and interact with data. The diagram is where you graphically configure your code, using blocks to represent functions and wires to represent data. 

In this tutorial, we will begin with a pre-configured task. To learn how to create a task in DAQExpress, refer to the Acquire, Record, and Process Data in DAQExpress tutorial. To create a new VI, press the + button in the navigation pane and choose LabVIEW VI, or go to File>>New>>LabVIEW VI. A .gvi file will be added to the navigation pane. The palette (shown below) is where you will see the objects you can drop on your panel and on your diagram.  



Open the diagram by pressing the Diagram tab at the top of the VI pane. Next, drag the task you configured earlier into the diagram window. A DAQmx Read VI will appear - this is a VI, or function, that will read data from your DAQ device. It has two inputs - a task reference, which includes the physical channels, scaling, and timing information you configured when you created your task, and a duration, which defines how long this acquisition should run for. By default, the duration will be one second. 



This function outputs data to a waveform chart called data. Return to the panel by selecting the Panel tab, then find the data indicator in the Unplaced Items bin. Drag and drop this indicator to create the waveform chart. You can now run your acquisition. 



In its current form, this program only acquires one second of data. To acquire data continually, we need to implement a programming structure called a While Loop. A while loop will run the code placed inside it until its stop condition is met. To create a while loop, open the diagram by clicking on the Diagram tab. In the palette, open the Program Flow palette, and click on the While Loop. Next, create the loop around the DAQmx code by clicking and dragging your loop until it completely encompasses the DAQmx function. 


This code cannot be run until a stop condition has been created. To create a stop button, right click on the stop symbol in the bottom right corner of the while loop and select Create>>Control. Return to the Panel tab and place your stop button on the panel. You can resize this stop button to meet your needs. 


From this point, you can experiment with your code. You can create multiple graphs, edit the appearance of those graphs, and acquire from multiple different sources using multiple tasks. 



Back to Top

2. Creating Custom Data Views in DAQExpress


Some applications require the acquisition of multiple data types from multiple sources. DAQExpress allows you to visualize all this information in one place using VIs. In the previous section, you created a simple VI from one data source - in this tutorial, we will take this a step further, modifying how we view data and increasing the number of tasks we represent. 

Begin by creating a custom panel. Create a new LabVIEW VI, then choose the Panel tab. Create some indicators by using the palette - in this example, we create two graphs to measure voltage, a tank indicator to measure temperature, and a numeric indicator to represent the count from a counter task. For each of these, use the Configuration Pane to modify properties of the indicators like the color, the data range, and the axes. 



Next, switch to the diagram by clicking the Diagram tab. Open the Unplaced Items bin and place the four indicators you created in your diagram. 



Import pre-configured tasks by dragging and dropping those tasks from the Navigation pane to the diagram window. When you drag a task into the diagram, it will include a graph by default, but you have already created the indicators you would like to use to represent your data. Click on the terminal marked "data" and delete it, then wire the output from the DAQmx Read VI to the indicators you created. 



The tank and numeric indicators are scalar (single value) indicators, but the data acquired is returned as an array of all the data acquired in the time requested (1s by default). To represent this array in a scalar indicator, you can isolate one number from the array: use the Index Array function to isolate the latest value in the array of values.



Finally, create a loop around the data you've acquired to acquire data continuously, and add a stop button as a stop condition. Some data does not need to exist inside the loop - the task information, for example, only needs to be called once, so it can exist outside the loop. You can adjust the timing of your data to acquire as much data as you need. 



Back to Top

3. Transitioning from DAQExpress to LabVIEW NXG


DAQExpress and LabVIEW NXG VIs will look very similar because they feature the same environment. LabVIEW NXG is a complete superset of the DAQExpress programming environment, providing every feature DAQExpress and much more. LabVIEW NXG is a great fit for integrating third party hardware, developing custom signal conditioning, generating reports, and more. Consider upgrading to LabVIEW NXG if DAQExpress cannot provide the full functionality to design your test or measurement application. 

Migrating from DAQExpress to LabVIEW NXG is simple. The .gvi files you create in DAQExpress can be opened in LabVIEW NXG. On a Windows computer, right click on a project or .gvi you created in DAQExpress, select Open with... and choose LabVIEW NXG. Opening a DAQExpress project in LabVIEW NXG will migrate the tasks, recordings, VIs, and System Designer information to LabVIEW NXG, since the files are completely compatible. You can now add new functionality made possible by LabVIEW NXG. By exploring the palettes in LabVIEW NXG, you will quickly see how much more functionality is available in the LabVIEW software. The math pallette in LabVIEW NXG, pictured on the right below, features the same basic math operations, but includes several more advanced calculus and geometry operations.




DAQExpress is designed for quick measurements and simple test systems - LabVIEW NXG is a fully featured programming environment designed for complex automated test and automated measurement applications. Both environments are designed to help users take their first measurements quickly and start generating insights right out of the box. See Companion Software for DAQ Hardware to learn more about DAQExpress software. Click LabVIEW NXG to learn more about the next generation of LabVIEW. 


Back to Top

4. Learn More


Back to Top

Bookmark & Share


Rate this document

Answered Your Question?
Yes No