Archived: Measurement Multithreading in NI-DAQmx and Traditional NI-DAQ (Legacy)

NI does not actively maintain this document.

This content provides support for older products and technology, so you may notice outdated links or obsolete information about operating systems or other relevant products.


LabVIEW has long had the ability to execute code in parallel. For a single-processor machine, independent code can operate in different processor threads. For multiprocessor machines, parallel, independent code in the same program can operate on separate processors. With these performance gains, LabVIEW programmers can build high-end applications, but NI-DAQ 7 now presents a much more practical application for multithreading – Measurement Multithreading. Note: This page is about NI-DAQ also known as Traditional NI-DAQ (Legacy). NI-DAQmx replaced Traditional NI-DAQ (Legacy) in 2003. NI strongly recommends using NI-DAQmx for new designs and migrating existing Traditional NI-DAQ (Legacy) applications to NI-DAQmx. Please review the Getting Started with NI-DAQmx guide for more information on migration.

Measurement multithreading is the concept of controlling a single function on a Data Acquisition (DAQ) device independent of other I/O operations on the same board or on other boards. Figure 1 illustrates some of the communication paths between data acquisition devices and the driver software.

Figure 1. Communication Paths to Data Acquisition Device and Software

In the Traditional NI-DAQ (Legacy) interface, a simple request for an analog input waveform could block the driver software from accessing a digital I/O line, for example, until the analog input operation is complete. Starting with NI-DAQ 7 interface, a user control could access and read/write a digital line, regardless of the state of an analog input operation. In fact, all four DAQ device operations – analog input, analog output, digital I/O, and counter/timer – can operate independently.

A typical application example is a continuous hardware-timed analog input operation running at 1,000 samples/s without interruption. In the example below, the driver software is asking to retrieve the data in blocks of 500 samples each in the upper loop while trying to read a digital line in the lower loop.

Figure 2. Simultaneous Measurement Operations in the Traditional NI-DAQ Programming Environment

In Figure 2, the digital loop typically can execute at only about 100 operations/s because the upper loop is requesting the attention of the driver software. If all of the samples are not available in the upper loop, the function will block all other DAQ operations until the samples are available. This same program logic is recreated in NI-DAQmx in Figure 3 below.

Figure 3. Simultaneous Measurement Operations in the NI-DAQ 7 Programming Environment

The Digital Loop in Figure 3 can continuously sample the digital input line without interference from the Analog Loop. The read VI in the upper loop simply sleeps, yielding the processor, until the samples are ready. The lower loop can operate freely while the upper loop sleeps. Consequently, the lower loop can run at 10,000 operations/s, a 100X improvement over the traditional NI-DAQ programming environment.

NI-DAQmx  also includes DAQ Assistant, which reduces the amount of LabVIEW programming in exchange for configuration-based dialog screens. Using DAQ Assistant is still 10X faster than the traditional programming environment and is much easier and faster to program.

Figure 4. Simultaneous Measurement Operations using the New DAQ Assistant

Although the ability to synchronize these operations is easier than ever with NI-DAQmx, you can now operate these functions asynchronously because of measurement multithreading. Demand driver software with measurement multithreading to meet the changing performance and functionality requirements of a PC-based data acquisition system.

Was this information helpful?