Global TMW:
Login  |  Register          Free Newsletter Subscription
Subscribe
Email
Print
Reprint
Learn RSS

IVI drivers: Slower but simpler

Interchangeable virtual instrument drivers relieve you from instrument and bus dependency, but they run slower than direct I/O.

Andrea Clary, Keithley Instruments, Cleveland, OH -- Test & Measurement World, 2/1/2003

listing 1
The road to interchangeable instruments
SCPI vs. IVI speed study

If you've ever replaced an instrument in a test rack with a new or competitive model, you've probably run into programming problems caused by differences in command sets. Similarly, if you've ever wanted to replace an IEEE 488 interface card with a competitor's IEEE 488 card, you found that you needed to rewrite your application code because each card uses different commands. Interchangeable Virtual Instrument (IVI) drivers promise to eliminate those frustrations through a consistent programming interface.

Now that IVI drivers are becoming available, they should make programming and instrument-swapping easier, as they provide a set of standard commands for a given class of instruments. Currently, the IVI Foundation (Ref. 1) has defined instrument classes for oscilloscopes, DMMs, function generators, DC power supplies, switches, power meters, RF signal generators, and spectrum analyzers. (See "The road to interchangeable instruments ," below, for the history of instrument programming that led to IVI drivers.)

In most applications, test engineers can use IVI drivers to control IEEE 488-based instruments in automated test stands. You can get IVI drivers from software suppliers or from instrument makers IVI drivers, built on the VXIplug&play framework (Ref. 2), circumvent low-level programming details through intuitive function calls such as "Configure Measurement" or "Read Waveform." From those function calls, IVI drivers communicate with a Virtual Instrument Software Architecture (VISA) driver. The VISA driver ensures compatibility among I/O buses—IEEE 488, VXI, RS-232, and Ethernet.

IVI drivers communicate with the VISA layer just as VXIplug&play drivers do. IVI drivers add measurement functions that you won't find in VXIplug&play drivers. The functions provide features such as state management, simulation, range checking, status query, and real-number arrays:

  • State management keeps track of an instrument's state, which reduces redundancy in sending setup commands. Suppose you use the "Configure Measurement" command to set a DMM for two-wire ohms measurements. A subsequent command that also indicates the use of the two-wire ohms function won't resend the configuration command. With VXIplug&play drivers or with direct calls to an IEEE 488 card, you'll unnecessarily resend configuration commands to the instrument. Sending configuration commands when your instrument is already properly configured wastes bus resources and slows tests.
  • Simulation lets you develop application code without having an instrument. That cuts test-system development time because you can begin programming while waiting for a new instrument to arrive from the manufacturer. When simulating a measurement, an IVI driver returns a random number as the data in the instrument's selected range and function.
  • Range checking compares a requested value against a table of legal values for a specified range. You could use range checking to verify the instrument's measurement speed or digits of resolution. You'll get an error if you try to program a 6.5-digit DMM for 7.5 digits.
  • Status query lets you check an instrument's status. You'll find status queries useful for uncovering coding problems during test-program development. Once you've debugged your code, you should turn off this feature to increase execution speed.
  • Real-number arrays eliminate the need to parse comma-delimited ASCII strings. Without IVI drivers, your programming language doesn't provide high-level functions for string-to-numeric conversion, so you may need to build string-parsing routines.
IVI mechanics

Figure 1 IVI drivers sit atop the VISA I/O layer, providing bus-independent instrument programming.

IVI drivers consist of two parts—a class driver and an instrument-specific driver (Figure 1). Class drivers contain function calls consistent across all instruments in an instrument class. Thus, an IVI DMM class driver will use the same function calls whether you use a Keithley 2000, an Agilent 34401A, or a Fluke 8840. You can assign names to specific resources in a test system. In Figure 2, I've assigned the name "DMM1" to an HP (Agilent) 34401A DMM. In this application, I just had to assign the instrument, its bus, and its bus address to the name DMM1. If you use an IVI driver and you change your DMM to another one that has an IVI driver, you just reassign DMM1 and install the new driver. Your application code will then control the replacement meter.

You invoke an IVI driver by making function calls from the test-application program. With the code in Listing 1, you can use any DMM that has an IVI driver, supports 4.5 digits, and has an autoranging VDC feature. In the instrument configuration, you assign the logical name such as "DMM1" to a specific instrument.

What's the catch?

