Log In   |  Register Free Newsletter Subscription
Global TMW:
Skip navigation
Zibb
Subscribe to Test & Measurement World
RSS
Reprints/License
Print
Email
Average Rating:
  • (0)
    Rate this:
  • 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
    1. Rowe, Martin, "Scripts automate communications test," Test & Measurement World, June 2001. p. 43. www.tmworld.com/archives.

    Average Rating:
  • (0)
    Rate this:
  • RSS
    Reprints/License
    Print
    Email
    Talkback
    Reed Business Information Resource Center

    Featured Company


    Most Recent Resources

    Advertisement

    Related Microsite Content

    Related Links

    • No Related Content Available

    More Content
    • Blogs
    • Webcasts

    Sorry, no blogs are active for this topic.

    » VIEW ALL BLOGS RSS

    EDN's Designing with LEDs
    Advertisement
    TMW Video - www.tmworld.com/video/
    NEWSLETTERS
    Test Industry News
    Automotive, Aerospace & Defense
    Communications Test
    Design, Test & Yield
    Machine-Vision & Inspection
    Instrumentation



    Please read our Privacy Policy

    About Us   |   Advertising Info   |   Site Map   |   Contact Us   |   FREE Subscription   |   Editorial Calendar
    © 2010 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