欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

函數(shù)說明

_viExecCommand

通過 VISA 的接口(GPIB / TCP)向某器材/設(shè)備發(fā)送命令/請求。

#include <Visa.au3>
_viExecCommand($h_session, $s_command, $i_timeout_ms = -1)

 

參數(shù)

$h_session VISA 描述符(字符串)或者 VISA session 句柄(整數(shù))。
這個參數(shù)既可以是字符串也可以是個整數(shù)(句柄):
* 字符串 -> VISA 描述符就是一個字符串,用以指定要建立通訊段的資源。
例如: "GPIB::20::0"。
本函數(shù)支持所有合法的 VISA 描述符,包括 GPIB, TCP, VXI
和串口設(shè)備(ASRL)。
關(guān)于 VISA 描述符,在下面的注意部分有詳細(xì)的解釋。
作為更快捷的方式,您可以使用一個包含 GPIB 設(shè)備的地址數(shù)字的字符串(比如"20")
來代替完整描述符(比如"GPIB::20::0")。
* 整數(shù) -> VISA session 句柄,由 _viOpen 函數(shù)返回。
如果您打算經(jīng)常性地和某個設(shè)備或裝置通信,我們推薦您使用 _viOpen 和 VISA session 句柄
來代替描述符,否則每次要和設(shè)備聯(lián)系都必須打開然后關(guān)閉通訊連接。
在完成了所有操作后切記要使用 _viClose 來關(guān)閉連接。
$s_command 要執(zhí)行的命令/請求(例如,"*IDN?" 或 "SOURCE:POWER -20 dBM")
請求必須含有問號(?)
如果是請求則本函數(shù)將自動等待設(shè)備響應(yīng)結(jié)果(或者等到操作超時為止)。
$i_timeout_ms

可選:以毫秒為單位的 VISA 操作超時時間。
這個設(shè)置僅對請求比較重要。
這是個可選參數(shù)。
若沒有指定則使用上一次使用的設(shè)置。若此前從未設(shè)置過則使用默認(rèn)的超時時間(取決于具體的 VISA 操作)。
_viSetTimeout 函數(shù)也可以設(shè)置超時時間。
由于總線類型(GPIB、TCP,等等)的不同,因此實際的超時時間可能并非和您設(shè)置的時間一致,一般會比您設(shè)置的超時時間要大一點。

 

返回值

具體的返回值取決于命令是否請求以及操作是否成功。
* 一般命令,非請求:
 成功: - 返回值為零
 失。 - 返回值為 -1,說明無法打開 VISA DLL
              否則為一個非零的數(shù)值,用以表示 VISA 錯誤碼(請查看 VISA 編程人員指引)。
* 請求:
 成功: - 返回值為請求設(shè)備的回應(yīng)結(jié)果
 失。 - 返回值為 -1,說明無法打開 VISA DLL
              返回值為 -3,說明 VISA DLL 返回了一個未預(yù)料的結(jié)果
              或返回number of results
              否則為一個非零的數(shù)值,用以表示 VISA 錯誤碼(請查看 VISA 編程人員指引)。
一旦出現(xiàn)錯誤則本函數(shù)將總是把 @error 設(shè)為 1

 

注意

* The VISA queries only return the 1st line of the device answer
This is not a problem in most cases, as most devices will always
answer with a single line.

* The following is a description of the MOST COMMON VISA DESCRIPTORS
Note that there are some more types. For more info please
refer to a VISA programmer's guide (available at www.ni.com)
Optional segments are shown in square brackets ([]).
Required segments that must be filled in are denoted by angle
brackets (<>).

接口語法
------------------------------------------------------------
GPIB INSTR GPIB[board]::primary address
                [::secondary address] [::INSTR]
GPIB INTFC GPIB[board]::INTFC
TCPIP SOCKET TCPIP[board]::host address::port::SOCKET
Serial INSTR ASRL[board][::INSTR]
PXI INSTR PXI[board]::device[::function][::INSTR]
VXI INSTR VXI[board]::VXI logical address[::INSTR]
GPIB-VXI INSTR GPIB-VXI[board]::VXI logical address[::INSTR]
TCPIP INSTR TCPIP[board]::host address[::LAN device name]
                [::INSTR]

關(guān)鍵字 GPIB 用于 GPIB 設(shè)備。
關(guān)鍵字 TCPIP 用于 TCP/IP 通信。
關(guān)鍵字 ASRL 用于串口設(shè)備。
關(guān)鍵字 PXI 用于 PXI 設(shè)備。
關(guān)鍵字 VXI 用于 VXI 設(shè)備(嵌入式或 MXIbus 控制器)
關(guān)鍵字 GPIB-VXI 用于 VXI 設(shè)備(GPIB-VXI 控制器)

The default values for optional parameters are shown below.

Optional Segment Default Value
---------------------------------------
board 0
secondary address none
LAN device name inst0

Example Resource Strings:
--------------------------------------------------------------
GPIB::1::0::INSTR A GPIB device at primary address 1 and
                      secondary address 0 in GPIB interface 0.

GPIB2::INTFC Interface or raw resource for GPIB
                      interface 2.

TCPIP0::1.2.3.4::999::SOCKET Raw TCP/IP access to port 999
                                at the specified IP address.

ASRL1::INSTR A serial device attached to interface
                      ASRL1. VXI::MEMACC Board-level register
                      access to the VXI interface.

PXI::15::INSTR PXI device number 15 on bus 0.

VXI0::1::INSTR A VXI device at logical address 1 in VXI
                      interface VXI0.

GPIB-VXI::9::INSTR A VXI device at logical address 9 in a
                      GPIB-VXI controlled system.

 

相關(guān)

_viFindGpib, _viOpen, _viClose, _viSetTimeout, _viGTL, _viGpibBusReset

 

示例


;- 這個腳本假定您已經(jīng)把 GPIB 的地址設(shè)為 1
; 本腳本演示了如何單獨使用 _viExecCommand 函數(shù)以及結(jié)合
; _viOpen 和 _viClose 函數(shù)使用的方法。
; 另外還演示了 _viGTL 函數(shù)
#include <Visa.au3>
Dim $h_session = 0

; 請求設(shè)備的 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 句柄
; 請求設(shè)備響應(yīng)

MsgBox(0,"Step 2","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; 注意,$h_instr 現(xiàn)在已不再是字符串了!
MsgBox(0,"GPIB QUERY result",$s_answer) ; 顯示結(jié)果
; 再次請求。這時不需要再次打開連接了

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) ; 顯示結(jié)果

MsgBox(0,"Step 4","Close the instrument connection using _viClose")
_viClose($h_instr) ; 關(guān)閉設(shè)備連接

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) ; 顯示 Session 句柄
; 請求設(shè)備響應(yīng)

MsgBox(0,"Step 6","Query the instrument using the VISA instrument handle")
$s_answer = _viExecCommand($h_instr,"*IDN?") ; 注意,$h_instr 現(xiàn)在已不再是字符串了!
MsgBox(0,"GPIB QUERY result",$s_answer) ; 顯示結(jié)果
; 再次請求。這時不需要再次打開連接了

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) ; 顯示結(jié)果

MsgBox(0,"Step 8","Close the instrument connection using _viClose")
_viClose($h_instr) ; 關(guān)閉設(shè)備連接