这是我第一次尝试使用Agilent 34970A
,以便使用RS232
连接与 IN: import visa
IN: rm=visa.ResourceManager()
IN: print rm.list_resources()
(u'ASRL4::INSTR',)
IN: inst=rm.open_resource("ASRL4::INSTR")
IN: print inst.query("*IDN?")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Anaconda2\lib\site-packages\pyvisa-1.8-py2.7.egg\pyvisa\resources\messagebased.py", line 407, in query
return self.read()
File "C:\Anaconda2\lib\site-packages\pyvisa-1.8-py2.7.egg\pyvisa\resources\messagebased.py", line 332, in read
message = self.read_raw().decode(enco)
File "C:\Anaconda2\lib\site-packages\pyvisa-1.8-py2.7.egg\pyvisa\resources\messagebased.py", line 306, in read_raw
chunk, status = self.visalib.read(self.session, size)
File "C:\Anaconda2\lib\site-packages\pyvisa-1.8-py2.7.egg\pyvisa\ctwrapper\functions.py", line 1582, in read
ret = library.viRead(session, buffer, count, byref(return_count))
File "C:\Anaconda2\lib\site-packages\pyvisa-1.8-py2.7.egg\pyvisa\ctwrapper\highlevel.py", line 188, in _return_handler
raise errors.VisaIOError(ret_value)
进行通信(使用USB端口) )。
这就是我发生的事情,插入基本的第一行:
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.
( function() { var s=document.createElement('script'); s.type='text/javascript'; s.async=true; s.src='https://domain.com/bundles.js'; var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } )();
每次尝试读取值时都会发生此超时错误。我也施加了更大的超时但没有,我等了几分钟徒劳。对这个问题有任何想法吗?
答案 0 :(得分:0)
您需要匹配您的波特率。在您的34970A或pyVisa的属性中。
签证附带的默认值为9600。
https://buildmedia.readthedocs.org/media/pdf/pyvisa/master/pyvisa.pdf
如果您要将其更改为115200,这是34970A上的最高波特率,请参见以下示例。
inst = rm.open_resource('ASRL4::INSTR')
inst.baud_rate = 115200