pyvisa无法使用GPIB-USB-HS接口连接到GPIB仪器

时间:2018-07-18 08:57:04

标签: python usb visa gpib pyvisa

我正在尝试使用GPIB与仪器(Agilent 33220A任意波形发生器)进行通信,并且使用了插入计算机USB端口的GPIB-USB-HS接口。

使用NIMAX Explorer时,仪器已正确列出(还有通过USB连接的Thorlabs PM100D):

NIMAX explorer instrument listing

但是,我无法使用PyVISA连接到它。 这是代码:

import visa
rm=visa.ResourceManager()
rm.list_resources()

输出为:

('USB0::0x1313::0x8078::P0003982::INSTR', 'ASRL1::INSTR', 'ASRL3::INSTR', 'ASRL6::INSTR')

如您所见,正确列出了通过USB连接的PM100D,但未正确列出在GPIB 10上连接的安捷​​伦。

我尝试直接连接:

rm.open_resource('GPIB0::10::INSTR')

但是我遇到了IO错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\highlevel.py", line 1623, in open_resource
info = self.resource_info(resource_name, extended=True)
  File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\highlevel.py", line 1583, in resource_info
ret, err = self.visalib.parse_resource_extended(self.session, resource_name)
  File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1381, in parse_resource_extended
alias_if_exists)
  File "c:\users\nanotube\appdata\local\programs\python\python36\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 188, in _return_handler
raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.

我在Windows 7 Pro 64位操作系统上使用Python 3.6.0。 PyVisa版本是1.8。

我不明白我在这里想念的是什么。有人有主意吗?

非常感谢!

1 个答案:

答案 0 :(得分:0)

我认为这应该对您有用

JAVASCRIPT function selection() { var cat = document.getElementById('Collection_Delivery').value; if (cat == "Collection") { if (document.getElementById("Number_of_parcels").value == "") { alert('This must be completed'); return false; } } return true; } HTML first drop down: <select name="Collection_Delivery" id="Collection_Delivery" onChange="selection()"> <option disabled="disabled" selected="selected">-</option> <option value="Delivery">Delivery</option> <option value="Collection">Collection</option> <option value="Collection and Delivery">Collection &amp Delivery</option> </select> HTML second drop down: <select name="Number_of_parcels" id="Number_of_parcels"> <option value="" selected="selected">Please select</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> <option value="8">8</option> <option value="9">9</option> <option value="10">10</option> </select> <input type="submit" value="Send" onClick="return checkForm(this.form);selection()" name="myButton">