将ni-visa与python使用太慢
我正在Python中工作并使用ctypes包加载visa32.dll来简单地写入和读取仪器,但是从viWrite到viRead需要510ms(我使用NI I/O跟踪来跟踪数据),500ms~600ms太慢对于我的项目和pyVisa读取太慢(几乎同时在500ms~600ms之间),我不知道如何通过python加速执行(仅限LabVIEW)需要少于 100 毫秒)
visa = WinDLL('c:\\windows\\System32\\visa32.dll')
nb = c_uint32()
nb32 = c_uint32()
buff2 = c_uint32()
vi = c_uint32()
AC_Source = b"GPIB0::30::INSTR"
data = b"SOUR:FREQ?"
send_num = len(data)
visa.viOpenDefaultRM(byref(rm_session))
visa.viOpen(rm_session, AC_Source, 0x00, 0x00, byref(vi))
visa.viWrite(vi, data, send_num, byref(nb))
visa.viRead(vi, byref(buff2), 0xFF, byref(nb32))
是否有其他方式在不使用 PyVISA 的情况下控制仪器或任何可以使其更快的方式? 我是 ctypes 的新手,非常感谢任何帮助。
I'm working in Python and using the ctypes package to load visa32.dll to simply write and read instrument, but starting from viWrite to viRead took 510ms(I use NI I/O trace to trace data), 500ms~600ms is too slow for my project and pyVisa is reading too slow too(almost the same time between 500ms~600ms), I don't know how to speed up the execution by python(LabVIEW only need less than 100ms)
visa = WinDLL('c:\\windows\\System32\\visa32.dll')
nb = c_uint32()
nb32 = c_uint32()
buff2 = c_uint32()
vi = c_uint32()
AC_Source = b"GPIB0::30::INSTR"
data = b"SOUR:FREQ?"
send_num = len(data)
visa.viOpenDefaultRM(byref(rm_session))
visa.viOpen(rm_session, AC_Source, 0x00, 0x00, byref(vi))
visa.viWrite(vi, data, send_num, byref(nb))
visa.viRead(vi, byref(buff2), 0xFF, byref(nb32))
any other way to control the instrument without using PyVISA or any way that can make it faster?
I'm new to ctypes, any help is appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论