这个步骤是可选的,涉及使用I/O 软件(如IVI-VOM 或[url=link:VXI|0]VXI[/url]plug&play仪器驱动程序)或I/O 库(如VISA)以编程方式与34405A 通信。
下面是在启动Visual Basic 程序时设置34405A 的实例。
启动Visual Basic 程序后,进入Project,然后选择References。核对"Agilent VISA COM Resource Manager 1.0"和"VISA COM 1.0 Type Library",点击"OK" 按钮。在增加两个参考源后,增加下面的代码:
Private Sub cmdSetUp_Click()
Dim io_mgr As VisaComLib.ResourceManager
Dim DigitalMultiMeter As VisaComLib.FormattedIO488
Set io_mgr = New AgilentRMLib.SRMCls
Set DigitalMultiMeter = New VisaComLib.FormattedIO488
'Set the instrument VISA alias address
Set DigitalMultiMeter.IO = io_mgr.Open("USB0::2391::1560::TW46000053::0::
INSTR")
On Error GoTo MyError
'Reset the function generator
DigitalMultiMeter.WriteString "*RST"
'Clear errors and status register
DigitalMultiMeter.IO.Clear
'Set the measurement
DigitalMultiMeter.WriteString "CONF:VOLTC"
'Get the reading
DigitalMultiMeter.WriteString "Read?"
'Query result
VoltDCReading = DigitalMultiMeter.ReadString
'Close the instrument
DigitalMultiMeter.IO.Close
Exit Sub
MyError:
MsgBox Err.Description & vbCrLf
End Sub