tclvisa
– a Tcl Extension that provides binding to VISA API.
Tcl is a great scripting platform. I found it very useful in automatization of measurement buildings. It works well in both command line-based utilities and graphical interface programs.
Virtual Instrument Software Architecture (VISA) is, generally speaking, measurement instrument contolling API. It provides unified interface for multimeters, power supplies, oscilloscopes etc.
tclvisa
allows accessing VISA functionality from Tcl scripts.
As a regular Tcl Extension it is linked dynamically to tclsh
, wish
or any other Tcl-based application.
Then user can work with VISA devices via usual Tcl IO commands like puts
and gets
.
tclvisa
usage. In this example we open a VISA instrument, send a command, wait for answer and read it, then print answer to console.
# load tclvisa package into Tcl shell package require tclvisa # get handle to default resource manager if { [catch { set rm [visa::open-default-rm] } rc] } { puts stderr "Error opening default resource manager\n$rc" exit } # open device set visaAddr "ASRL1::INSTR" if { [catch { set vi [visa::open $rm $visaAddr] } rc] } { puts "Error opening instrument `$visaAddr`\n$rc" # `rm` handle is closed automatically by Tcl exit } # Set proper timeout fconfigure $vi -timeout 500 # Send command to instrument. New line character is added automatically by `puts`. puts $vi "*CLS" # Send command to query device identity string puts $vi "*IDN?" # Read device's answer. Trailing new line character is removed by `gets`. set id [gets $vi] puts "Identity of `$visaAddr` is `$id`" # close channels close $vi close $rm
Hypothetically tclvisa
works at every platform that provides:
Actually only platform the tclvisa
was tested on is Windows.
tclvisa
Programmer's Manual (PDF).
Please use project forum to ask any questions.
Bugs and feature requests can be posted at project bug tracker.