Developing Distributed GPIB Test Systems Using GPIB-ENET/100 and Existing Ethernet Networks
Overview
This application note serves as a general introduction for implementing distributed test applications using the GPIB-ENET/100 TCP/IP Ethernet-to-GPIB controller. It offers three example applications in source code to help you get started developing your own distributed test applications.
Authors: James Humphrey, Vijay Malhotra, Vanessa Trujillo, Brian Neidig
Table of Contents
Introduction
The GPIB-ENET/100 TCP/IP Ethernet-to-GPIB controller expands the scope of computer-controlled test applications through the use of networks. Assembling the components of your test application through a network addresses factors such as size, distance, environmental conditions, integration of test systems, and instrumentation located in different areas of your company, as well as the sharing of instrumentation resources.Computer networks are standard mechanisms for sharing resources, exchanging information, or archiving data for later use. Using these networks, you can expand the functionality of your distributed test systems to serve a variety of needs, including timely dissemination of critical test information. By using a server application that manages remote access to your test system, you can provide key decision makers, operators, technicians, and developers easy access for maintenance, development, control, and monitoring. Distributed test and measurement applications continue to grow in popularity as the applicable networking technology continues to drop in cost and evolve as a standard component in every corporate computing environment.
This application note serves as a general introduction for implementing distributed test applications using the GPIB-ENET/100 TCP/IP Ethernet-to-GPIB controller. It offers three example applications in source code to help you get started developing your own distributed test applications.
Using the GPIB-ENET/100 for Instrument Control
The GPIB-ENET/100 and NI-488.2™ software convert a computer equipped with an Ethernet port into a GPIB Talker/Listener/Controller. The GPIB-ENET/100 delivers the same GPIB controller capability as a plug-in board, but across an Ethernet link. NI-488.2 software performs all the necessary GPIB-to-Ethernet conversions to send information across the Ethernet link; the GPIB-ENET/100 performs all necessary Ethernet-to-GPIB conversions to communicate to your GPIB instruments. The GPIB-ENET/100 offers a flexible, cost-effective solution for sharing instrumentation resources or creating expandable distributed test applications.
Applications
Applications for the GPIB-ENET/100 include:
• Controlling multiple racks of instrumentation from a single computer
• Controlling instrumentation in a hazardous environment
• Integrating two or more GPIB systems separated by distances greater than 4 m
• Sharing access to GPIB instruments and systems so several users can download test data, or conduct tests from several computer stations.
Cabling
The GPIB-ENET/100 can be interfaced directly to twisted pair 10BaseT or 100BaseTX networks. It automatically detects the type of network and runs at the highest available speed. It is also possible to connect the GPIB-ENET/100 directly to the network port of a computer (without going through a network hub) by using a crossover cable instead of the standard twisted pair cable. In addition, you could also connect the GPIB-ENET/100 to a different type of network by adding the appropriate converter to the setup. For example, for a 10Base2 or coax network, you need to connect a coax-to-twisted pair converter in between the GPIB-ENET/100 and the network.
Performance
Typical sustained throughput of data is more than 800 kbytes/s – performance comparable to GPIB plug-in boards. Actual data rates may vary depending on your network configuration and the amount of network traffic.
Application Development Tools
You develop applications for the GPIB-ENET/100 using the same NI-488 functions and NI-488.2-style functions you would use to program a PCI-GPIB, AT-GPIB/TNT, or PCMCIA-GPIB interface. NI-488.2 frees you from writing low-level TCP/IP code to access the GPIB-ENET/100. Furthermore, existing GPIB applications written with the NI-488.2 API can be used with the GPIB-ENET/100 with little or no source code modification.
In addition, NI-488.2 includes installation and troubleshooting wizards, as well as complete debugging tools to help you get up and running as soon as possible with your application. Our LabVIEW and Measurement Studio application software products contain a fully integrated library of NI-488.2 functions for instrument control, as well as easy-to-use tools for data analysis, data formatting, data presentation, and data management. You can create your complete application, including the control of other type of instrumentation, from within one development environment.
Remote Access Using the Internet
By combining our application development environments with NI-488.2, you can monitor and control your distributed GPIB test system. You can view front panels and control your complete instrumentation though the Internet. Figure 2 illustrates how our development environments can be used in conjunction with the GPIB-ENET/100 to construct a distributed measurement system that can be accessed via remote computers running a simple Web browser. For more information on developing applications accessible via the Internet, contact National Instruments and ask about the Internet capabilities of LabVIEW and Measurement Studio.
Configuring Your GPIB-ENET/100
The GPIB-ENET/100 hardware and NI-488.2 software must be correctly installed and configured before any GPIB applications can be developed. This section offers a roadmap for configuring a GPIB-ENET/100 for operation. Refer to the GPIB-ENET/100 Getting Started manual (shipped with the product) for platform specific installation instructions. In general, setting up a GPIB-ENET/100 distributed test system is easy because the Ethernet network is already in place. All that remains is to add the GPIB-ENET/100 as a device on the Ethernet:
1. Install NI-488.2 software on each computer that will be used to control a GPIB-ENET/100.
2. Use the utilities included with the driver software to configure each individual GPIB-ENET/100 with a unique IP address (this step has to be performed only once per GPIB-ENET/100 interface and can be done manually or
automatically).
3. Configure the software on each controlling computer with the IP addresses of the GPIB-ENET/100(s) (configured in Step 2 above) that it will control.
NI-488.2 for the GPIB-ENET/100
Table 1 summarizes the operating systems under which you can use the GPIB-ENET/100. The maximum number of GPIB-ENET/100s is expandable under the Unix platforms. Contact National Instruments if you need to control more than the specified number. The NI-488.2 API used to program your GPIB-ENET/100 is consistent across these platforms as well as other interfaces, such as the PCI-GPIB or PCMCIA-GPIB. You can develop your software and use it with other interface types and other applicable operating systems with little or no source code modification.
Table 1. Maximum Number of GPIB-ENET/100 Interfaces
Operating System | Maximum Number of GPIB-ENET/100s Controlled by a Particular Computer |
Windows 2000/XP/Me/9x Mandrakelinux Red Hat Enterprise Linux WS SUSE LINUX Professional Mac OS X | 100 |
Windows NT | 32 |
Mac OS Classic | 8 |
Sun Solaris Digital (Tru64) Unix HP-UX | 8 (User Expandable to 128) |
Assigning an IP Address to Your GPIB-ENET/100
The primary task in configuring your GPIB-ENET/100 is assigning it an IP address. The TCP/IP protocol requires that each device on the network be assigned a unique Internet address so that the devices can be located on the network. An invalid or improperly assigned IP address is the most common cause for problems when using the GPIB-ENET/100.
There are two ways to assign an IP address. You can manually configure the IP address using a simple configuration utility provided with the GPIB-ENET/100; or you can use the Dynamic Host Configuration Protocol (DHCP) provided by your network to automatically assign the GPIB-ENET/100 an IP address. Contact your network administrator to verify that your network has DHCP available. By default, the GPIB-ENET/100 will try to get an IP address using DHCP. If DHCP is available, you are ready to configure your unit and write your application. With DHCP, some servers also assign a name to the GPIB-ENET/100. You can modify that name later and use it instead of the IP address, when referring to the GPIB-ENET/100. If DHCP is not available, LEDs in the GPIB-ENET/100 will so indicate and you will have to assign it a static IP address. Contact your network administrator to obtain a valid IP address for your network.
Each applicable platform has specific instructions for proper GPIB-ENET/100 installation. For example, configuration under Sun workstations is accomplished differently when compared to Windows platforms because of differences in the operating system interface. Be sure to follow the complete instructions outlined in the Getting Started manual for complete, correct installation.
Configuring NI-488.2 Software for GPIB-ENET/100
Once you have manually or automatically assigned an IP address to your GPIB-ENET/100 and connected it to your network, any computer with the NI-488.2 for GPIB-ENET/100 software can interface with the controller.
A single computer can be set up to control several GPIB-ENET/100s for integrating multiple test systems into one application. You can also configure any number of computers to control a single GPIB-ENET/100 for sharing access to instrumentation.
On each computer, you must configure NI-488.2 to associate a particular IP address with a particular interface name that corresponds to a GPIB-ENET/100. Then, you can use that interface name in your programs to control the GPIB-ENET/100 at that IP address. For example, assume you want to use Computer A to control two GPIB-ENET/100s, one at IP address 130.164.15.01 and the other at 130.164.15.19. On Computer A, you would associate 130.164.15.01 with interface name GPIB0, and 130.164.15.19 with GPIB1. Your applications on Computer A would then use the interface name GPIB0 to control instruments attached to the GPIB-ENET/100 at IP address 130.164.15.01 and GPIB1 to control instruments attached to the GPIB-ENET/100 at IP address 130.164.15.19. Remember that you can refer to the GPIB-ENET/100 by its assigned name instead of its IP address.
Suppose you also wanted to access the GPIB-ENET/100 at 130.164.15.01 from Computer B. You would then associate GPIB0 on computer B with 130.164.15.01, and use GPIB0 in your applications on Computer B. There is no conflict in using the same interface name GPIB0 on Computer A and Computer B because these are completely separate host computers running different instances of NI-488.2. Application Example 3 provides details on how to write programs that cooperatively share a given GPIB-ENET/100 among several computers.
Application Example 1
Controlling Several Instruments from a Single Computer

