33120是Agilent的函数发生器,具有GPIB接口。
1、首先应该购买一个GPIB卡,如果是台式PC,GPIB的型号是82350。如果是笔记本电脑,个配置82357A,该卡一头是GPIB接口(接33210),另一个头是USB接口(接PC)。
2、到Agilent网站下载Driver,该软件是免费的,软件名称Agilent IO Libraries Suit 14.2,通过该软件可以连接Agilent的所有仪器。软安装后,有VISA应用说明(PDF文件)可参考。
3、在VB环境下建立工程,并将visa32.bas模块添加到工程中,这样可调用控制仪器的API。
常用的函数:
viOpenDefaultRM(defrm) 打开资源管理器
viOpen(defrm, "GPIB0::22::INSTR", 0, 0,vi) 与GPIB地址为22的仪器建立通信
viVPrintf(vi, "*RST" + Chr$(10), 0) 向仪器发送指令
viVScanf(vi, "%t", strRes) 读取数据
viClose(vi) 关闭仪器
viClose(defrm) 关闭资源管理器
以下是一个简单的例子:
Option Explicit
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''
' idn.bas
' This example program queries a GPIB device for
' an identification string and prints the
' results. Note that you may have to change the
' VISA Interface Name and address for your
' device from "GPIB0" and "22",respectively.
''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''
Sub Main()
Dim defrm As Long 'Session to Default
Resource Manager
Dim vi As Long 'Session to instrument
Dim strRes As String * 200 'Fixed length
string to hold results
' Open the default resource manager session
Call viOpenDefaultRM(defrm)
' Open the session to the resource
' The "GPIB0" parameter is the VISA Interface
' name to a
' GPIB instrument as defined in
' Connection Expert.
' Change this name to what you have defined
' for your VISA Interface.
' "GPIB0::22::INSTR" is the address string
' for the device.
' this address will be the same as seen in:
' Connection Expert)
Call viOpen(defrm, "GPIB0::22::INSTR", 0, 0,
vi)
' Initialize device
Call viVPrintf(vi, "*RST" + Chr$(10), 0)
' Ask for the device's *IDN string.
Call viVPrintf(vi, "*IDN?" + Chr$(10), 0)
' Read the results as a string.
Call viVScanf(vi, "%t", strRes)
' Display the results
MsgBox "Result is: " + strRes, vbOKOnly,
"*IDN? Result"
' Close the vi session and the resource
manager session
Call viClose(vi)
Call viClose(defrm)
End Sub
希望能对你有帮助