完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,自从我编写任何东西以来已经有一段时间了,我在主题行中找到一些关于此事的好资源有点困难。
总之,我需要在Visual Basic 2010 Express中编写程序。 我将通过USB端口与设备通信,需要设置一个34901A读取模拟电压,另一个34901A读取温度,一个34907A触发数字输出线。 由于我使用的是Visual Basic 2010,看起来我需要使用Ivi.Visa.Interop,但我似乎找不到任何有关如何使用它通过USB与设备通信的资源。 看起来有几种解决方法,比如使用名为Command Expert的东西,但这不是我现在可以使用的选项。 这是我到目前为止所得到的:Imports Ivi.Visa.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles Button1.Click Dim rsc As New ResourceManager Dim sesn As IVisaSession Dim lines As String()lines = rsc.FindRsrc(“?* INSTR”)sesn = rsc.Open(lines(0),AccessMode.NO_LOCK,2000)End Sub End Class我认为我在下一步遇到一些麻烦。 我熟悉旧的visa32.dll原型,但它看起来像Ivi.Visa.Interop是不同的。 任何帮助,将不胜感激。 -S.Crider 以上来自于谷歌翻译 以下为原文 Hello all, It has been a while since I programmed anything and I am having a little difficulty finding some good resources over the matter in the subject line. In short I need to write a program in Visual Basic 2010 Express. I will be communicating with the device via a USB port and need to set up one 34901A to read analog voltage, another 34901A to read temperature, and one 34907A to trigger a digital out line. Since I am using Visual Basic 2010, it looks like I need to use Ivi.Visa.Interop but I can't seem to find any resources on how to use it to communicate to the device via the USB. It looks like there are several work arounds, like using something called Command Expert, but that is not an option I can use presently. Here is what I got so far: Imports Ivi.Visa.Interop Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim rsc As New ResourceManager Dim sesn As IVisaSession Dim lines As String() lines = rsc.FindRsrc("?*INSTR") sesn = rsc.Open(lines(0), AccessMode.NO_LOCK, 2000) End Sub End Class I think I am having a little trouble with the next step. I am familiar with the old visa32.dll protocals but it looks like the Ivi.Visa.Interop is different. Any help would be appreciated. -S.Crider |
|
相关推荐
12个回答
|
|
您好S.Crider,您正在使用VISA COM与.NET语言提供的互操作。
您已正确创建资源管理器,现在需要创建FormattedIO488对象来控制3497x。 您将使用其writestring和readstring函数来发送SCPI命令。 首先,您需要将VISA COM 3.0类型库和VISA COM 488.2格式化I / O引用导入到项目中。 这是一个简单的VB.NET VISA COM / USB示例,它发送idn命令:---------------------------- Sub Main() Dim ioMgr As Ivi.Visa.Interop.ResourceManager Dim instrument As Ivi.Visa.Interop.FormattedIO488 Dim idn As String ioMgr = New Ivi.Visa.Interop.ResourceManager instrument = New Ivi.Visa.Interop.FormattedIO488'创建更多FormatedIO488对象 控制其他仪器在ACE的VISA仪器地址中的位置,常见的别名是USBInstrument1 instrument.IO = ioMgr.Open(“USBInstrument1”)instrument.WriteString(“* IDN?”)'用于发送命令idn = instrument.ReadString ()'用于MsgBox(“IDN字符串是:”& idn,vbOKOnly,“IDN结果”)End Sub ----------------------- ---- Agilent Connection Expert附带有关VISA COM使用的文档。 一个很好的入门指南可以在这里找到:http://cp.literature.agilent.com/litweb/pdf/5989-6338EN.pdf有关创建/设置扫描的SCPI VB示例,请参阅34970/34972产品页面 list(它们共享相同的命令)。 下面是一组用于设置DCV /温度扫描列表的SCPI命令-----------------------------#配置3497x数据采集 单元收集温度和直流电压测量。 通过软件触发器启动采集。 此示例测量通道1-10为C型热电偶温度(Celcius)和通道11-20(直流电压)。 ##运行说明:#1。设置多路复用器卡进行温度和电压测量(见下文)。 #2。将多路复用器卡插入第一个插槽。 #3。在connect语句中更新仪器地址。 #4。运行序列。 ##设置多路复用器卡的说明#1。本例使用20通道多路复用器卡(型号34901A)。 #2。通道1-10保留用于使用J型热电偶测量,而通道11-20#用于直流电压测量。 #3。此示例要求将卡放入第一个插槽。 ##要求:#本示例是为Agilent 34970A或34972A数据采集单元编写的。 ##操作:#1。重置数据采集单元以清除所有寄存器。 #2。如上所述配置和设置仪器。 #3。运行序列后等待10秒钟以完成测量。 #4。前10个结果测量的是Celcius的温度和最后10个测量电压。 ##如果您同意安捷伦科技公司不承担任何保证,义务或责任,您可以以任何有用的方式使用,修改,复制和分发此示例程序(和/或任何修改版本)的免版税权利。 任何示例程序。 (连接“3497x”,“”,“3497x数据采集/数据记录器开关单元/ 1.13”)#复位并清除仪器* RST * CLS#设置通道101至110,用J型热电偶测量温度(C):CONFigure :TEMPerature TCouple,J,(@ 101:110):UNIT:TEMPerature C,(@ 101:110):SENSe:TEMPerature:TRANsducer:TCouple:RJUNction:TYPE INTernal,(@ 101:110)#Setup channels 111 th 120 以5.5位分辨率读取10V范围内的电压:CONFigure:VOLTage:DC 10,(@ 111:120):SENSe:VOLTage:DC:NPLC 1,(@ 111:120)#Scan Channels 101 thru 120:ROUTe: SCAN(@ 101:120):TRIGger:COUNt 1:TRIGger:SOURce TIMer#开始触发:INITiate:FORMat:READing:CHANnel 0#等待扫描完成(等待10000ms):DATA:POINts? #检索10个热数据通道:DATA:REMove? 10#检索10个通道的电压数据:DATA:REMove? 10编辑:2013年4月24日下午2:21连接 以上来自于谷歌翻译 以下为原文 Hi S.Crider, You are using VISA COM with the interop provided for .NET languages. You have correctly created a resource manager, now you will need to create a FormattedIO488 object to control your 3497x. You will use its writestring and readstring functions to send SCPI commands. You will first need to import the VISA COM 3.0 Type library and the VISA COM 488.2 Formatted I/O reference into your project. Here is a simple VB.NET VISA COM/USB example that sends the idn command: ---------------------------- Sub Main() Dim ioMgr As Ivi.Visa.Interop.ResourceManager Dim instrument As Ivi.Visa.Interop.FormattedIO488 Dim idn As String ioMgr = New Ivi.Visa.Interop.ResourceManager instrument = New Ivi.Visa.Interop.FormattedIO488 'create more FormatedIO488 objects to control the other instruments 'Place in VISA Instrument address for ACE, a common alias is USBInstrument1 instrument.IO = ioMgr.Open("USBInstrument1") instrument.WriteString("*IDN?") 'Use to send commands idn = instrument.ReadString() 'Use to MsgBox("The IDN String is: " & idn, vbOKOnly, "IDN Result") End Sub --------------------------- Agilent Connection Expert comes with documentation on the use of VISA COM. A great getting started guide can be found here: http://cp.literature.agilent.com/litweb/pdf/5989-6338EN.pdf Please see the 34970/34972 product pages for SCPI VB examples on creating/setting up a scan list(they share the same commands). Below is a set of SCPI commands to setup a scanlist for DCV/Temperature ----------------------------- # Configure the 3497x Data Acquisition unit to gather temperature and DC voltage measurements. The acquisition is started by a software trigger. This example measures channels 1-10 for type J thermocouple temperatures in Celcius and channels 11-20 for DC voltage. # # Instructions for Running: # 1. Setup the multiplexer card for temperature and voltage measurements(see below). # 2. Insert multiplexer card into the first slot. # 3. Update the instrument address in the connect statement. # 4. Run the sequence. # # Instructions for setting up the Multiplexer Card # 1. This example uses a 20 channel multiplexer card (model 34901A). # 2. Channels 1-10 are reserved for using type J thermocouple measurements, while Channels 11-20 # are used for DC voltage measurements. # 3. This example requires the card be placed into the first slot. # # Requirements: # This example was written for an Agilent 34970A or 34972A Data Acquisition Unit. # # Operation: # 1. Reset the Data Acquisition Unit to clear all registers. # 2. Configure and setup the instrument as explained above. # 3. Wait 10 seconds for the measurements to complete after running the sequence. # 4. The first 10 results measure temperature in Celcius and the last 10 measure voltage. # # You have a royalty-free right to use, modify, reproduce and distribute this example program (and/or any modified version) in any way you find useful, provided you agree that Agilent Technologies has no warranty, obligations, or liability for any example programs. (Connect "3497x", "", "3497x Data Acquisition / Data Logger Switch Unit / 1.13") # Reset and clear the instrument *RST *CLS # Setup channels 101 thru 110 to measure temperature (C) with type J thermocouples :CONFigure:TEMPerature TCouple,J,(@101:110) :UNIT:TEMPerature C,(@101:110) :SENSe:TEMPerature:TRANsducer:TCouple:RJUNction:TYPE INTernal,(@101:110) # Setup channels 111 thru 120 to read voltage on the 10V range with 5.5 digit resolution :CONFigure:VOLTage:DC 10,(@111:120) :SENSe:VOLTage:DC:NPLC 1,(@111:120) # Scan Channels 101 thru 120 :ROUTe:SCAN (@101:120) :TRIGger:COUNt 1 :TRIGger:SOURce TIMer # Start trigger :INITiate :FORMat:READing:CHANnel 0 # Wait for scan to complete (Wait 10000ms) :DATA:POINts? # Retrieve 10 Channels of thermo data :DATA:REMove? 10 # Retrieve 10 channels of voltage data :DATA:REMove? 10 Edited by: connectivity on Apr 24, 2013 2:21 PM |
|
|
|
大家好,很抱歉我有一段时间没有回复,我在工作中被拉向另一个方向。
无论如何,我可以通过以下链接下载该设备的最新驱动程序:http://www.home.agilent.com/agilent/software.jspx?ckey = 1639533& lc = eng& amp; cc = US& nid = -11143.0.00& id = 1639533 34972确实附带了安装CD上的驱动程序,但它们已经过时用于Windows 7和vb.net。 说实话,我碰到了几家仍在研究新驱动程序的公司,以及Windows 7和.net的不足之处,所以我想不到以后再检查网站。 安捷伦应考虑在其安装CD中添加一组新驱动程序。 当我完成代码的过程后,我会发布一些可以读取频道的内容。 - S.Crider PS:Thx连接 以上来自于谷歌翻译 以下为原文 Hello All, Sorry I haven't replied in a while, I was pulled in another direction at work. Anyhow, I was able to download the latest drivers for the device on the link below: http://www.home.agilent.com/agilent/software.jspx?ckey=1639533&lc=eng&cc=US&nid=-11143.0.00&id=1639533 The 34972 did come with drivers on the install CD but they were outdated for Windows 7 and for vb.net. To be honest, I ran across several companies that are still working on new drivers and what nots for the windows 7 and .net so I did not think to check the website till later on. Agilent should think about adding a set of their new drivers to their install CDs. When I finish going over the code, I post something that will read a channel or something. - S.Crider PS: Thx connectivity |
|
|
|
大家好,这是一个简单的问题。
是否可以对数据记录器进行编程以一次读取多张卡? 我正在设置两个34901A卡 - 一个用于读取电压,另一个用于读取温度。 当我尝试运行代码时,我只从我设置的第二张卡中获取数据,而不是第一张。 试图清理代码发布。 S.Crider 以上来自于谷歌翻译 以下为原文 Hello All Again, Here is a quick question. Is it possible to program the datalogger to read multiple cards at once? I am setting two 34901A cards - one to read voltage and other to read temperature. When I try to run the code, I only get the data from the second card I set up, not the first. Trying to clean up code to post. S.Crider |
|
|
|
Hello All Again,看起来它与扫描列表/频道列表有关。
当我配置一张卡时,看起来信息和扫描列表在配置第二张卡时会被覆盖。 我甚至在那个命令专家那里尝试过,同样的事情发生了。 我很确定我只是在忽略某些东西,但我没有看到它。 所以我想问题是如何使用Agilent 34972A在visual basic 2010中配置mulltiple卡? 我已经包含了代码:Imports System Imports System.Runtime.InteropServices Imports Ivi.Visa.Interop Imports Agilent.Agilent34970.Interop Imports Ivi.Driver.Interop Dim rsc As New ResourceManager Dim strRscName As String()Dim strVoltChan As String Dim strTcChan As String Dim strErrMsg As String Dim strResult()as String Dim dblVoltRes As Double Dim dblVoltRng As Double Dim dblTcRes As Double Dim intErrCode As Integer Dim tcType As Agilent34970ThermocoupleEnum strRscName = rsc.FindRsrc(“?* INSTR”)strVoltChan =“101:120”dblVoltRes = 10 dblVoltRng = 0.001 strTcChan =“201:220”dblTcRes = 0.1 tcType = Agilent34970ThermocoupleEnum.Agilent34970ThermocoupleTType atalogger.Initialize(strRscName(0),False,True)datalogger.Voltage.DCVoltage.Configure(“101:120”,dblVoltRng,dblVoltRes )datalogger.Temperature.ConfigureTCouple(strTcChan,tcType,dblTcRes)datalogger.Scan.Initiate()result = datalogger.Scan.Fetch For i = 0 To(result.Length - 1)TextBox1.Text = TextBox1.Text& “”& 结果(i)接下来我 以上来自于谷歌翻译 以下为原文 Hello All Again, It looks like it has something to do with the scan list/channel list. When I configure one card, it looks like the info and scan list gets over written when I configure the second card. I even tried it in that command expert and the same thing happens. I am pretty sure I am just overlooking something, but I am not seeing it. So I guess the question is how to configure mulltiple cards in visual basic 2010 using the Agilent 34972A? I have included code: Imports System Imports System.Runtime.InteropServices Imports Ivi.Visa.Interop Imports Agilent.Agilent34970.Interop Imports Ivi.Driver.Interop Dim rsc As New ResourceManager Dim strRscName As String() Dim strVoltChan As String Dim strTcChan As String Dim strErrMsg As String Dim strResult() as String Dim dblVoltRes As Double Dim dblVoltRng As Double Dim dblTcRes As Double Dim intErrCode As Integer Dim tcType As Agilent34970ThermocoupleEnum strRscName = rsc.FindRsrc("?*INSTR") strVoltChan = "101:120" dblVoltRes = 10 dblVoltRng = 0.001 strTcChan = "201:220" dblTcRes = 0.1 tcType = Agilent34970ThermocoupleEnum.Agilent34970ThermocoupleTType atalogger.Initialize(strRscName(0), False, True) datalogger.Voltage.DCVoltage.Configure("101:120", dblVoltRng, dblVoltRes) datalogger.Temperature.ConfigureTCouple(strTcChan, tcType, dblTcRes) datalogger.Scan.Initiate() result = datalogger.Scan.Fetch For i = 0 To (result.Length - 1) TextBox1.Text = TextBox1.Text & "" & result(i) Next i |
|
|
|
您好,现在您忘记创建扫描列表了。
SCPI命令是ROUT:SCAN(@ 101:120,201:220)。 我对驱动程序很糟糕,我从不使用它们,我个人认为它们使编程工具比发送SCPI困难得多,但只是一个意见。 基本上SCPI相当于你想要做的是:CONF:VOLT:DC 10,(@ 101:120)CONF:TEMP TC,T,(@ 201:220)ROUT:SCAN(@ 101:120,201:220) INIT FETCH? 现在看起来你只是缺少扫描列表部分。 如果您在驱动程序文档中找不到该命令,请告诉我。 以上来自于谷歌翻译 以下为原文 Hello, Right now you are just forgetting to create a scan list. The SCPI command is ROUT:SCAN (@101:120,201:220). I'm terrible with the drivers, I never use them, personally I think they make programming instruments much more difficult than just sending SCPI, but just an opinion. Basically the SCPI equivalent of what you want to do is this: CONF:VOLT:DC 10, (@101:120) CONF:TEMP TC,T, (@201:220) ROUT:SCAN (@101:120,201:220) INIT FETCH? RIght now it looks like you are just missing the scan list portion. Let me know if you can't find the command in the driver documentation. |
|
|
|
嘿lhornburg非常感谢。
这有帮助。 我同意你关于司机的观点,至少这个司机。 虽然我有一段时间没有编码,但我觉得文档很混乱,应该更直接一点。 我最近阅读的是SCPI文档而不是驱动程序文档,以便了解如何对设备进行编程。 如果文档很好并且驱动程序编写正确,那么它应该减少开发时间。 我有另一个问题。 温度结果像单曲2.1536E1一样出现。 有没有办法让数据格式化得更好? (25.3C)我正在尝试使用Scale属性,但它似乎不起作用。 - S.Crider 以上来自于谷歌翻译 以下为原文 Hey lhornburg Thanks a lot. That helped. I do agree with your point about drivers, well this driver at least. While I haven't coded in a while, I do feel that the documentation is confusing and should be a little more straight forward. I have been reading the SCPI documentation more than the driver documentation lately in order to have a sense on how to program the device. If the documentation is good and the driver was written correctly, then it should cut down on development time. I have another question. The temperature results are coming out in like singles 2.1536E1. Is there a way to get the data formatted a little better? (25.3C) I was trying the Scale property but it didn't seemed like it worked. - S.Crider |
|
|
|
34972A以字符串形式输出数据,仅以您看到的格式输出。 您必须在代码中使用数据格式转换才能获得想要查看的内容。 我无法告诉你如何用VB做到这一点。 以上来自于谷歌翻译 以下为原文 The 34972A outputs data as a string and only in the format you see. You must use a data format conversion in your code to get what you want to see. I can't tell you how to do that with VB. |
|
|
|
lanziji 发表于 2019-6-26 12:08 这很酷。 我希望系统有一点数据操作。 在vb中编辑数据很容易。 谢谢! 以上来自于谷歌翻译 以下为原文 That's cool. I was hopeful that the system had a little bit of data manipulation. To edit the data in vb is easy. Thanks! |
|
|
|
在使用USB连接34972A时,我正在“尝试读取或写入受保护的内存。这通常表明其他内存已损坏。” 例外。 谁能告诉我它的原因和解决方案? 以上来自于谷歌翻译 以下为原文 While connecting 34972A using USB, i am getting "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." exception. Can anybody tell me its reason and solution? |
|
|
|
这通常是因为开放会话太多。 如果你有几个,请尝试关闭一些。 以上来自于谷歌翻译 以下为原文 This is usually the result of having too many open sessions. Try closing some if you do have several. |
|
|
|
只有一个季节。
请耐心等待,因为我在最近几天遇到了这个问题。 以上来自于谷歌翻译 以下为原文 There is only one season. Please help as I am facing this issue from last many days. |
|
|
|
发生此错误时您想要做什么? 您是否尝试将数据写入USB记忆棒? 是否有与此错误消息关联的数字,我假设仪器报告此错误是否正确? 这不是PC错误消息? 也许你可以发送你的程序,以便我们可以查看它? 如果您不想在此处发布,请发送至spd_support@agilent.com 以上来自于谷歌翻译 以下为原文 What are you trying to do when this error occurs? Are you trying to write data to a USB stick? Is there a number associated with this error message, I am assuming the instrument is reporting this error correct? This is not a PC error message? Maybe you can send your program so we can review it? If you don't want to post it here, send to spd_support@agilent.com |
|
|
|
只有小组成员才能发言,加入小组>>
2091 浏览 1 评论
1850 浏览 1 评论
1707 浏览 5 评论
2577 浏览 3 评论
将设备连接到PC并通过asic格式读取数据然后我的网络分析仪挂起
1558 浏览 4 评论
497浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
355浏览 0评论
1405浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
268浏览 0评论
2254浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-4-20 07:44 , Processed in 1.150608 second(s), Total 78, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号