我正在尝试与支持SCPI的BraggMETER询问器通信
操作系统:Windows 10
连接硬件:j5create JUH470 USB 3.0多适配器千兆以太网/3端口USB 3.0集线器
我困惑的一部分是:我应该作为USB设备还是TCPIP设备访问
当我通过Telnet连接时,一切都很顺利。IP地址和端口分别为10.0.0.10和3500
> telnet
> open 10.0.0.10 3500
:IDEN?
:ACK:HBM FiberSensing:FS22SI v3.0:08:046 840 200 898:20190116
:STAT?
:ACK:1
在Python中,我使用的是pyvisa库
import easy_scpi as scpi
import pyvisa
DeviceAddress = '10.0.0.10'
DevicePort = '3500'
VISADevice = f'TCPIP0::{DeviceAddress}::{DevicePort}::SOCKET'
# Doesn't work either --> VISADevice = 'ASRL10::INSTR'
rm = pyvisa.ResourceManager()
print(rm.list_resources())
inst = rm.open_resource(VISADevice)
print(inst.query("*IDEN?"))
inst.close()
错误总是在rm.open_resource
上。我尝试了许多连接字符串。它们给出不同的错误。以下是其中三项:
pyvisa.errors.VisaIOError: VI_ERROR_INTF_NUM_NCONFIG (-1073807195): The interface type is valid but the specified interface number is not configured.
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
pyvisa.errors.VisaIOError: VI_ERROR_RSRC_NFOUND (-1073807343): Insufficient location information or the requested device or resource is not present in the system.
更新1
我下载了National Instruments NI Max并使用了他们的NI I/O跟踪。此连接字符串“有效”:
TCPIP::10.0.0.10::3500::SOCKET
但是,我仍然得到超时错误。已尝试确保发送换行符终止字符,并将超时时间提高到5秒(这确实生效,因为它延迟了超时错误的记录)。没有骰子。仍然给出一个超时错误
更新2
虽然设置不同,但其他人报告使用NI GPIB-to-USB卡(GPIB-USB-HS)时出现问题。公共线程是一个USB适配器
问题是设备将CRLF(回车加换行符)作为SCPI命令终止符执行。我只发送了这两个字符中的一个“\n”
Python I/O不像我使用的某些语言那样适应操作系统,在某些情况下会将“\n”解释为“\r\n”
同样,NI Max只发送了“\n”而忽略了“\r”
我无法发表评论,所以我在这里发表评论
你试过使用普通插座吗
相关问题 更多 >
编程相关推荐