You may find disadvantages to using IVI drivers that include a learning curve, possible bugs, and slower execution speed. IVI drivers cause programs to run slower than if you use standard commands for programmable instruments (SCPI) commands (Ref. 3) sent directly to an IEEE 488 card's I/O driver. "SCPI vs. IVI speed study ," below, provides some benchmark test results.

Figure 2 Using a configuration panel, you can assign names to instruments. Here, the name DMM1 belongs to 34401A.

Function calls use a completely different programming syntax from SCPI, so learning how to program through IVI drivers will take some effort. Because many instrument manuals provide only the SCPI command syntax, if you want to use an IVI driver, you may have to get the driver's programming details from the driver supplier. See "For more information" at the end of this article for sources of information on how to use IVI drivers.

Watch out for bugs

If you don't understand all the subtleties of an instrument's functions and controls, you could easily introduce bugs to IVI drivers. The bugs might not appear while running simple tasks such as configuring measurements, setting triggers, and collecting a single measurement value, but more advanced functions such as multiple measurements could uncover driver bugs.

For example, National Instruments provides IVI drivers for both the Keithley 2000 and Agilent 34401A. Your application code should work equally well with both instruments, making them completely interchangeable. At Keithley, we tested the drivers by taking multiple measurements with programs written in Visual Basic 6 and in LabView 6. Both programs worked perfectly with the 34401A, but both produced an error with the 2000. The IVI driver caused the error because its developer didn't account for buffering differences between the DMMs.

In contrast to the 34401A, the 2000 uses two different buffers to store readings: scratch buffer and trace buffer. The trace buffer lets you perform complex handshaking that includes limit testing, asserting the IEEE 488 bus' SRQ line, and coordinating measurement timing with external trigger signals. When you don't need this complexity, you can use the scratch buffer.

We used the NI-Spy utility to reveal that the driver was attempting to use the 2000's trace buffer but didn't set it up properly. Hence, the multipoint measurements produced a bus error. Apparently, the driver developer was unaware of instrument-specific details.

No IVI driver?

Not every instrument in production today (and certainly very few older instruments) will have IVI drivers. If you're a test-application developer or system integrator, you should probably refrain from writing your own IVI drivers for instruments that don't already have one unless you see an opportunity to market your driver.

I recommend that if you have an IVI driver, use it. If not, then you're better off not trying to write one. You can, for instance, develop an application program that communicates directly with the VISA DLL or you can write code to control an IEEE 488 instrument by sending SCPI commands directly to an interface card's driver.

For more information

"Using IVI Drivers to Build Hardware-Independent Test Systems with LabView and LabWindows/CVI," Application note 121, National Instruments, Austin, TX. www.ni.com.

"Using IVI Drivers to Simulate Your Instrumentation Hardware in LabView and LabWindows/CVI," Application note 120, National Instruments, Austin, TX. www.ni.com.

"Improving Test Performance through Instrument Driver State Management," National Instruments, Austin, TX. www.ni.com.


Author Information
Andrea Clary is a lead applications engineer at Keithley Instruments, where she handles Web-based customer support. She has worked with computer-based data acquisition for 15 years. Andrea holds an MS in biomedical engineering from Case Western Reserve University. E-mail: aclary@keithley.com.


References
  1. IVI foundation, www.ivifoundation.org .
  2. VXIplug&play Systems Alliance, www.vxipnp.org .
  3. SCPI Consortium, www.scpiconsortium.org .
 

listing 1

'Initialize the driver and instrument (if successful, a session handle is returned that is used by all subsequent commands).
IviDmm_Init("DMM1",VI_True, VI_True, sesn)
'Configure the instrument to measure VDC at 4.5 digits of resolution with auto ranging.
IviDmm_ConfigureMeasurement(
sesn,IVIDMM_VAL_DC_VOLTS, _
IVIDMM_VAL_AUTO_RANGE_ON, _
IVIDMM_VAL_4_5_DIGITS)
'Take one measurement.
IviDmm_Read(sesn, TIMEOUT_Duration, reading(0))

The road to interchangeable instruments

Starting in the 1970s, instruments used device-dependent commands (DDCs) to provide computer control. Early instrument products with an IEEE 488 or an RS-232 port might have similar programming syntax, and a typical command might look something like F2R0S1. In this syntax, the "F" controlled the instrument's measurement function (F0 = VDC, F1 = VAC, F2 = two-wire ohms, etc.), the "R" controlled the ranging function (R0 = auto range, R1 = first range, etc.), and the "S" controlled sample rate.

