断开某个 VISA 到某器材/设备的连接。
#include <Visa.au3>
_viClose($h_session)
参数
| $h_session | VISA session 句柄(可由 _viOpen 的返回值获得) |
返回值
成功: - 返回值为0
注意
所有的 VISA 函数都要求必须安装 VISA 库(您可以通过检查 WINDOWS\system32 目录下是否存在 visa32.dll 来判断)和一个 GPIB 卡(例如 National Instruments(美国国家仪器有限公司)的 NI PCI-GPIB 卡或者是 Agilent 82350B PCI 高性能 GPIB 卡)。
相关
_viClose, _viExecCommand
示例
;- 这个脚本假定您已经把 GPIB 的地址设为 1
; 本脚本演示了如何单独使用 _viExecCommand 函数以及结合
; _viOpen 和 _viClose 函数使用的方法。
; 另外还演示了 _viGTL 函数
#include <Visa.au3>
Dim $h_session = 0
; 请求设备的 GPIB 地址3 的 ID
MsgBox(0,"Step 1","Open the instrument connection with _viOpen")
Dim $h_instr = _viOpen("GPIB::3::0")
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; 显示 Session 句柄
; 请求设备响应
MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; 注意,$h_instr 现在已不再是字符串了!
MsgBox(0,"GPIB QUERY result",$s_answer) ; 显示结果
; 再次请求。这时不需要再次打开连接了
MsgBox(0,"Step 3","Query again. There is no need to OPEN the link again")
$s_answer = _viExecCommand($h_instr,"*IDN?")
MsgBox(0,"GPIB QUERY result",$s_answer) ; 显示结果
MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; 关闭设备连接