0

我在通过 python 与 Siglent SDG1032 函数生成器通信时遇到了很多麻烦。

这是我使用的代码:

import pyvisa as visa

resources = visa.ResourceManager('@py')
print(resources.list_resources())
probe = resources.open_resource("USB0::62700::4355::SDG1XCBD4R4332::0::INSTR")
print(probe.ask("*IDN?"))

但我得到一个错误代码,它是:

usb.core.USBError: [Errno None] b'libusb0-dll:err [set_configuration] could not set config 1: win error: Falscher Parameter.\r\n'

“Falscher Parameter”是德语错误参数;)

任何人都可以帮忙吗?

提前致谢!

编辑:也许您想查看整个错误代码

Traceback (most recent call last):
  File "C:\Users\PwM\Desktop\Fast_hysterisis_measurement\Fast_hysterisis_measurement\python_project\test.py", line 17, in <module>
    probe = resources.open_resource("USB0::62700::4355::SDG1XCBD4R4332::0::INSTR")
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa\highlevel.py", line 3304, in open_resource
    res.open(access_mode, open_timeout)
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa\resources\resource.py", line 297, in open
    self.session, status = self._resource_manager.open_bare_resource(
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa\highlevel.py", line 3232, in open_bare_resource
    return self.visalib.open(self.session, resource_name, access_mode, open_timeout)
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa_py\highlevel.py", line 167, in open
    sess = cls(session, resource_name, parsed, open_timeout)
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa_py\sessions.py", line 323, in __init__
    self.after_parsing()
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa_py\usb.py", line 81, in after_parsing
    self.interface = self._intf_cls(
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\pyvisa_py\protocols\usbtmc.py", line 293, in __init__
    self.usb_dev.set_configuration()
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\usb\core.py", line 905, in set_configuration
    self._ctx.managed_set_configuration(self, configuration)
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\usb\core.py", line 113, in wrapper
    return f(self, *args, **kwargs)
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\usb\core.py", line 159, in managed_set_configuration
    self.backend.set_configuration(self.handle, cfg.bConfigurationValue)
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\usb\backend\libusb0.py", line 509, in set_configuration
    _check(_lib.usb_set_configuration(dev_handle, config_value))
  File "C:\Users\PwM\AppData\Local\Programs\Python\Python39-32\lib\site-packages\usb\backend\libusb0.py", line 447, in _check
    raise USBError(errmsg, ret)
usb.core.USBError: [Errno None] b'libusb0-dll:err [set_configuration] could not set config 1: win error: Falscher Parameter.\r\n'
4

0 回答 0