Qia's LabVIEW Station Virry Test & Control

We talk about LabVIEW and HVAC

Using the Agilent 34970A with LabVIEW

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. National Instruments 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 considerations that may make PC-based measurement devices an attractive alternative to the 34970A, depending on your application.

Table of Contents:
        Introduction to the 34970A Instrument Driver

      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 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.
          See Also:
          Instrument Driver Network
          LabVIEW Driver for Agilent 34970A
          LabVIEW Guided Tour
            Using the Instrument Driver Examples 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 National Instruments 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.
                Creating Custom 34970 LabVIEW Applications

              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 provide 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).

              Figure 3. Sample code created with instrument driver functions.

              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.

              posted on 2005-04-22 23:31  LabVIEW开发者  阅读(2262)  评论(0编辑  收藏  举报

              导航