Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
NI-DAQ 7 Maximizes Throughput, Eases Synchronization



NI-DAQ 7, the latest version of NI-DAQ driver software, makes NI data acquisition (DAQ) devices easier to program and speeds application performance. In the last issue of Instrumentation Newsletter, we discussed how the DAQ Assistant, which is included with NI-DAQ 7 and LabVIEW 7 Express, makes DAQ programming in LabVIEW dramatically easier by quickly configuring and generating DAQ applications. In this issue, we take a more comprehensive look at new NI-DAQ technologies that are now available in LabWindows/CVI and Measurement Studio, as well as LabVIEW 7 Express.

The first things you notice about NI-DAQ 7 are the new DAQ Assistant and the clean, consistent VIs, functions, and class libraries. You may not, however, immediately discover the low-level code generation and API features that make the DAQ Assistant possible or advanced performance features, such as multithreading and synchronization, that are now much easier to use. This article discusses some of these architectural features that save critical development time and significantly improve DAQ system performance.

Automatically Generate DAQ Code
The new DAQ Assistant in LabVIEW 7 Express, LabWindows/CVI, and Measurement Studio provides a step-by-step guide for configuring your NI-DAQ measurement tasks. You choose your measurement type, hardware, and additional parameters such as timing and triggering, and the DAQ Assistant generates all the necessary code. As you configure a measurement task, the DAQ Assistant communicates with many different software components to gather information and generate code (Figure 1). First, you launch the DAQ Assistant from your application development environment (ADE) -- LabVIEW, LabWindows/CVI, or Measurement Studio for Visual Studio -- and the DAQ Assistant then retrieves system configuration, device capabilities, and available virtual channels from NI Measurement & Automation Explorer (MAX).

After you configure a task, the DAQ Assistant queries the actual hardware to verify your settings and stores the configured task in the MAX database. Next, you generate the DAQ code for your ADE. In LabVIEW, for example, you can select Generate Code from the pop-up menu on the Task Name Constant. Through each of these steps, the DAQ Assistant handles many complex interactions behind the scenes to generate code for 22 different measurements with hundreds of measurement parameters across more than 50 measurement devices and three different development environments.

Achieve Total I/O System Throughput with Multithreading
NI LabVIEW, LabWindows/CVI, and Measurement Studio can execute parallel sections of a program in multiple threads, thereby maximizing processor and bus usage during simultaneous operations. NI-DAQ 7 now provides these multithreading advantages to maximize your total I/O system throughput.

Measurement multithreading controls a single function on a DAQ device independent of other I/O operations on the same device or on other devices. For example, imagine a simple application where you want to read an analog input in one loop and simultaneously update a digital line as quickly as possible. The analog read is fairly complex, but needs to execute only a few times per second to retrieve data. The read function spends most of the time waiting for a full set of samples to be ready, leaving a lot of processor time for the digital loop to execute quickly.

Without measurement multithreading, the read function actually sits and waits for data, blocking all other operations and greatly slowing the concurrent digital output and limiting I/O throughput. With the multithreading ability of NI-DAQ 7, the read function still waits for the samples to arrive, but now, rather than blocking other operations, it sleeps and yields processor time while it waits. The digital output then can run at full speed in a separate thread while the read sleeps. This application example is simple, but multithreading becomes much more important as you control more devices and functions simultaneously. Each device and function can operate independently with a different thread. I/O throughput is limited only by processor speed and not single-threaded driver inefficiencies.

Automatic Trigger and Clock Routing Improves Synchronization
Synchronization is important when measuring and generating dynamic signals. To ensure there is no phase mismatch in different generated or acquired signals, you commonly share clocks and triggers. However, programming your devices to route clock signals and share triggers is often very difficult, making synchronization one of the most complex portions of your DAQ programming. NI-DAQ 7 makes synchronization much easier with an automatic routing engine and a consistent, well defined API.

The automatic trigger and clock routing engine in NI-DAQ 7 manages all of the routing and synchronization resources in your DAQ system. This engine maintains a complete table of all possible routes and can route clocks and triggers to external pins, within device subsections, and among multiple devices. For example, in multidevice analog input synchronization, NI-DAQ routes the analog input sample clock from the first device across the RTSI bus or PXI trigger bus and replaces the onboard sample clock on the second (slave) device with the new signal. By sharing a clock, the devices sample with no phase mismatch. In much the same way, NI-DAQ also can automatically route trigger signals from the master to slave device to ensure that the acquisition begins at exactly the same time.

You never explicitly program the automatic routing engine in NI-DAQ 7. Instead, you complete routing and synchronization with the timing and triggering VIs, functions, and methods. The timing and triggering VIs program not only the rate and type of clock or trigger, but also the source. For the master device, the clock and trigger sources are onboard and thus are unwired. For the slave device, you simply select the clock or trigger of the master device from a list in the source constant. In the past, you would have had to use a route signal VI or function for each of the signals you were routing and also manually identify the best route across the RTSI bus or PXI trigger bus. That low-level functionality is still available in NI-DAQ 7, but is rarely needed. In this way, NI-DAQ 7 simplifies the signal routing and synchronization of DAQ systems.

Use One Interface across All ADEs
The new NI-DAQmx API provides a clean, consistent interface across all ADEs. LabVIEW VIs relate directly to functions in LabWindows/CVI and ANSI C, as well as to Measurement Studio methods and properties for Visual Studio .NET. This feature makes it easy for you to migrate applications and example programs among ADEs and easy for the DAQ Assistant to generate code specific to each ADE. This consistency is possible because the NI-DAQ driver engine is modular. Instead of using a C API with a complex LabVIEW or .NET mapping layer on top, NI-DAQ has one common API component with basic DAQ functions such as timing, triggering, read, and write. Thin ADE interfaces on top of the common API component add ADE-specific interfaces without changing core functionality. In addition, these ADE-specific components contain only necessary functions such as the actual VIs or waveform datatype interfaces. The result is an architecture that delivers consistency without sacrificing performance.

Integrate NI-DAQ with Your ADE
From the DAQ Assistant down to the low-level routing engine and multithreading, NI-DAQ 7 simplifies DAQ programming and helps you build faster, more powerful DAQ systems. Released first with LabVIEW 7 Express, NI-DAQ 7 now brings these advantages to LabWindows/CVI 7.0 and Measurement Studio 7.0 for Visual Studio .NET as well.

Read more in-depth articles on these NI-DAQ 7 technologies or to download an evaluation copy of LabVIEW 7 Express.

Malcolm Borgendale
DAQ Product Manager
malcolm.borgendale@ni.com