pyVISA通过以太网连接到Tektronix MSO-4034B的超时错误

时间:2015-09-22 14:36:37

标签: python

我在尝试通过以太网将pyVISA连接到Tektronix MSO-4034B时遇到了一些问题。我可以很好地连接它,例如我可以运行:

>>>print(tek.query('*IDN?'))
TEKTRONIX,MSO4034B,C010722,CF:91.1CT FV:v1.38 DPO4USB:V1.00 

精细。但运行以下内容:

>>> values = np.array(tek.query_ascii_values('CURV?'))

返回以下错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jkuechle/anaconda/lib/python3.4/site-packages/pyvisa/resources/messagebased.py", line 455, in query_ascii_values
block = self.read()
  File "/Users/jkuechle/anaconda/lib/python3.4/site-packages/pyvisa/resources/messagebased.py", line 332, in read
message = self.read_raw().decode(enco)
  File "/Users/jkuechle/anaconda/lib/python3.4/site-packages/pyvisa/resources/messagebased.py", line 306, in read_raw
chunk, status = self.visalib.read(self.session, size)
  File "/Users/jkuechle/anaconda/lib/python3.4/site-packages/pyvisa/ctwrapper/functions.py", line 1582, in read
ret = library.viRead(session, buffer, count, byref(return_count))
  File "/Users/jkuechle/anaconda/lib/python3.4/site-packages/pyvisa/ctwrapper/highlevel.py", line 188, in _return_handler
raise errors.VisaIOError(ret_value)
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before 
operation completed.

似乎我可以从4034B中取出任何设置(WFMOutpre?也可以),但我无法获取任何数据。

我的代码:

import visa
import numpy as np
rm = visa.ResourceManager()
tek = rm.open_resource('TCPIP::10.0.0.45::INSTR')
values = np.array(tek.query_ascii_values('CURVe'))

2 个答案:

答案 0 :(得分:1)

您可以使用

在25000毫秒内发布超时
tek.timeout = 25000 

答案 1 :(得分:0)

您还可以为每个写动词添加延迟,示例显示1.2秒延迟或等待使用以下内容:

my_instrument = rm.open_resource("GPIB::10::INSTR", send_end=False, delay=1.2)