Get Up and Running Fast With the USB 600x Series DAQ Device
Overview
Start all of the features of your USB 6008/6009 DAQ device right out of the box.
Overview
The USB-600x series DAQ devices are a fast and affordable way to acquire and control real world signals with your computer. Despite its simplicity, it can still require time to write and debug application specific programs, which you may find prohibitive. This is especially true in environments where the application is constantly changing and evolving, such as academic laboratories. The purpose of this Developers Zone article is to provide an out-of-the-box solution for rapid deployment with the USB-600x series devices.
What Does this VI Do?
This VI uses a software loop to poll all inputs and update all outputs on the device simultaneously. It allows you to switch analog inputs between Referenced Single Ended mode (all pins referenced to the device ground) and Differential mode (voltage between two different pins) on the fly. You can also toggle digital pins to be either input or output. A count indicator shows the digital edges that are counted on pin PFI0.
This code comes in two library files containing the same code base. One is cross platform (daqmxbaseversion.llb) and can be run on Windows, Linux or Mac OS X using the NI-DAQmx Base driver suite. The other is for Windows PC computers only (daqmxversion.llb) using the standard NI-DAQmx driver suite.
The NI-DAQmx version has slightly more functionality than the NI-DAQmx Base version. The NI-DAQmx Base version runs at the maximum rate that it can on your machine, utilizing as many system resources as your operating system allows it. The NI-DAQmx version, however, gives you the ability to adjust the sample rate. Additionally, you can disable pins that are not connected to increase performance.
Understanding the Interface
The interface is designed to be in the same arrangement as the pin configuration of the USB-600x as seen from the picture in the center of the front panel. On the left are the analog ports and on the right the digital ports. On the bottom of the front panel are the program controls. There is a string control for you to enter the device ID of your USB device. In Windows, the device ID can be found in the device list in Measurement and Automation Explorer. On a Macintosh or Linux system, run the lsdaq utility program located in the National Instruments application directory. The activity light blinks to indicate the VI is running, and the Stop button stops the VI.

The analog inputs can be configured for Differential or Referenced Single Ended measurements. You can switch between these two modes by clicking on the tab control that contains the analog voltage indicators. Below the analog input indicators are the analog output controls. Simply enter a number between 0V and 5V and that voltage will be applied to the corresponding pins.
Each digital pin can be an input or output by choosing the corresponding Direction control. The Drive control and the State indicator are Boolean data types describing the digital (TTL) logic level. The State indicator displays the measured logic level on a digital pin when the Direction is set to IN. When the Direction is set to OUT, the State indicator displays the output logic level on the line. The Drive control allows you to manually set the logic level that is outputted on the line when the Direction is set to OUT.
In the NI-DAQmx version, you will see a timing section in the bottom left corner. Use the Max Rate control to set the desired sampling rate of the program. The Current Rate indicator displays the rate at which that the device is actually being sampled. It is a moving average so the displayed number can be read by the human eye. As such Current Rate will appear to ramp up when the maximum rate is changed. The minimum rate is 0.33 Hz. This is done because the program responds to user input once per iteration of the loop, and very slow update rates can result in the interface becoming unresponsive for a very long time. You can use lower rates if necessary by changing the property of the Max Rate control’s Data Entry limits in its properties menu.

The maximum achievable rate is determined by the speed of your computer. You will notice that eventually the Current Rate hits a ceiling, even though the Max Rate is set to be higher. To remedy this, you can disable unused pins on the front panel. A ring control above each of the different pin groups will allow you to select the operational mode of that group. In particular, disabling one or more of the digital ports will drastically increase your maximum attainable sample rate.
Reader Comments | Submit a comment »
How to run this in linux?
Is this a vi that I need labview for ?
How do I get this to run on linux?
- Jul 26, 2009
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
