必威电竞|足球世界杯竞猜平台

VISA
來源:互聯網

VISA(Virtual Instrument Software 建筑,簡稱為"Visa"),即虛擬儀器軟件結構,是VXI plug&play聯盟制定的I/O接口軟件標準及其規范的總稱。VISA提供用于儀器編程的標準I/O函數庫,稱為VISA庫。VISA函數庫駐留在計算機系統內,是計算機與儀器的標準軟件通信接口,計算機通過它來控制儀器。

基本信息

作為通用I/O標準,VISA提供了統一的設備資源管理、操作和使用機制,它獨立于硬件設備、接口、操作系統和編程語言,具有與硬件結構無關的特點。VISA的這一特性使之適用于各種儀器接口,無論儀器使用的串口還是其他任何一種總線,諸如GPIB、VXI、PXI和LXI等,都具有相同的操作函數,從而實現了控制操作上的統一。Visa基于自底向上的結構模型,創造了一個統一形式的I/O控制函數集。一方面,對初學者或是簡單任務的設計者來說,Visa提供了簡單易用的控制函數集,在應用形式上相當簡單;另一方面,對復雜系統的組建者來說,Visa提供了非常強大的儀器控制功能與資源管理。

詳細說明

1、 viOpen (Sesn1 ,rsrcName,acessMode,timeout,Sesn2)

用途:打開與指定儀器的通話。

參數說明

Sesn1 輸入 File Explorer通話(總應是由viOpenDefaultRM( )返回的VISA默資源理器)。

rsrcName 輸入 資源的唯一符號名稱

acessMode 輸入 指定資源的訪問模式。不用,應置0。

timeout 輸入 定時時間。默認值為10秒。

Sesn2 輸出 通話的唯一邏輯標識符。

返回值: 0表示成功,其余值均表示失敗。

注意: rsrcName的格式為:GPIB::Address::INSTR

其中:GPIB:表示GPIB設備。 address:表示GPIB設備地址。

INSTR表示是VISA資源。例如“GPIB::5::INSTR”

各種語言調用說明:

Delph:

函數 viOpen(sesn1:Longint;rsrcName:PChar;acessMode:Longint

timeout:Longint;sesn2:PLongint):Longint;

C:

Long viOpen (long sesn1,char *rsrcName, long acessMode, long timeout,long *sesn2)

VB:

Function viOpen (ByVal sesn1 As Long, ByVal rsrcName As String,

ByVal acessMode As Long, ByVal timeout As Long,

sesn2 As Long) As Long

2、viClose(sesn)

用途:

關閉指定的通話。

參數說明

Sesn 輸入 通話的唯一邏輯標識符。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi: 函數 viClose(sesn:Longint):Longint;

C: Long viClose (long sesn);

VB: Function viClose (ByVal sesn As Long) As Long

3、viOpenDefaultRM (sesn)

用途:

返回與默認File Explorer的通話。

參數說明:

Sesn 輸出 與默認資源管理器通話的唯一邏輯標識符。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi: 函數 viOpenDefaultRM(sesn1:PLongint):Longint;

C: Long viOpenDefaultRM (long *sesn1);

VB: Function viOpenDefaultRM (sesn1 As Long) As Long

4、viWrite(Sesn ,CommStr ,Count ,retCount )

用途:向儀器寫數據

參數說明:

Sesn 輸入 通話的唯一邏輯標識符。

CommStr 輸入 表示向儀器傳送數據塊的存儲單元

Count 輸入 指定被寫的字節數。

retCount 輸出 表示設置實際傳輸的整數字節數存儲單元。

返回值:0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi: 函數 viWrite(sesn:Longint;CommStr:PChar;Count:Longint;

retCount:PLongint):Longint;

C: Long viWrite (long sesn, char *CommStr, long Count,

long *retCount)

VB: Function viWrite (ByVal sesn As Long, ByVal CommStr As String,

ByVal Count As Long, lretCount As Long) As Long

5、viRead(Sesn , CommStr , Count , retCount)

用途:從儀器讀數據。

參數說明:

Sesn 輸入 通話的唯一邏輯標識符。

CommStr 輸入 表示將接收數據的儀器緩沖區的存儲單元。

Count 輸入 將讀取的字節數。

retCount 輸出 表示一整數的存儲地址,該整數表示實際傳輸的字節數。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi:

函數 viRead(sesn:Longint;ReadData:PChar;Count:Longint;

retCount:PLongint):Longint;

C:

Long viRead (long sesn, char *ReadData, long Count, long *retCount)

VB:

