pyVISA:以编程方式使仪器返回本地模式 [英] pyVISA: Return instrument to local mode programmatically

查看:367
本文介绍了pyVISA:以编程方式使仪器返回本地模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用pyVISA来控制GPIB网络中的某些仪器.创建资源管理器时,GPIB网络中的所有仪器都进入远程模式,因此前面板显示被锁定并且不会更新.当我关闭资源管理器时,工具仍处于远程模式.

I am using pyVISA to control some instruments in a GPIB network. When I create a resource manager, all the instruments in my GPIB network enter remote mode, so the front panel displays are locked and do not update. When I close the resource manager, the instruments remain in remote mode.

import visa

rm = visa.ResourceManager()

#Connect to a specific instrument
MyInstrument = rm.open_resource('GPIB0::10::INSTR')

#Do stuff
print(MyInstrument.query("*IDN?"))

#close resource manager
rm.close()

在这种特殊情况下,我只想控制网络中的一台仪器,但需要打开其他仪器的电源,并启用前面板显示.

In this particular case I only want to control one instrument in the network, but need the others to be powered on, with front panel displays live.

是否可以通过编程的方式从资源管理器中排除多余的"工具(如果需要我可以不必断开GPIB电缆或手动关闭GPIB通讯)和/或类似转到本地"命令,我可以将其发送到整个网络或特定仪器,因此,一旦已根据需要配置了相关仪器,那么前面板就可以使用吗?

Is there a way to exclude the "extra" instruments from the resource manager programmatically (don't want to have to disconnect the GPIB cables or switch off GPIB comms manually if I can help it) and/or something like a "go to local" command I can send to either the whole network or a specific instrument, so the front panels are live once the instrument in question has been configured as needed?

更新:

经过一些实验和进一步的阅读,我发现以下内容将仪器返回到本地模式:

After some experimentation and further reading, I found the following returns my instrument to local mode:

#Return single instrument to local with 
#GTL command (VI_GPIB_REN_ADDRESS_GTL = 6)
MyInstrument.control_ren(6)

#Return all instruments in network to local by 
#deasserting remote enable line (VI_GPIB_REN_DEASSERT = 0)
MyInstrument.control_ren(0)

值0和6是在pyVISA( http://pyvisa.readthedocs.io/en/stable/_modules/pyvisa/constants.html ) 似乎我应该能够在这里指定一个变量名而不是常量,所以显然还有其他我不了解的地方,但是至少我现在有一个可行的解决方案.

The values 0 and 6 are constants set in pyVISA (http://pyvisa.readthedocs.io/en/stable/_modules/pyvisa/constants.html) Seems I should be able to specify a variable name here instead of the constant so there is obviously something else I am not understanding, but at least I have a working solution now.

推荐答案

可以使用一个呼叫来控制设备的远程/本地状态.

There is a call available to control the remote/local state of the device.

GPIBInstrument.control_ren(mode)

控制GPIB远程启用(REN)接口线的状态,以及设备的远程/本地状态.

Controls the state of the GPIB Remote Enable (REN) interface line, and optionally the remote/local state of the device.

对应于VISA库的viGpibControlREN函数.

Corresponds to viGpibControlREN function of the VISA library.

()

这篇关于pyVISA:以编程方式使仪器返回本地模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