I’ve attached an image of the simulated current pulses I want to generate using 2450. I'm using PyVISA to configure and automate the testing process. However, I'm currently encountering an issue when trying to set the protection limit.
Specifically, I'm receiving the following error:
Sending: :SENS:VOLT:PROT 5
Error state: -113,"Undefined header;1;2025/04/10 12:31:32.785"
Below is the Python code I'm using:
import pyvisa
import time
rm = pyvisa.ResourceManager()
resource_name = 'TCPIP0::10.0.0.38::5025::SOCKET'
try:
print("Connecting to Keithley 2450...")
instrument = rm.open_resource(resource_name)
instrument.timeout = 10000
instrument.read_termination = '\n'
instrument.write_termination = '\n'
print("Sending: *IDN?")
idn = instrument.query('*IDN?')
print(f"Instrument ID: {idn}")
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SYST:CLE")
instrument.write(':SYST:CLE')
time.sleep(0.5)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: *RST")
instrument.write('*RST')
time.sleep(2)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SOUR:FUNC CURR")
instrument.write(':SOUR:FUNC CURR')
time.sleep(0.5)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SOUR:CURR:RANG 0.001")
instrument.write(':SOUR:CURR:RANG 0.001')
time.sleep(0.5)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SOUR:CURR:LEV 0.0002")
instrument.write(':SOUR:CURR:LEV 0.0002')
time.sleep(0.5)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SENS:VOLT:PROT 5")
instrument.write(':SENS:VOLT:PROT 5')
time.sleep(1)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SENS:FUNC VOLT")
instrument.write(':SENS:FUNC "VOLT"')
time.sleep(1)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :SENS:VOLT:RANG 5")
instrument.write(':SENS:VOLT:RANG 5')
time.sleep(1)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
print("Sending: :OUTP ON")
instrument.write(':OUTP ON')
print("Sending: :Trigger ON")
instrument.write(':READ?')
time.sleep(20)
print("Sending: :OUTP OFF")
instrument.write(':OUTP OFF')
print("Sending: *RST")
instrument.write('*RST')
time.sleep(2)
print(f"Error state: {instrument.query(':SYST:ERR?')}")
except pyvisa.VisaIOError as e:
print("VI_ERROR_IO Details:", e)
except Exception as e:
print("Unexpected Error:", e)
finally:
try:
instrument.close()
except:
pass
runfile('C:/Users/Dalin EM/.spyder-py3/test4.py', wdir='C:/Users/Dalin EM/.spyder-py3')
Connecting to Keithley 2450...
Sending: *IDN?
Instrument ID: KEITHLEY INSTRUMENTS,MODEL 2450,04434429,1.6.7c
Error state: 0,"No error;0;0 0"
Sending: :SYST:CLE
Error state: 0,"No error;0;0 0"
Sending: *RST
Error state: 0,"No error;0;0 0"
Sending: :SOUR:FUNC CURR
Error state: 0,"No error;0;0 0"
Sending: :SOUR:CURR:RANG 0.001
Error state: 0,"No error;0;0 0"
Sending: :SOUR:CURR:LEV 0.0002
Error state: 0,"No error;0;0 0"
Sending: :SENS:VOLT:PROT 5
Error state: -113,"Undefined header;1;2025/04/10 12:31:32.785"
Sending: :SENS:FUNC VOLT
Error state: 0,"No error;0;0 0"
Sending: :SENS:VOLT:RANG 5
Error state: 0,"No error;0;0 0"
Sending: :OUTP ON
Sending: :Trigger ON
Sending: :OUTP OFF
Sending: *RST
Error state: 2.189537E+00