[+] Enlarge Image
Figure 3. A Networked Computer Using a Single GPIB-ENET/100 to Control a Remote Set of GPIB Instruments
For our first example, consider the situation detailed in Figure 3, in which we wish to control two GPIB devices in a manufacturing facility from a Windows XP workstation in the corporate office. The devices are a multimeter at primary address 2 and an oscilloscope at primary address 21.
The following code can be used to gather information from the two instruments using a C programming environment. This code assumes that we have configured the driver to associate the interface name GPIB0 with the IP address of the GPIB-ENET/100 connected to the two instruments. All C applications that call NI-488.2 must include a header file and must link in an object. For this example, we will suppose that we are on the Windows XP platform. So, we must include ni488.h located in subdirectories of the install directory. Lastly, for the code below to work with the XP driver, the 32-bit object file Gpib-32.obj must be linked into the project. For more details on using the language interface files specific to your platform, see the documentation included with your NI-488.2.
Distributed GPIB-ENET/100 Sample 1
Remember that this code will work on any GPIB-ENET/100-compatible platform, not just Windows XP. The only change needed when porting this code is possibly which header file to include and which object file to link in. Note also that this code is written so that it can be expanded upon in the example applications to follow.
Application Example 2
Integrating Two or More GPIB Test Systems into a Single Application

