2017-01-05 40 views
0

块引用超时而使用SCPI为吉时利2230电源命令

我使用实验室自动化的Keithley 2230三通道的直流电源与PyVISA。我想选择特定的通道并相应地设置电压。我附加了程序以及错误。

我做了以下的研究,但我没有成功。

PyVISA SCPI commands and queries (issue with value update)

Python SCPI avoiding fixed delays (synchronization issue)

计划:

import visa 

rm = visa.ResourceManager() 
str = 'USB0::0x05E6::0x2230::9102008::INSTR' 
inst = rm.open_resource(str) 
print inst.query("*IDN?") 
######### print the selected channel ########## 
print inst.query("INSTrument:SELect?") 
######### selected the perticular channel ########## 
print inst.query("INSTrument:SELect 2") 

命令我从吉时利DD电源的官方链接了:

http://assets.tequipment.net/assets/1/26/Documents/Keithley/2220_30_1/2220_30_1_doc_4.pdf

输出日志:

Keithley instruments, 2230-30-1, 9102008, 1.15-1.04 

CH1 

Traceback (most recent call last): 
    File "C:/Users/PycharmProjects/trails/keithley2230.py", line 9, in <module> 
    print inst.query("INSTrument:SELect 2") 
    File "C:python-2.7.9\lib\site-packages\pyvisa\resources\messagebased.py", line 384, in query 
    return self.read() 
    File "C:\python-2.7.9\lib\site-packages\pyvisa\resources\messagebased.py", line 309, in read 
    message = self.read_raw().decode(enco) 
    File "C:\python-2.7.9\lib\site-packages\pyvisa\resources\messagebased.py", line 283, in read_raw 
    chunk, status = self.visalib.read(self.session, size) 
    File "C:\python-2.7.9\lib\site-packages\pyvisa\ctwrapper\functions.py", line 1569, in read 
    ret = library.viRead(session, buffer, count, byref(return_count)) 
    File "C:\python-2.7.9\lib\site-packages\pyvisa\ctwrapper\highlevel.py", line 180, in _return_handler 
    raise errors.VisaIOError(ret_value) 
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed. 
+0

什么'打印rm.list_resources()'产生? – TigerhawkT3

+0

如果你查询通道2,然后再通道1发生了什么? – TigerhawkT3

+0

打印rm.list_resources()农产品(u'USB0 :: 0x05E6 :: 0x2230 :: 9102008 :: INSTR 'u'ASRL3 :: INSTR',u'ASRL10 :: INSTR“) – Sandy

回答

0

错误来了,因为查询:

print inst.query("INSTrument:SELect?") 
Instead I used print inst.write("INSTrument:SELect?") 

附加了未来用户的代码片段:-)

import visa 
import pyvisa 

rm = visa.ResourceManager() 
print rm.list_resources() 
str = 'USB0::0x05E6::0x2230::9102008::INSTR' 
inst= rm.open_resource('USB0::0x05E6::0x2230::9102008::INSTR') 


print inst.query("*IDN?") 

print inst.write("OUTPUT ON") 

inst.write("INSTrument:SELect CH1") 
print inst.query("INSTrument:SELect?") 
print inst.write("OUTPut:ENABle 1") 
print inst.write("APPLY CH1,1.11V,1.5A")