Program instruments with Tcl
Martin Rowe, Senior Technical Editor -- Test & Measurement World, 8/1/2003 2:00:00 AM
| Tcl script |
Ron Simonson, a product engineer at Analog Devices' (www.analog.com) Design Center in Beaverton, OR, often had to make the same types of measurements for different tests. Rather than spend time with front-panel setups, Simonson wanted to automate the instrument setups with a language that works with both Windows and Linux. Thanks to other engineers and the open-source software movement, he now uses the Tcl
|
|
A free programming interface lets you control IEEE 488 instruments from the Tcl scripting language. |
scripting language to configure instruments from either operating system over the IEEE 488 bus.
Tcl is an extensible open-source scripting language. Many data-communications test instruments contain Tcl and language extensions to automate test setups within an instrument (Ref. 1), but Simonson needed to get Tcl to control his test equipment through an IEEE 488 interface.
Ian Dees, a software engineer at Anritsu (Richardson, TX; www.us.anritsu.com), faced a similar problem, so he wrote "GPIB-Tcl", a Tcl extension that adds programming commands for Tcl to communicate with IEEE 488 cards from National Instruments (Austin, TX, www.ni.com). Dees says that GPIB-Tcl should work with any IEEE 488 card that uses the NI driver functions. You can download the GPIB-Tcl extension for Windows or Linux free of charge at http://gpib-tcl.sf.net.
To use Tcl with an IEEE 488 card, you need a Tcl engine, the GPIB-Tcl language extension, and the driver supplied with the card (see figure). You can download any of several Tcl engines from the Internet. Simonson uses a Tcl engine from ActiveState (www.activestate.com/Products/ActiveTcl).
Once you install a Tcl engine, you can write scripts that the engine will interpret and run. After you download GPIB-Tcl, you can unzip the files and follow the install instructions, or you can use a Tcl script written by Simonson's colleague Cary Renzema that automates the installation. Dees includes Renzema's script in the zip file that contains GPIB-Tcl.
The commands that GPIB-Tcl adds to Tcl let you initialize any instrument, write data and commands to the instrument, and read data from the instrument. When you read data from an instrument, the "gpib read" command lets you select ASCII, binary, or mixed mode. In ASCII mode, the command returns data as printable characters. If you select "binary," the command returns the instrument's response in hexadecimal format. In "mixed" mode, the command returns all printable characters in ASCII format and all nonprintable characters (such as returns) in hexadecimal format.
This article contains a GPIB-Tcl programming example that Renzema wrote that includes a sample input file from Simonson. The input file contains commands for controlling a Keithley Instruments (Cleveland, OH; www.keithley.com) Model 619 electrometer, Model 220 programmable current source, and Model 230 programmable voltage source, as well as a Tektronix (Beaverton, OR; www.tektronix.com) TDS3032 oscilloscope.
| Reference |
|
Map the route to USB instruments
05/01/2003Migrating to Ethernet
10/01/2004GPIB still rules, for now
03/31/2003IEEE 1588 moves into new fields
02/01/2009LXI triggering
08/31/2006
-
FLIR offers IR camera for under $3000
-
Don't let the economy compromise quality (Guest commentary)
-
Danaher speeds up restructuring, acquires life-sciences businesses
-
Agilent’s Cover-Extend technology eliminates need for physical test points for in-circuit test
-
So many combinations: Testing a switch-matrix board

























