1

我正在尝试回读 Keysight 发生器在采样期间测量的值,但我不断收到超时错误:

pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): 
Timeout expired before operation completed.

我能够读取其他数据,例如 IDN,所以我不认为终止信号有错误,我一直在使用它来获取我的命令: http: //literature.cdn.keysight.com/litweb /pdf/N6705-90001.pdf我正在查看的部分是从第 162 页到第 168 页。这是我的代码,第一部分获取 IDN 并读取电压和电流,这是测量注释后的部分似乎不工作。先感谢您。

#request info from keysight power generator
print(keysight.query("*IDN?"))
#set voltage, current and turn on otuput
keysight.write("VOLT 10, (@1)")
keysight.write("CURR 1, (@1)")
keysight.write("OUTP ON,(@1)")
#read current volt and curr
print(keysight.query_ascii_values("MEAS:VOLT? (@1)"))
print(keysight.query_ascii_values("MEAS:CURR? (@1)"))
#sets a limit on current and voltage
keysight.write("CURR:LIM .5, (@1)")
keysight.write("VOLT:LIM 30, (@1)")
#measurments
keysight.write("SENS:FUNC:VOLT ON,(@1)")
keysight.write("SENS:SWE:TINT RES1000,(@1)")
keysight.write("SENS:SWE:POIN 500,(@1)")
keysight.write("SENS:SWE:OFFS:POIN 10,(@1)")
keysight.write("INIT:ACQ (@1)")
time.sleep(1)
keysight.write("TRIG:ACQ (@1)")
time.sleep(1)
keysight.write("VOLT 1, (@1)")
time.sleep(1)
keysight.write("VOLT 2, (@1)")
time.sleep(1)
keysight.write("VOLT 3, (@1)")
time.sleep(1)
keysight.write("VOLT 4, (@1)")
time.sleep(1)
keysight.write("VOLT 5, (@1)")
time.sleep(1)
keysight.write("ABOR:ACQ(@1)")
print(keysight.query_ascii_values("FETC:VOLT:MAX?(@1)"))
time.sleep(.5)
4

1 回答 1

1

原来是间距问题,现在是代码:

#request info from keysight power generator
print(keysight.query("*IDN?"))
#set voltage, current and turn on otuput
keysight.write("*RST")
keysight.write("VOLT 3, (@1)")
keysight.write("CURR 1, (@1)")
keysight.write("OUTP ON,(@1)")
#read current volt and curr
print(keysight.query_ascii_values("MEAS:VOLT? (@1)"))
print(keysight.query_ascii_values("MEAS:CURR? (@1)"))
#sets a limit on current and voltage
keysight.write("CURR:PROT:STAT .5, (@1)")
keysight.write("VOLT:PROT 30, (@1)")
#measurments
keysight.write("SENS:FUNC:VOLT ON,(@1)")
#keysight.write("SENS:FUNC:CURR ON,(@1)")
keysight.write("SENS:SWE:TINT .001,(@1)")
keysight.write("SENS:SWE:POIN 5000,(@1)")
keysight.write("INIT:ACQ (@1)")
keysight.write("TRIG:ACQ (@1)")
keysight.write("VOLT 1, (@1)")
time.sleep(1.2)
keysight.write("VOLT 2, (@1)")
time.sleep(1)
keysight.write("VOLT 3, (@1)")
time.sleep(1)
keysight.write("VOLT 4, (@1)")
time.sleep(1)
keysight.write("VOLT 5, (@1)")
time.sleep(1)
print "\n\n"
time.sleep(5)
x=keysight.query_ascii_values("FETC:ARR:VOLT? (@1)")
print x
于 2017-05-22T23:07:47.183 回答