Function viRead (ByVal sesn As Long, ByVal ReadData As String,

ByVal Count As Long, lretCount As Long) As Long

6、viClear(Sesn)

用途:使一個儀器清零。

參數說明: Sesn 輸入 通話的唯一邏輯標識符。

返回值: 0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi:

函數 viClear(sesn:Longint):Longint;

C:

Long viClear (long sesn)

VB:

Function viClear (ByVal sesn As Long) As Long

7、viReadSTB(Sesn)

用途:讀服務請求的狀態字節

參數說明

Sesn 輸入 通話的唯一邏輯標識符。

Status 輸出 服務請求的狀態字節。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi:

函數 ReadSTB(sesn:Longint;status:PSmallint):Longint

C:

Long viReadSTB (long sesn, short *status)

VB:

Function viReadSTB (ByVal sesn As Long,status As Integer) As Long

8、viAssertTrigger(Sesn)

用途:設置群觸發。

參數說明:

Sesn 輸入 通話的唯一邏輯標識符。

protocal 輸入 斷定所用觸發協議。不用置0。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi:

函數 viAssertTrigger(sesn:Longint;protocal:Integer):Longint;

C:

Long viAssertTrigger (long sesn, int protocal)

VB:

Function vAssertTrigger (ByVal sesn As Long,ByVal protocal As Integer) As Long

9、viLock(Sesn)

用途:建立對指定資源的訪問模式,本函數是本地封鎖。

參數說明:

Sesn 輸入 通話的唯一邏輯標識符。

lockType 輸入 表示請求得鎖定類型。不用,置0。

timeout 輸入 定時時間,默認識是10秒。

requestedKey 輸入 不用,置0。

accessKey 輸入 不用,置0。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi:

函數 viLock(sesn,lockType,timeout:Longint;requestedKey,

accessKey:PChar):Longint;

C: Long viLock (long sesn, long lockType, long timeout, char *requestedKey, char *accessKey)

VB: Function viLock (ByVal sesn As Long, ByVal lockType As Long,

ByVal timeout As Long, ByVal requestedKey As String,ByVal accessKey As String) As Long

10、viUnlock (Sesn)

用途:取消對指定資源的封鎖,返回本地。

參數說明:

Sesn 輸入 通話的唯一邏輯標識符。

返回值:

0表示成功,其余值均表示失敗。

各種語言調用說明:

Delphi: 函數 viUnlock(sesn:Longint):Longint;

C: Long viUnlock (long sesn)

VB: Function viUnlock (ByVal sesn As Long) As Long

GPIB 函數詳細說明:

1、Send(Board_Index,evice_Address,Data_Buffer,字節_Count,EOT_Mode)

用途:

向儀器寫數據。

參數說明:

Board_Index 輸入 不用,置0。

Device_Address 輸入 儀器地址。

Data_Buffer 輸入 向儀器傳送數據塊的存儲單元。

Byte_Count 輸入 指定被寫的字節數。

EOT_Mode 輸入 0表示沒有數據傳輸結束標志;

1表示數據串用回車換行結束;

2表示數據用最后一個字符結束。

各種語言調用說明:

Delphi:

Procedure Send(Board_Index:Longint; Device_Address:SmallInt;

Data_Buffer:Pchar;字節_Count:Longint;

EOT_Mode:Longint);

C:

Void Send(long int Board_Index, short Device_Address, char *Data_Buffer,long int Byte_Count,

long int EOT_Mode);

VB:

Sub Send(ByVal Board_Index As Long, ByVal Device_Address As Short, ByVal Data_Buffer As String,ByVal 字節_Count As Long, ByVal EOT_Mode As Long);

2、Receive(Board_Index,_Address,Buffer,Byte_Count,Terminatin )

用途:

從儀器讀數據。

參數說明:

Board_Index 輸入 不用,置0。

Device_Address 輸入 儀器地址。

Data_Buffer 輸出 將接收數據的儀器緩沖區的存儲單元

字節_Count 輸入 將讀取的字節數。

Termination 輸入 不用,置0。

各種語言調用說明:

Delphi:

ProcedureReceive(Board_Index:Longint; Device_Address:SmallInt;Data_Buffer:Pchar; Byte_Count:Longint; Termination:Longint);

C:

Void Receive(long int Board_Index, short Device_Address, char *Data_Buffer,long int 字節_Count, long int Termination);

VB:

Sub Receive(ByVal Board_Index As Long, ByVal Device_Address As Short,ByVal Data_Buffer As String,ByVal Byte_Count As Long,

ByVal Termination As Long);

3、DevClear(Board_Index, Device_Address)

