# Funktionsreferenz

_viOpen

Öffnet eine VISA-Verbindung zu einem Instrument/Gerät.

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

Parameter

$s_visa_address | Ein VISA resource descriptor STRING (siehe die Bemerkungen zu _viExecCommand). Kürzer kannst du auch direkt eine GPIB-Adresse als Integer übergeben.
$s_visa_secondary_address | Optional: Die "secondary GPIB address". Nur verwendbar, wenn die "primary address" als Integer übergeben wurde. Nur manche GPIB-Instrumente haben "secondary addresses". In diesen Fällen kann dieser optionale Parameter verwendet werden, um diese mit anzugeben. Dieser Parameter ist standardmäßig NULL, d.h. NO SECONDARY ADDRESS

Bemerkungen

Wie für alle VISA Funktionen müssen die VISA Bibliothken installed sein (prüfe ob die visa32.dll in {WINDOWS}\system32 vorhanden ist) und eine GPIB Karte (wie z.B. National Instruments NI PCI-GPIB Karte oder die Agilent 82350B PCI High-Performance GPIB Karte) installiert sein.
* Eine detaillierte Beschreibung der bekanntesten VISA DESCRIPTORS ist in den Bemerkungen zu der Funktion "_viExecCommand" zu finden.

Siehe auch

_viClose, _viExecCommand

Beispiel

;- This assumes that you have instrument set to GPIB address 1
; It shows how to use the _viExecCommand function in stand alone mode and combined
; with _viOpen and _viClose.
; It also shows the _viGTL function
#include <Visa.au3>
Dim $h_session = 0
; Query the ID of the instrument in GPIB address 3
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) ; Show the Session Handle
; Query the instrument
MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again
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) ; Show the answer
MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection
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) ; Show the Session Handle
; Query the instrument
MsgBox(0,"Step 6","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; $h_instr is NOT A STRING now!
MsgBox(0,"GPIB QUERY result",$s_answer) ; Show the answer
; Query again. There is no need to OPEN the link again
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) ; Show the answer
MsgBox(0,"Step 8","Close the instrument connection using _viClose")
_viClose($h_instr) ; Close the instrument connection