GPIB: Cool, It Works with Linux!

GPIB is a standard bus used in laboratory and industry data acquisition and experimental control that is now available for Linux.
What To Do Now

With the package compiled and ready to use, I took a low-frequency spectral analyzer HP3582A with GPIB interface and a HP3312A function generator to feed the analyzer. For readers who aren't familiar with these machines, imagine yourselves counting the flow of traffic on the highway. The highway represents the function generator. You count the vehicles, determine the increase of traffic from the last count and type the results into a portable computer. With these actions, you act as an analyzer—give or take a few Fourier transforms. That's the basic idea.

The computer should bring the analyzer up with initialization strings sent over GPIB and set it into a mode, such that all its functions can be controlled via the bus. With this control established, the computer must ask the analyzer for data, and then listen as the data is transmitted to the bus. As it is not my goal to discuss the philosophy of GPIB in this article, it should be enough to note that the GPIB software interface must provide the means of writing and reading strings to and from the bus, plus some extra functions for status and event-driven operation.

I attached the hardware to the Linux workstation and realized that strings could now be transmitted flawlessly in both directions. My work was done, and other members of the laboratory could now use the new setup for serious experimentation. However, as a Tcl/Tk fan, I couldn't stop at this point—I had to check out the promised Tcl capabilities. A shared library, loadable from Tcl is provided. It adds the new command gpib to Tcl interpreter and all the bus functions can be accessed via the new command.

Somebody Stop Me, Please!

The bluffing worked out one hundred percent, and I held four aces in one hand and a full house in another. Stop? No way! It occurred to me that I could create a user-friendly interface to the HP3582A spectral analyzer using Tcl/Tk power.

I started working on the user interface, then decided to do my own Tcl interface library. Not because anything was wrong with the existing one, I just needed an extra flag to disable actual calls to the GPIB library, because I was doing part of the program development at home without either a GPIB board or network access to a remote GPIB. I added a flag at the Tcl level to enable all of the functions to operate without actually calling the low-level library. With the manual for the spectral analyzer and Linux as the development platform, I created a neat user interface for remote analyzer operation (see Figure 1).

Figure 1. User Interface for Remote Analyzer

What Was This All About?

When I finally recovered from the programming spasm, I pulled away from the keyboard and took time to reconsider the improvement in the laboratory situation. Previously the laboratory had one ancient Motorola-based HP 300 workstation as the main work horse for experimental control. Programming was tedious because most work was done via device file without any high level library. Our other choice was a PC with MS-DOS, which is a fine machine for experimental work, but to my thinking useless as a good development platform. I feel the new solution using Linux workstations is superior to either of the other choices. You can read daily e-mail, work on a GPIB application and perform non-critical measurement at the same time on a single computer. If you are not scared of writing few lines of C code, hacking a script or two and merging together different development tools, a Linux workstation with GPIB support is a splendid machine for an experimentalist. It was my first involvement in GPIB, but the neatness and freedom of the environment raised my enthusiasm and pushed me beyond my original intentions.

There is, of course, the fact that at the time of writing most of the commercially available software for experimental control is native to Microsoft-based platforms or proprietary Unix workstations. But this is changing with Linux gaining ever more acceptance in products for measurement and control. In large environments, where vendor support is an important issue, commercial packages still prevail. However, for universities and research laboratories with enthusiastic staff and less critical demands, the Linux solution is worth trying. Of course, if you are on a tight budget, you don't have much choice. Linux and the GPIB package are free of charge and usually do not require new hardware. Linux might even save you a bill or two in the future on network-based capabilities. With real-time Linux being introduced to the laboratory now and in the future, there should be no restrictions on the seriousness and the importance of the experiment.

Resources

Timotej Ecimovic is progressing towards his graduation in physics at moderate speed. He lives with his girlfriend Manca in Ljubljana, Slovenia and enjoys one very lovable parrot Hannibal, several aquarium fish with bizarre names and an old guitar with the gift of creating very weird sounds. And of course, he is a Linux enthusiast. As he tries to stay clean of the omnipresent and lethal “Oh man! I haven't got time! Got so much work to do!” disease, he can be reached at cic@fiz.uni-lj.si.

______________________

Webinar
One Click, Universal Protection: Implementing Centralized Security Policies on Linux Systems

As Linux continues to play an ever increasing role in corporate data centers and institutions, ensuring the integrity and protection of these systems must be a priority. With 60% of the world's websites and an increasing share of organization's mission-critical workloads running on Linux, failing to stop malware and other advanced threats on Linux can increasingly impact an organization's reputation and bottom line.

Learn More

Sponsored by Bit9

Webinar
Linux Backup and Recovery Webinar

Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.

In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.

Learn More

Sponsored by Storix