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

函數(shù)說(shuō)明

_viExecCommand

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

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

 

參數(shù)

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

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

 

返回值

具體的返回值取決于命令是否請(qǐng)求以及操作是否成功。
* 一般命令,非請(qǐng)求:
 成功: - 返回值為零
 失。 - 返回值為 -1,說(shuō)明無(wú)法打開(kāi) VISA DLL
              否則為一個(gè)非零的數(shù)值,用以表示 VISA 錯(cuò)誤碼(請(qǐng)查看 VISA 編程人員指引)。
* 請(qǐng)求:
 成功: - 返回值為請(qǐng)求設(shè)備的回應(yīng)結(jié)果
 失。 - 返回值為 -1,說(shuō)明無(wú)法打開(kāi) VISA DLL
              返回值為 -3,說(shuō)明 VISA DLL 返回了一個(gè)未預(yù)料的結(jié)果
              或返回number of results
              否則為一個(gè)非零的數(shù)值,用以表示 VISA 錯(cuò)誤碼(請(qǐng)查看 VISA 編程人員指引)。
一旦出現(xiàn)錯(cuò)誤則本函數(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 (<>).

接口語(yǔ)法
------------------------------------------------------------
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

 

示例


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

; 請(qǐng)求設(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 句柄
; 請(qǐng)求設(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é)果
; 再次請(qǐng)求。這時(shí)不需要再次打開(kāi)連接了

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 句柄
; 請(qǐng)求設(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é)果
; 再次請(qǐng)求。這時(shí)不需要再次打開(kāi)連接了

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è)備連接