In different instruments, these commands might have similar functions but produce different results. For example, F0 might control the VDC function for a digital multimeter but could control something entirely different for another type of instrument, or even for a different model of DMM.

In the early 1990s, a group of instrument manufacturers developed the standard commands for programmable instrumentation (SCPI), a defined set of commands for controlling instruments. The commands use ASCII characters so you can send them over any bus. SCPI commands brought some order to the chaos of instrument commands. A SCPI replacement for the DDC F2R0S1 command example might look like this:

:FUNC "VOLT:DC"
:SENS:VOLT:RANGE:AUTO ON
:SENS:VOLT:NPLC 1.0

In 1993, the VXIplug&play Systems Alliance carried SCPI a step further. The alliance created specifications for VXI plug&play drivers, which control VXI instruments and can also control box instruments over IEEE 488, RS-232, or Ethernet.

Because VXIplug&play drivers use the virtual instrument software architecture (VISA) layer that resides below the instrument-driver layer, they made programming VXI instruments the same as programming on other communications buses. The VISA layer converts commands from higher-layer drivers into commands for a specific I/O controller such as an IEEE 488 interface card. Each IEEE 488 card maker uses a unique set of commands, but the VISA layer hides them from you.

With the VISA layer, you can use the same application program to control a DMM over the IEEE 488 bus or through the DMM's RS-232 interface (if the meter has both ports). Each bus/instrument combination has a unique Resource Name, such as GPIB0::24::INSTR (an instrument at address 24 on a IEEE 488 bus) or ASRL1::INSTR (an instrument on COM1). You just need to change the resource name and the same code will work on either bus.

VXIplug&play drivers don't provide a common programming interface for a class of instruments, so programming a Keithley 2000 will differ from programming an Agilent 34401A. Because IVI drivers do provide a common programming interface, they make it easier to write application code.

SCPI vs. IVI speed study

At Keithley Instruments, we used two programs to compare the speed of controlling an instrument with an IVI driver to the speed of controlling it with SCPI commands. We conducted the test with an Agilent 34401A DMM.

We applied a DC voltage to the instrument. Both programs first sent a reset command (*RST) to the DMM, which puts the meter into VDC mode with auto ranging. Then, the programs configured the instrument to make 20 measurements. Next, the programs issued a :READ? command, which told the meter to acquire the data and send it to the computer.

After completing the measurements, the programs set the instrument to measure two-wire ohms at 0.02 NPLC (number of power line cycles required for ADC integration) with the same number of samples. Again, both programs started the measurements with a :READ? command. We used the Windows kernel function QueryPerformanceCounter to get the start time and the end time of the test.

As the data in the table shows, instrument control with SCPI commands was at least 200 ms faster than with the IVI driver. The measurement time was also more consistent for each of the four trials. The table also shows the benefits of using the IVI driver's state cache. When we disabled the state cache, the test time increased by 70 ms.

Benchmark speed test of SCPI vs. IVI driver for simple instrument measurements in which commands and data are sent over the IEEE 488 bus
Time to complete (s)
Trial No.IEEE-488/SCPIIVI driver, state cache = ONIVI driver, state cache = OFF
16.9827.2197.294
26.9827.2197.294
36.9817.5107.601
46.9827.5277.568

Email
Print
Reprint
Learn RSS

Talkback

We would love your feedback!

Post a comment

» VIEW ALL TALKBACK THREADS

Related Content

Related Content

 

By This Author

There are no other articles written by this author.

Sponsored Links



 
Advertisement
SPONSORED LINKS

More Content

  • Blogs
  • Podcasts

Blogs

  • Martin Rowe
    Rowe's and Columns

    July 8, 2008
    Introducing...Test ideas
    Beginning in the T&MW August print issue, we’ll replace the “Project Profile” ...
    More
  • Martin Rowe
    Rowe's and Columns

    July 8, 2008
    They finally figured it out
    I just received a press release from one of those companies that analyzes industries. This one is ab...
    More
  • » VIEW ALL BLOGS RSS

Podcasts

Advertisements





NEWSLETTERS

Click on a title below to learn more.

Test Industry News (3 Times Per Month)
Machine-Vision & Inspection (Monthly)
Communications Test (Monthly)
Design, Test & Yield (Monthly)
Automotive, Aerospace & Defense (Monthly)
Instrumentation (Monthly)
Resource Center E-Alert (Monthly)
©2008 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy
Please visit these other Reed Business sites