Learn how LabVIEW can help you control and automate your Agilent 34970A. LabVIEW is an industry-standard graphical programming environment that can be used to quickly and easily acquire, analyze, and present data from the 34970A. NI provides a free LabVIEW instrument driver for the 34970A, which gives you programmatic control over the unit from your PC, while having to do little or no programming yourself. This document introduces the instrument driver and also discusses an alternative hardware option to the 34970A that can add speed and sensor compatibility to your PC-based measurement system, depending on your application.
An instrument driver is a set of software routines that control a programmable instrument. Thousands of instrument drivers, including the driver for the Agilent 34970A, are available for free download from ni.com.Instrument drivers utilize a set of commands provided by the instrument vendor to communicate with the instrument, often through GPIB, Serial, Ethernet, or USB. Each routine that composes the driver corresponds to a programmatic operation such as configuring, reading from, writing to, or triggering the instrument. Instrument drivers simplify control and reduce test program development time by eliminating the need to learn the unique programming and communication protocol for the instrument.LabVIEW itself is a graphical development environment for creating flexible and scalable test, measurement, and control applications rapidly and at a minimal cost. Unlike other programming environments, all programming in LabVIEW is done graphically through intuitive flowchart-style coding and functional blocks. Hundreds of functional blocks for analysis, signal processing, and mathematics are built-in to the environment, making LabVIEW a smart choice for manipulating raw data collected with the 34970A. With LabVIEW, application development is fast and easy for all users, regardless of experience.The LabVIEW instrument driver for the 34970A features six ready-to-run example programs. Of course, using the ready-to-run examples requires no LabVIEW coding. The driver also includes a full set of functional building blocks that can be used to create a completely custom 34970A application in LabVIEW.
The most straightforward way to take advantage of the LabVIEW instrument driver is to run the example programs, which require only basic user configuration. Figure 1 shows the graphical user interface of one of the 34970A example programs, used to control the 34904A matrix switch module. To run this example, the user first sets the GPIB or serial communication parameters. Then, with the example running, the user can toggle any LED in the array to open or close a matrix cross point on the 34904A module.
Figure 1. User interface for 34970A Matrix Switch Example.
Six such ready-to-run examples are provided by NI in the driver. These are:
EZ Scan Example: Demonstrates basic current and frequency measurements on a multiplexer module
Advanced Scan Example. Demonstrates voltage and resistance measurements on a multiplexer module, and shows how to create a single scan list with multiple types of readings.
Switch Example. Demonstrates switching with the 34901A and 34903A modules, and toggles cross points with an LED matrix interface.
Matrix Switch Example. Demonstrates matrix switching on the 34904A. (The user interface for this example is the one pictured in Figure 1.)
RF Mux Example. Demonstrates RF switching on the 34905A and 34906A.
Multifunction Example. Demonstrates use of the 34907A module, with capabilities for controlling analog output, counter (totalizer), and digital input/output channels.
Though all of these examples are intended to serve as a starting point for the creation of a custom application, they may be used without modification to immediately control the Agilent 34970A.
When you wish to extend the capabilities of the examples or wish to start a new custom application, the set of LabVIEW functions installed with the instrument driver provides all the building blocks you will need. In LabVIEW, each of these programmatic building blocks is called a virtual instrument, commonly referred to as a VI. Any custom LabVIEW application you create will be composed of a front panel, which is the graphical user interface, and a block diagram, which is the flow chart-style code created with these functional blocks (VIs).Creating a custom 34970A application in LabVIEW does require a basic familiarity with LabVIEW’s graphical programming. For resources that outline the fundamentals of this industry-standard development environment, please refer to the links at the end of this section.When the LabVIEW instrument driver for the 34970A is installed, palettes containing high-, mid-, and low-level instrument driver VIs are made available to you in LabVIEW. Each palette represents a distinct category of instrument driver functions for programming the 34970A. Two instrument driver palettes are shown below, in Figure 2.
Figure 2. Two of the palettes installed with the 34970A LabVIEW instrument driver.
Use the instrument driver VIs to define your custom application. In Figure 3, we show the block diagram of a sample application created with these VIs. This application initializes communication with the 34970A, takes 10 voltage readings from each channel in the scan list, and finally ends communication and checks for errors. It displays the acquired data on a front panel indicator (not pictured).
A significant advantage of customizing your LabVIEW application is that it enables you to combine the unique functions of the instrument driver with the standard functions built-in to LabVIEW. With these, you can quickly and easily take your application far beyond merely programming the instrument to create a completely user-defined solution.Let’s suppose, for instance, that after acquiring data in the example above, we wished to detect the peak values in the data set and log those to file. Since peak detection is one of the analysis functions available in LabVIEW, we can easily add that functionality to our application. LabVIEW can also be used to interface with a data management system, whether that consists of a simple spreadsheet file or a relational database. The block diagram in Figure 4 extends the functionality of our previously created code to discover the peaks of the dataset and then log those values to a tab-delimited text file compatible with Excel.
Figure 4. Sample Code Showing Peak Detection and Saving to File.
Because creating crisp graphical user interfaces in LabVIEW is easy, we could have also chosen to visualize the data in a chart or graph. We could have even posted the application’s user interface to a web page for remote monitoring and control, using the built-in LabVIEW web server. For information on the features available in LabVIEW, or to immediately test drive LabVIEW free online, please refer to the links below.
As outlined above, using the 34970A with a LabVIEW instrument driver creates a useful PC-based virtual instrumentation system for acquiring, analyzing, and presenting test data. If you are looking for an easy way to increase the speed, sensor support, and channel count of your test and measurement system then you may want to consider adding NI CompactDAQ hardware to your setup. The ease of use and flexibility of LabVIEW programming will seamlessly integrate the NI CompactDAQ platform with your 34970A hardware. The built-in USB connectivity of NI CompactDAQ makes it a simple and portable addition to your system, while also providing higher acquisition rates and the bandwidth needed to add dynamic signal measurements to your LabVIEW programs. Figure 5 below shows how one additional VI in your LabVIEW program can incorporate NI CompactDAQ data, including measurements from microphone, accelerometer, and strain gauge sensors.
Figure 5. Showing the Simplicity of Adding NI CompactDAQ to Existing Programs.
The NI CompactDAQ platform is an excellent hardware option to consider when adding to or creating a user-defined, PC-based data logging or bench top automated test system. NI CompactDAQ combines USB device detection, built-in signal conditioning, direct sensor and signal connectivity, hot-swappable modules, and automatic module configuration to make a simple, complete, cost-effective data acquisition system all in one small platform. Figure 6 below shows the NI CompactDAQ platform along with an example of an individual module. The NI cDAQ-9172 is an 8-slot chassis that accepts hot-swappable, autodetectable I/O modules capable of directly connecting to a broad range of analog and digital I/O signals. Rates up to 400 kS/s per module (3.2 MS/s per chassis) are achievable through Hi-Speed USB plug-and-play connectivity to PC’s, and the NI CompactDAQ platform can provide up to 24-bit resolution and 256 channels per chassis. Setting up the hardware to achieve these high rates, resolutions, and channel counts has never been easier or quicker. With the time-saving features that the NI-DAQmx API provides, such as LabVIEW code generation and test panels, you can quickly begin logging and analyzing your measurements.
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.