Function Reference

_viOpen

測定器/デバイスへのVISAコネクションを開きます。

#include <Visa.au3>
_viOpen ( $s_visa_address [, $s_visa_secondary_address = 0] )

 

パラメータ

$s_visa_address VISAリソース記述子文字列 (詳しくは_viExecCommandのノート上部を参照)
ショートカットとしてGPIBアドレスを整数で直接わたすこともできます。
$s_visa_secondary_address [オプション]"2次GPIBアドレス"。1次アドレスが整数で渡された場合のみ使用できます。
特定のGPIB測定機器のみが2次アドレスを持っていて、その場合2次アドレスを指定するためにこのパラメータを使用できます。
このパラメータはデフォルトではゼロであり、2次アドレスが存在しないことを意味しています。

 

返し値

成功: (正の)VISA計測器ハンドルを返します
失敗: -1を返し@errorを1に設定します

 

注意

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

* 一般的なVISA記述子のより詳しい説明については_viExecCommand関数ヘルプの注意を参照してください。

 

関連

_viClose, _viExecCommand, _viFindGpib, _viGpibBusReset, _viGTL, _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) ; 計測器コネクションを閉じる

MsgBox(0,"Step 5","Open the Instrument connection using only the address number")
Dim $h_instr = _viOpen(3)
MsgBox(0,"Instrument Handle obtained", "$h_instr = " & $h_instr) ; セッションハンドルを表示
; 計測器の要求

MsgBox(0,"Step 6","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 7","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 8","Close the instrument connection using _viClose")
_viClose($h_instr) ; 計測器コネクションを閉じる