完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
是否有命令在进行测量后将仪表从远程模式中取出。
我正在使用VISA COM 3.0同时使用c#和VBA。 我的用户抱怨不得不按“本地”按钮。 以上来自于谷歌翻译 以下为原文 Is there a command to take the meter out of remote mode after taking a measurement. I am using VISA COM 3.0 with both c# and VBA. My users are complaining about having to push the Local button. |
|
相关推荐
3个回答
|
|
是的,但你不能用VISA COM做到这一点;
您将不得不使用VISA来实现此功能(您可以继续使用VISA COM):* _C#_ *包含文件visa32.cs。 它通常可以在以下位置找到:64位Windows - C: Program Files IVI Foundation VISA Win64 agvisa include 32位Windows - C: Program Files IVI Foundation VISA WinNT agvisa include Code :static void GoToLocal(string address){int rm = 0; int vi = 0; StringBuilder buf = new StringBuilder(100); visa32.viOpenDefaultRM(out rm); visa32.viOpen(rm,address,0,0,out vi); //将仪器置于本地模式visa32.viGpibControlREN(vi,visa32.VI_GPIB_REN_ADDRESS_GTL); visa32.viClose(VI); visa32.viClose(RM); } * _Excel VBA(或VB6)_ *导入文件visa32.bas。 它通常可以在以下位置找到:64位Windows - C: Program Files IVI Foundation VISA Win64 agvisa include 32位Windows - C: Program Files IVI Foundation VISA WinNT agvisa include Code :公共函数GoToLocal(地址)Dim rm As Long Dim vi As Long Dim err As Integer err = viOpenDefaultRM(rm)err = viOpen(rm,address,0,0,vi)err = viGpibControlREN(vi,VI_GPIB_REN_ADDRESS_GTL)err = viClose (vi)err = viClose(rm)结束函数 以上来自于谷歌翻译 以下为原文 Yes, but you can't do it with VISA COM; you will have to use VISA for this functionality (you can keep using VISA COM for everything else): *_C#_* Include the file visa32.cs. It can usually be found at: 64-bit Windows - C:Program FilesIVI FoundationVISAWin64agvisainclude 32-bit Windows - C:Program FilesIVI FoundationVISAWinNTagvisainclude Code: static void GoToLocal(string address) { int rm = 0; int vi = 0; StringBuilder buf = new StringBuilder(100); visa32.viOpenDefaultRM(out rm); visa32.viOpen(rm, address, 0, 0, out vi); //put instrument in local mode visa32.viGpibControlREN(vi, visa32.VI_GPIB_REN_ADDRESS_GTL); visa32.viClose(vi); visa32.viClose(rm); } *_Excel VBA (or VB6)_* Import the file visa32.bas. It can usually be found at: 64-bit Windows - C:Program FilesIVI FoundationVISAWin64agvisainclude 32-bit Windows - C:Program FilesIVI FoundationVISAWinNTagvisainclude Code: Public Function GoToLocal(address) Dim rm As Long Dim vi As Long Dim err As Integer err = viOpenDefaultRM(rm) err = viOpen(rm, address, 0, 0, vi) err = viGpibControlREN(vi, VI_GPIB_REN_ADDRESS_GTL) err = viClose(vi) err = viClose(rm) End Function |
|
|
|
MAX_zuo 发表于 2018-12-7 19:12 谢谢回复。 我还没试过在C#中做到这一点。 但我得到了它与VBA合作,通过这样做:(粗体是我加入到很久以前由其他人编写的现有代码的代码)私人m_u***HPMeter作为VisaComLib.FormattedIO488私人m_u***RM作为VisaComLib.ResourceManager *私人m_U***作为VisaComLib.IU*** * 设置m_u***RM =新的VisaComLib.ResourceManager设置m_u***HPMeter =新的VisaComLib.FormattedIO488设置m_u***HPMeter.IO = m_u***RM.Open(DeviceName)*设置m_U*** = m_u***RM.Open(m_u***HPMeter.IO.ResourceName)* * m_U***.ControlREN GPIB_REN_GTL *尚未完全测试 但似乎在做这项工作 以上来自于谷歌翻译 以下为原文 Thanks for the reply. I haven't tried to do it in C# yet. But I got it working with VBA by doing this: (The bold is code I added to existing code written by another person many moons ago.) Private m_u***HPMeter As VisaComLib.FormattedIO488 Private m_u***RM As VisaComLib.ResourceManager *Private m_U*** As VisaComLib.IU**** Set m_u***RM = New VisaComLib.ResourceManager Set m_u***HPMeter = New VisaComLib.FormattedIO488 Set m_u***HPMeter.IO = m_u***RM.Open(DeviceName) *Set m_U*** = m_u***RM.Open(m_u***HPMeter.IO.ResourceName)* *m_U***.ControlREN GPIB_REN_GTL* Not fully tested yet but seems to be doing the job |
|
|
|
wanglq2011 发表于 2018-12-7 19:22 哦,好的电话! 我忘记了USB支持。 我猜LAN是唯一不支持的接口。 以上来自于谷歌翻译 以下为原文 Oh, good call! I'd forgotten that was supported on USB. I guess LAN is the only interface where that is not supported. |
|
|
|
只有小组成员才能发言,加入小组>>
1219 浏览 0 评论
2346 浏览 1 评论
2152 浏览 1 评论
2019 浏览 5 评论
2899 浏览 3 评论
957浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
697浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
797浏览 0评论
1221浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-20 19:24 , Processed in 1.458297 second(s), Total 80, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号