GPIB Extension for Tcl
v2.4.1
by Ian Dees
Copyright (c) 2000-2003, Anritsu Company
Copyright (c) 2004-2007, Ian Dees
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or other
materials provided with the distribution.
Neither the name of Anritsu nor the names of its contributors may be used to
endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL ANRITSU OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Changes
1.0 - Initial revision.
1.1 - Added secondary addressing.
1.2 - Code cleanup. Linux version submitted by Tim Westbrook.
1.3 - Added ibonl call to destructor as suggested by John Westmoreland.
1.4 - Added GPIBDevice::Clear() based on code from John Westmoreland.
1.5 - Added GPIBDevice::GetStatus() based on a suggestion from Tracy Trahan.
2.0 - Added GPIBDevice::GetError() based on code from Karl Moerder.
Added "exceptions" command based on suggestion from Karl Moerder.
2.1 - Added GPIBDevice::InterfaceClear() based on code from Karl Moerder.
Changed GPIBDevice::GetStatus() and GPIBDevice::GetError() to
GPIBDevice::GetInterfaceStatus() and GPIBDevice::GetInterfaceError()
based on suggestion from Karl Moerder. Added "interface" keyword to
"gpib status", "gpib error", and "gpib exceptions" based on code from
Karl Moerder. Changed all Boolean parameters to accept true/false,
on/off, and 1/0 based on suggestion from Karl Moerder.
2.2 - Added GPIBDevice::SerialPoll() based on a suggestion from Brad
Critchfield.
2.3 - Added "wait" and "interface testsrq" based on code from Tim Westbrook.
2.3.1 - Added installation script contributed by Cary Renzema. Updated
copyright notices.
2.4 - Fixed binary string truncation error. Enabled raw (unformatted)
processing of binary strings. Changed include/library files
to use general GPIB libraries instead of CVI-specific ones. Added
compatibility with Tcl 8.4 header files/stubs libraries.
2.4.1 - Added code to allow _outbound_ binary strings by working around
UTF-8 issue discovered by user cmuhle.
Automatic Installation
On Windows, double-click on gpib_install.tcl or run it from wish/tclsh.
Manual Installation
On Windows, create a directory called "gpib" in your Tcl\lib\Tcl8.3 directory.
Copy gpib.dll and pkgIndex.tcl into the gpib directory.
Using GPIB-Tcl
GPIB-Tcl adds a new command ("gpib") to Tcl. Before you use this command, run
the following statement:
package require gpib
Commands for Instrument I/O
gpib open -address addrnum
[-secondary secondnum]
[-sendeoi true|false]
[-sendcr true|false]
[-sendlf true|false]
[-expect cr|lf|none]
[-timeout numseconds]
[-buffer numbytes]
The only required parameter is the GPIB address. For example:
gpib open -address 8
"secondnum" is the optional secondary address. "sendeoi" tells your GPIB card
whether or not to send the EOI signal on the bus. "sendcr" and "sendlf"
control sending of carriage return and linefeed, respectively. "expect"
controls whether or not your computer will stop reading when it sees a
carriage return or line feed. "timeout" is the number of seconds to allow for
a read. "buffer" is the size of the transmit/receive buffer in bytes--the
default of 2048 is good enough for most simple applications.
"gpib open" returns an integer you use to refer to the device.
gpib close [-device devnum|all]
With no parameters, "gpib close" closes the last device you controlled with a
Tcl command. With a device number (returned from the open command), it closes
that device. With "-device all", it closes all open devices.
gpib list
Lists all open devices.
gpib select -device devnum
Selects an open device for subsequent reading, writing, or closing.
gpib read [-device devnum] [-mode ascii|binary|mixed]
Reads from the specified device (or the last device used, if none is
specified). "mode" formats the output exactly as read ("ascii"), as hex values
("binary") or with all printable characters as read and all nonprintable
characters as hex values ("mixed").
gpib write [-device devnum] -message messagetext
Writes to the specified device (or the last device used, if none is specified).
"messagetext" is the string message to send. GPIB-Tcl does not yet support
sending binary data.
gpib clear [-device devnum]
Causes the GPIB board to perform a Selected Device Clear (SDC) action on the specified device (or the last device used, if none is specified).
gpib wait [-device devnum] [-event srq|mask]
Causes the GPIB board to wait for an event on the specified device (or the last device used, if none is specified). "event" can either be "srq" (default) or an integer representing a bit mask of the event(s) for which you want to wait. The bit fields are defined in your GPIB adapter's documentation.
gpib serialpoll [-device devnum]
Causes the GPIB board to perform a serial poll on the specified device (or the last device used, if none is specified).
Commands to Control the GPIB Board
gpib interface status
Returns the board's GPIB status register.
gpib interface error
Returns the board's GPIB error string.
gpib interface clear
Causes the GPIB board to perform an Interface Clear (IFC) action on the bus.
gpib interface exceptions off|on
If exceptions are off (default), failed GPIB operations will simply return no data. If exceptions are on, failed GPIB operations will throw an exception and return detailed information.
gpib interface testsrq
Returns 0 or 1 based on the current state of the board's SRQ line.
General Commands
gpib version
Returns the version number of gpib-tcl.
gpib about
Gives a brief description of gpib-tcl.
没有合适的资源?快使用搜索试试~ 我知道了~
gpib-tcl-win32-2.4.1.0
共12个文件
cpp:2个
txt:2个
tcl:2个
需积分: 9 13 下载量 20 浏览量
2011-11-21
22:24:34
上传
评论
收藏 56KB ZIP 举报
温馨提示
GPIB-Tcl allows you to control your GPIB instruments from the Tcl programming language.
资源推荐
资源详情
资源评论
收起资源包目录
gpib-tcl-win32-2.4.1.0.zip (12个子文件)
PKGINDEX.TCL 552B
gpibtcl.dsp 4KB
install.txt 606B
gpib_install.tcl 5KB
gpibdevice.h 6KB
gpib.cpp 27KB
gpib-tcl.html 4KB
gpib.bpr 8KB
gpib.dll 76KB
gpibtcl.dsw 537B
readme.txt 7KB
gpibdevice.cpp 12KB
共 12 条
- 1
资源评论
ahguanghui
- 粉丝: 2
- 资源: 32
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功