使用GPIB进行安捷伦电源编程

时间:2012-09-12 01:17:21

标签: visa gpib

查看电源文档中提供的示例。通过在C#中添加两个库AgilentRMLib和VisComLib来完成编程。什么时候 我尝试通过选择添加参考 - > Agilent VISA COM Resourse Manager 1.0添加AgilentRMLib,错误显示在参考文献中。

我尝试直接从Program Files添加agtRM.dll。仍然存在错误。以前有人遇到过这个问题吗?对此有何解决方案?您是否有任何其他方法可以使用Agilent IO从PC对电源进行编程。

3 个答案:

答案 0 :(得分:0)

我能够使用VisaComLib(GlobMgr.dll)代替使用C#编程语言对GPIB进行编程。 pdf file link! 用作参考。

答案 1 :(得分:0)

如果你不介意使用VBA,这段代码可以帮助你完成你想要做的事情,确保它在参考文献中有VISA COM 488.2格式化I / O:

Public Sub TestVISA()
    Dim Dev_IO As VisaComLib.FormattedIO488
    Dim io_manager As VisaComLib.ResourceManager

'Start of Open GPIB port (or any VISA resource)
    Set io_manager = New VisaComLib.ResourceManager
    Set Dev_IO = New VisaComLib.FormattedIO488
    Set Dev_IO.IO = io_manager.Open("GPIB0::x::INSTR")    ' x is the GPIB address number of the Dev_IOument
    Set io_manager = Nothing
    Dev_IO.IO.Timeout = 10000  'set time out to 10 seconds, use this line to change timeout to any time out value per VISA spec
'End of Open GPIB port

'Send some SCPI command to the Dev_IOumnet
    Dev_IO.WriteString ("*IDN?")
    MsgBox ("Connected to: " & Dev_IO.ReadString)

'Close the port upon completion
    Dev_IO.IO.Close
    Set Dev_IO = Nothing 'release the object

End Sub

答案 2 :(得分:0)

当您使用GPIB协议时,最好使用GPIB库和包装器,然后使用本机SCPI命令进行编码。这样,您的软件将更加依赖于您的应用程序,您几乎可以控制所有内容。使用VISA界面,您必须担心另一层,但通过这种方法,您可以直接有效地控制您的设备。我在VISA工作了几年,但经过艰苦的工作,现在我可以用直接的GPIB编程构建我的测量系统。您可以从NI或Agilent的网站上找到所需的库。