[+] Enlarge Image
Figure 4. A Networked Computer and GPIB-ENET/100 Interfaces Control Scattered Sets of Instruments
For our second example, consider the situation detailed in Figure 4, in which we wish to control four GPIB devices, two in a laboratory at the corporate offices, and two in a remote manufacturing facility. They all will be controlled by a computer running Windows Me in the corporate office. The devices are a multimeter at primary address 2, an oscilloscope at primary address 21, a function generator at address 5, and a network analyzer at address 2.
The following code can be used to gather information from the four instruments using a C programming environment. This code assumes that we have configured the driver to associate the interface name GPIB0 with the IP address of the GPIB-ENET/100(1) and GPIB1 with the IP address of the GPIB-ENET/100(2) and that the driver has been installed on a Windows Me workstation. For the Windows Me platform, one must include the header file ni488.h in the program code. Also, the 32-bit object file Gpib-32.obj must be included with the project in order to link to the GPIB function calls used.
Distributed GPIB-ENET/100 Sample 2
Application Example 3
Sharing Instrument Resources Between Several Users
For our third example, consider the situation detailed in Figure 5, in which two workstations located in different facilities need access to the same set of GPIB instruments – an oscilloscope at primary address 21 and a multimeter at primary address 2. For this example, we tackle the case where a GPIB-ENET/100 is controlled by two or more computers.
No special configuration is performed on the GPIB-ENET/100 for more than one computer to use it. Any computer with the GPIB-ENET/100 driver and a network connection can send commands to a particular GPIB-ENET/100. If the GPIB-ENET/100 is working on a command from one computer when a second command from another computer arrives, the second command is queued and executed after the first command is completed. With that procedure, commands may be delayed slightly, but the operation is otherwise transparent to several programs accessing the same GPIB-ENET/100.
It is possible, however, for one computer to lock the GPIB-ENET/100 or an instrument connected to the GPIB-ENET/100 so that other computers cannot use it. This ability to lock the GPIB-ENET/100 can be useful for security purposes and in preventing command or data crossover. For example, with no locking, if two computers use the same GPIB-ENET/100 to gather data from the same instrument, Computer A may send a command to the instrument and before it can read back data, Computer B may send a different command to the instrument. This may cause the instrument to go into an error state, or Computer A may read back data from a different command query. With locking, Computer A first locks the interface, sends a command and reads back the data, and then unlocks the interface. During the time that Computer A has the interface locked, no other computer can access that GPIB-ENET/100.
For this example, we will examine the case where two or more computers on the network access the same two instruments connected to one GPIB-ENET/100. The example code below is the code used on each computer accessing the GPIB-ENET/100. For our application example detailed in Figure 5, both computers will run the code below.
The examples uses iblck, which is fully documented in the NI-488.2 Help you receive with your GPIB-ENET/100 software. For NI-488.2 for Windows 95, Windows NT, Mac OS Classic, Solaris, Digital (Tru64) Unix, and HP-UX software that has not added support for iblck, iblock and ibunlock are fully documented in the readme files you receive with your GPIB-ENET/100 software.
Distributed GPIB-ENET/100 Sample 3
Summary
The application examples detailed above are compact, and yet they represent all of the structures necessary to implement a large or small GPIB control system. The fact that Example 1 and Example 2 share virtually identical code shows how easily one networked computer can be programmed to control practically unlimited numbers of GPIB instruments. With minor adjustments, as shown in Example 3, many computers can share control of the same pool of GPIB instruments.
The GPIB-ENET/100 TCP/IP Ethernet-to-GPIB controller and networked computers can place your GPIB test systems on-line so that your managers, test engineers, and technicians have quick and easy access to your GPIB instrumentation. Using server applications to manage each GPIB test system, you can selectively integrate different test stations into a single application or give key people remote access to the test system to view test data, perform maintenance-related tasks, or perform control and monitoring-related tasks that are necessary to fine tune, monitor, and maintain the productivity of the test system.
Related Links:
Developing Wireless GPIB Test Systems Using the GPIB-ENET/100
Reader Comments | Submit a comment »
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/).