用途:

使一個儀器清零。

參數說明:

Board_Index 輸入 不用,置0。

Device_Address 輸入 儀器地址。

各種語言調用說明:

Delphi:

ProcedureDevClear(Board_Index:Longint;Device_Address:SmallInt);

C:

Void DevClear(long int Board_Index, short Device_Address);

VB:

Sub DevClear(ByVal Board_Index As Long, ByVal Device_Address As Short);

4、Trigger (Board_Index, Device_Address)

用途:

設置群觸發。

參數說明:

Board_Index 輸入 不用,置0。

Device_Address 輸入 儀器地址。

各種語言調用說明:

Delphi:

Procedure

Trigger(Board_Index:Longint;Device_Address:SmallInt);

C:

Void Trigger(long int Board_Index, short Device_Address);

VB:

Sub Trigger(ByVal Board_Index As Long, ByVal Device_Address As Short);

5、WaitSRQ (Board_Index, SRQ_Occurred)

用途:

等待服務請求。

參數說明:

Board_Index 輸入 不用,置0。

SRQ_Occurred 輸出 0系統默認的timeout時間內無服務請求,

1系統默認的timeout時間有服務請求。

各種語言調用說明:

Delphi:

Procedure WaitSRQ(Board_Index:Longint; SRQ_Occurred:PSmallInt);

C:

Void WaitSRQ(long int Board_Index, short *SRQ_Occurred);

VB:

Sub WaitSRQ(ByVal Board_Index As Long, SRQ_Occurred As Short);

6、ReadStatusByte(Board_Index, Address, Status_Byte )

用途:

讀服務請求的狀態字節

參數說明

Board_Index 輸入 不用,置0。

Device_Address 輸入 儀器地址。

Status_Byte 輸出 服務請求的狀態字節。

各種語言調用說明:

a00

Delphi:

ProcedureReadStatusByte(Board_Index:Longint; Device_Address:SmallInt;

Status_Byte:PSmallInt);

C:

Void ReadStatusByte(long int Board_Index, short Device_Address,

short *Status_字節);

VB:

Sub ReadStatusByte(ByVal Board_Index As Long, ByVal Device_Address As Short, Status_Byte As Short);

7、SendIFC (Board_Index)

用途:

接口清除。

參數說明:

Board_Index 輸入 不用,置0。

各種語言調用說明:a00

Delphi: Procedure SendIFC(Board_Index:Longint);

C: Void SendIFC(long int Board_Index);

VB: Sub SendIFC(ByVal Board_Index As Long);

8、ReceBlock(Board_Index,_Address,Data_Buffer,字節_Count,Termination)

用途:

從儀器讀數據塊。

參數:

名 稱 方 向 說 明

Board_Index 輸入 不用,置0。

Device_Address輸入 儀器地址。

Data_Buffer 輸出 表示將接收數據的儀器緩沖區的存儲單元

Byte_Count 輸入 將讀取的字節數。

返回值:

0表示成功, - 1表示失敗。

各種語言調用說明:

Delphi: 函數 ReceBlock(Board_Index:Longint; Device_Address:SmallInt;

Block_Size:Longint;Data_Buffer:PChar);

C: int ReceBlock(long int Board_Index, short Device_Address,

int Block_Size, char *Data_Buffer);

VB: 函數 ReceBlock(ByVal Board_Index As Integer, ByVal evice_Address As Integer,ByVal 字節_Count As Integer, ByVal Data_Buffer As String);

9、ReceEOI (Board_Index, _Address, Data_Buffer, Byte_Count, Termination)

用途:以EOI結束方式讀儀器數據塊。

參數:

名 稱 方 向 說 明

Board_Index 輸入 不用,置0。

Device_Address輸入 儀器地址。

Data_Buffer 輸出 表示將接收數據的儀器緩沖區的存儲單元

字節_Count 輸入 將讀取的字節數。

Termination 輸入 不用,置0。

返回值:

0表示成功, - 1表示失敗。

各種語言調用說明:

Delphi: 函數 ReceEOI(Board_Index:Longint; Device_Address:SmallInt;

Data_Buffer:PChar;Byte_Count:PLongint;Termination:Longint

C: int ReceEOI(long int Board_Index, short Device_Address,

char *Data_Buffer,long int *Byte_Count,LNG電子競技俱樂部 int Termination);

VB: 函數 ReceEOI(ByVal Board_Index As Integer, ByVal Device_Address As Integer,ByVal Data_Buffer As String, ByRef Byte_Count As Integer,ByVal Termination As Integer);

參考資料 >

生活家百科家居網