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

Migrating to Ethernet

Preserve code written for IEEE 488 instruments when you transfer to a new bus.

Brian Powell and Dany Cheij, National Instruments, Austin, TX -- Test & Measurement World, 10/1/2004

IEEE 488 and RS-232 ports have sustained instrument communications for many years. But RS-232 is too slow for many test applications, and IEEE 488—although it is robust and has sufficient speed—requires the use of add-on cards.

Ethernet and USB high-speed serial ports are emerging as new buses for instrument applications. These ports are standard peripherals on new PCs, and they are also starting to appear in test instruments from some manufacturers.

Using Ethernet and USB high-speed ports is fairly easy. Because of their supporting software infrastructure, you can use them without understanding their low-level drivers and function calls. Yet, there is a minor complication. Ethernet and USB were designed for communication between PCs and peripherals such as printers, cable modems, and external drives, but not for communication between PCs and instruments. When used for instrument control, these buses must handle interrupts and other instrument functions through software that the parallel IEEE 488 bus handles through hardware.

You can set up instrument-control functions for Ethernet and USB by employing the Virtual Instrument Software Architecture (VISA), which was first designed as a VXI tool. In the mid-1990s, the VXIplug&play Systems Alliance developed the VISA application programming interface (API) for instrument control and communication through IEEE 488 and RS-232, and it has become the industry standard for programming instruments over those two ports.

Generally, VXIplug&play instrument drivers send commands to the buses through VISA, although some test applications bypass instrument drivers and communicate directly to VISA. VISA then communicates with low-level drivers such as those for IEEE 488 interface cards, serial ports, TCP/IP stacks, and USB.

After adopting VISA, the VXIplug&play Alliance expanded it to cover Ethernet-based instruments. The VXI-11 standard enhanced VISA by standardizing both the low-level TCP/IP communications protocol and the higher-level APIs (Ref. 1). In 2003, Agilent Technologies and National Instruments enhanced their versions of VISA to provide communications to instruments over USB using the same API (Ref. 2).

Higher level

Instruments generate interrupts when they have data to send to a PC, and PCs issue abort commands to terminate measurements. IEEE 488 uses hardware signals to generate and service interrupts, but Ethernet and USB are serial buses—they lack IEEE 488's dedicated interrupt lines. VXI-11 defines how VISA implements these functions over Ethernet and USB. (For the remainder of this article, we won't mention USB, but you can use the same VISA API with that bus.)

 
 Figure 1. VXI-11 defines TCP-IP connection channels between a computer and an instrument.

Figure 1
shows the three TCP/IP communication channels in VXI-11. The core channel passes messages between the PC (the controller) and the instrument. Just as with IEEE 488, you can send a "*IDN?" query to an instrument and read a response containing its identification string. The Abort channel lets the controller stop an active operation. The instrument uses the Interrupt channel to request service from the PC.

Simple operations such as polling an instrument for a measurement may never use the Abort and Interrupt channels, but you need them for robust behavior. Dedicated hardware lines in the IEEE 488 bus let instruments interrupt communications and request service. With VXI-11, software must emulate interrupts, aborts, and triggers that IEEE 488 implements with hardware.

Suppose you set up a triggered waveform acquisition on a scope. The controller requests the waveform from the scope and then realizes that the trigger is set up incorrectly. You now need to abort the request for the waveform.

In this case, a computer sends a message over the Abort channel to tell the instrument to cancel the pending request. In another scenario, you could set up a waveform acquisition and ask the instrument to send a notification on the Interrupt channel when the data becomes available. VXI-11 supports both methods of programming.

Under the hood

To communicate with instruments over TCP/IP, VXI-11 uses an open networking standard called Remote Procedure Calls (RPC). RPC standardizes how TCP/IP establishes the three connection channels. An additional standard, eXternal Data Representation (XDR), defines how data is formatted when transmitted between the PC and the instrument.

When a PC wants to write a command such as "*IDN?" to an Ethernet-based instrument that supports VXI-11, it connects to the instrument and asks it to run a TCP/IP "device_write" procedure with a parameter that says "*IDN?". VXI-11 devices implement a handful of these remote procedures, most of which are familiar to IEEE 488 users. They include Write, Read, Trigger, Clear, Read Status Byte, and Enable Service Request. If your instrument doesn't support VXI-11, then it either uses low-level TCP/IP commands or implements its own protocol.

Because VXI-11 is based on RPC, and RPC is based on TCP/IP, you can make direct calls from your applications program to a TCP/IP stack, but you need to understand how RPC and XDR work. Such knowledge must include familiarity with all the opcodes and data structures for calling the remote procedures. Figure 2 shows the number of low-level TCP/IP packets you need for a simple instrument query. This example (created in LabView) needs several TCP/IP packets to open the RPC connections for the Core and Abort channels. Once the channels are open, communications are rather efficient.

 
 Figure 2. A simple write-read sequence requires 31 TCP/IP packets.

Standard API

As mentioned earlier, VISA is the standard API for communicating with VXI-11 devices. VISA lets users focus on Writes and Reads without having to worry about remote procedure calls and TCP/IP networking. In addition, VISA isolates the program from the bus an instrument uses (IEEE 488, RS-232, Ethernet, or USB).

In Figure 2, only the resource descriptor (TCPIP::10.0.41.6::INSTR) is unique to TCP/IP communications. The program passes it to the "VISA Open" function to select the communications port. If the program were using IEEE 488 instead, you'd simply substitute a resource descriptor such as "GPIB::22::INSTR" and the rest of the application would continue to work.

 
A host and instrument must establish an RPC connection to transfer data.
Although you can communicate with an Ethernet-based instrument using low-level TCP/IP commands, you'll find it challenging. Protocols such as VXI-11 simplify communications and shield you from the intricacies of the bus. By using an API such as VISA, you can focus on measurements instead of spending time learning networking protocols.

The convenience of having a bus-independent API such as VISA becomes more apparent through instrument drivers. Instrument drivers are a set of software routines that control a programmable instrument. They simplify instrument control because they aggregate multiple low-level VISA commands into high-level routines such as "Initialize" or "Read." An instrument driver based on the VISA API can support both IEEE 488 and Ethernet (VXI-11) interfaces. This lets you write the same application program to communicate with the instrument through either bus.


Author Information
Brian Powell holds a BA from the University of Texas at Austin. He joined National Instruments in 1988 and is currently a senior group manager in LabView R&D.
Dany Cheij holds a BS in mechanical engineering from MIT and an MS in engineering and policy from Carnegie Mellon University. He joined National Instruments as an applications engineer in 1998 and is currently the instrument control product manager.


References
  1. VXI-11 is a standard for any Ethernet-based instrument, not just those with a VXI form factor. It's called VXI-11 because the companies interested in developing the standard were part of the VXIplug&play Systems Alliance. www.vxipnp.org.
  2. Rowe, Martin, "Map the route to USB Instruments," Test & Measurement World, May 2003. p. 41. www.tmworld.com/archives.
  • 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

      November 5, 2008
      Technical articles retain value
      I'm always amazed, and pleased, when I hear from readers who still find value in old T&MW articl...
      More
    • Martin Rowe
      Rowe's and Columns

      October 31, 2008
      Measurement proverbs
      The other day, I received some measurement proverbs that I'd like to share. The proverbs come from K...
      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