完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,我尝试使用COM对象(通过WIN32OLE)和VISA将我的MSO6034A范围与Ruby连接,但是我得到一个错误,该界面不可用(事实上类似的消息)。
我和IVI有同样的错误。 有没有人能解决这个问题,或者有一些关于如何使用Ruby签证或IVI的例子? 关心尼科 以上来自于谷歌翻译 以下为原文 Hi all, I try to interface my MSO6034A scope with Ruby using the COM object (via WIN32OLE) and VISA but I get an error that the interface is not available for this (similar message in fact). I get the same kind of error with IVI. Does anyone have a solution to this problem or maybe some examples on how to use visa or IVI with Ruby? Regards Nico |
|
相关推荐
4个回答
|
|
我从来没有使用过Ruby,但是从网上快速搜索,没有人为Ruby编写过IVI或VISA驱动程序(适用于任何设备)。
您可能需要更改语言。 人 以上来自于谷歌翻译 以下为原文 I've never used Ruby, but from some quick searching around the web, nobody has written IVI or VISA drivers (for any device) for Ruby. You will probably have to change languages. Al |
|
|
|
nvywyerwer 发表于 2019-5-27 14:43 嗨Algoss,谢谢你的回复,这也是我的印象。 但是,由于IVI为COM对象提供了IVI-COM接口,因此它应该是可能的。 适用于VBA的应该适用于Ruby。 如果我设法找到解决方案,我会在这里发布Nico 以上来自于谷歌翻译 以下为原文 Hi Algoss, Thanks for your reply that was my impression also. But as IVI provides IVI-COM interface for COM object it should be possible. What works for VBA should work for Ruby. If I ever manage to find a solution I'll post it here Nico |
|
|
|
阙云汉qrc 发表于 2019-5-27 14:56 您是尝试通过LAN连接还是通过USB连接? 我一直致力于一个纯Python程序,它可以通过以太网连接到我的MSO7104A(以及其他一些仪器),而无需使用COM IVI驱动程序或Agilent IO库。 它在github上:https://github.com/alexforencich/python-ivi。 它使用的LXI仪器的VXI-11驱动程序也是纯python,位于:https://github.com/alexforencich/python-vxi11。 您可能能够将您需要的内容移植到Ruby。 以上来自于谷歌翻译 以下为原文 Are you trying to connect over LAN or over USB? I have been working on a pure Python program that can connect to my MSO7104A (and a few other instruments) over Ethernet without any use of COM IVI drivers or the Agilent IO library. It's on github here: https://github.com/alexforencich/python-ivi . The VXI-11 driver for LXI instruments that it uses is also pure python, located here: https://github.com/alexforencich/python-vxi11 . You might be able to port what you need from there to Ruby. |
|
|
|
I was recently up against this issue and solved it with the FFI gem for Ruby which basically allows you to interface to any C DLL in windows. I initially tried with the COM object using win32OLE but with no luck. If you can communicate with the scope using a regular C DLL, try the following after installing the FFI Gem:
Thanks Richard - - - - - #By Richard Romanczyk - October 2013 #libraries needed require 'rubygems' require 'ffi' module AgVISA extend FFI::Library #ffi_lib 'C:Program Files (x86)IVI FoundationVISAWinNTagvisaagbinagvisa32' ffi_lib 'agvisa32' attach_function :OpenDefaultRM, :viOpenDefaultRM,[ :pointer ], :long attach_function :Open, :viOpen,[ :long, :string, :long, :long, :pointer], :long attach_function :Write, :viWrite,[ :long, :string, :long, :pointer], :long attach_function :Read, :viRead,[ :long, :pointer, :long, :pointer], :long attach_function :SetAttribute, :viSetAttribute,[ :long, :ulong, :long], :long attach_function :GetAttribute, :viGetAttribute,[ :long, :ulong, :pointer], :long attach_function :StatusDesc, :viStatusDesc,[ :long, :ulong, :pointer], :long attach_function :Close, :viClose,[ :long], :long end #Print Header print "nnn************* Agilent Scope Control Program *************" #Variables status=0 #Open Default Resource Manager p_resource_manager = FFI::MemoryPointer.new :pointer print "nnOpening Default Resource Manager ... " status=AgVISA.OpenDefaultRM(p_resource_manager) resource_manager=(p_resource_manager.get_pointer(0)).address if (status != 0) print "Error" print "n Could not open Default Resource Manager" print "n Status: #{status}, Pointer:#{p_resource_manager}" else print "OK" end #Open the Instrument with specified TCPIP p_error_message = FFI::MemoryPointer.new(:uchar, 256, true) p_instrument = FFI::MemoryPointer.new :pointer #desired_resource_name = "TCPIP::172.26.228.38::INSTR" # Tektronix Scope desired_resource_name = "TCPIP0::172.26.226.48::inst0::INSTR" # Agilent Scope print "nnOpening Instrument #{desired_resource_name} ... " status=AgVISA.Open(resource_manager, desired_resource_name, 0, 5000, p_instrument) instrument = (p_instrument.get_pointer(0)).address if (status != 0) print "Error" print "n Could not open Instrument #{desired_resource_name}" print "n Status: #{status}, Pointer:#{p_instrument}" AgVISA.StatusDesc(instrument, status, p_error_message) error_message = p_error_message.get_string(0) print "n AgVISA: #{error_message}" else print "OK" end #Send *IDN? Query p_return_count = FFI::MemoryPointer.new(:long, 1, true) print "nnSending ID Query ... " status=AgVISA.Write(instrument, "*IDN?", 5, p_return_count) write_return_count=(p_return_count.get_pointer(0)).address if (status != 0) print "Error" print "n Could not send Query Command *IDN?" print "n Status: #{status}, Pointer:#{p_return_count}, Value: #{write_return_count}" else print "OK" print "n Return Count: #{write_return_count}" end #Clear the buffer and read the response p_buffer = FFI::MemoryPointer.new(:uchar, 256, true) size = 256 print "n Reading response ... " status = AgVISA.Read(instrument, p_buffer, size, p_return_count); read_return_count=(p_return_count.get_pointer(0)).address buffer = p_buffer.get_string(0, read_return_count) if (status != 0) print "Error" print "n Could not read response" else print "OK" print "n Number of characters in response: #{read_return_count}" print "n Response: #{buffer}" end #General Query command = ":SYSTEM:DSP?" #print "n Debug Command: #{command}, Length: #{command.length}" print "nnSending Command #{command} ... " status=AgVISA.Write(instrument, command, command.length, p_return_count) write_return_count=(p_return_count.get_pointer(0)).address if (status != 0) print "Error" print "n Could not send Query Command *IDN?" print "n Status: #{status}, Pointer:#{p_return_count}, Value: #{write_return_count}" else print "OK" print "n Return Count: #{write_return_count}" end #Clear the buffer and read the response print "n Reading response ... " status = AgVISA.Read(instrument, p_buffer, size, p_return_count); read_return_count=(p_return_count.get_pointer(0)).address buffer = p_buffer.get_string(0, read_return_count) if (status != 0) print "Error" print "n Could not read response" else print "OK" print "n Number of characters in response: #{read_return_count}" print "n Response: #{buffer}" end #General Query command = ":SYSTEM:DSP 'New Scope Message ...'" #print "n Debug Command: #{command}, Length: #{command.length}" print "nnSending Command #{command} ... " status=AgVISA.Write(instrument, command, command.length, p_return_count) write_return_count=(p_return_count.get_pointer(0)).address if (status != 0) print "Error" print "n Could not send Query Command *IDN?" print "n Status: #{status}, Pointer:#{p_return_count}, Value: #{write_return_count}" else print "OK" print "n Return Count: #{write_return_count}" end #Close connections to instrument and terminate print "nnClosing connections to Instrument and Resource Manager ... " if (instrument != nil) AgVISA.Close(instrument) end if (resource_manager != nil) AgVISA.Close(resource_manager) end print "OK" print "nn" Edited by: rjromanc on Nov 5, 2013 4:00 PM |
|
|
|
只有小组成员才能发言,加入小组>>
898 浏览 0 评论
2202 浏览 1 评论
1984 浏览 1 评论
1850 浏览 5 评论
2720 浏览 3 评论
698浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
503浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
591浏览 0评论
2384浏览 0评论
1434浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-22 18:35 , Processed in 1.530158 second(s), Total 83, Slave 67 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号