使用SCPI命令为Keithley 2230供电时超时

问题描述 投票:1回答:1

大段引用

我正在使用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.
python instruments visa
1个回答
0
投票

由于此查询,错误即将发生:

print inst.query("INSTrument:SELect?")

相反,我使用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")
© www.soinside.com 2019 - 2024. All rights reserved.