Function Reference

_viClose

計測器/デバイスへのVISAコネクションを閉じます。

#include <Visa.au3>
_viClose ( $h_session )

 

パラメータ

$h_session VISAセッションハンドル(_viOpenによって返されます)

 

返し値

成功: 0を返します。
失敗: VISA DLLが開けない場合-1を、それ以外の場合VISAエラーコード(VISAプログラミングガイドを参照)を表す非ゼロの値を返します。
エラー時にはこの関数は常に@errorを1に設定します。

 

注意

全てのVISA関数において使用のためにはVISAライブラリ({WINDOWS}\system32内にvisa32.dllがあるかどうかによって確認できます)とGPIBカード(National Instruments NI PCI-GPIB カードやAgilent 82350B PCI High-Performance GPIB カードなど)がインストールされている必要があります。

 

関連

_viExecCommand, _viFindGpib, _viGpibBusReset, _viGTL, _viOpen, _viSetAttribute, _viSetTimeout

 


;- 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) ; セッションハンドルを表示
; 計測器の要求

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) ; 計測器コネクションを閉じる