Hello Guys, i am the beginner to use KEITHLEY 2636A. At first i want to test our instrument. I connected a 10 KOhm resistor to KEITHLEY source and i want to conduct device under test (DUT). i write the below mentioned code in python to communicate between PC and KEITHLEY. But, when I run the python(pyvisa) code the KEITHLEY 2636A screen shows some ERROR CODE -420 (Query UNTERMINATED). what is this error means and how we can resolve this error? Your experience and guideance will be appreceated. thanks
Even it shows me result a the end, but still i saw ERROR CODE -420 (Query UNTERMINATED) on the KEITHLEY screen during the measurements.
here is the code.
import pyvisa
import numpy as np
import time
import matplotlib.pyplot as plt
# set up the instrument
rm = pyvisa.ResourceManager()
keithley = rm.open_resource("GPIB0::26::INSTR") # Replace with your instrument address
keithley.write("smua.reset()")
keithley.write("smua.source.func = smua.OUTPUT_DCVOLTS")
keithley.write("smua.source.autorangei = smua.AUTORANGE_ON")
keithley.write("smua.source.autorangev = smua.AUTORANGE_ON")
keithley.write("smua.source.limiti = 10e-3") # Set current compliance to 10 mA
keithley.write("smua.measure.autorangei = smua.AUTORANGE_ON")
keithley.write("smua.measure.autorangev = smua.AUTORANGE_ON")
# set up the sweep parameters
start_voltage = 0
stop_voltage = 10
num_points = 21
sweep_time = 1e-3
current_limit = 10e-3
# generate the voltage values
voltage_values = np.linspace(start_voltage, stop_voltage, num_points)
# set the initial voltage
keithley.write("smua.source.levelv = {}".format(start_voltage))
keithley.write("smua.source.output = smua.OUTPUT_ON")
time.sleep(0.1) # Wait for output to settle
# sweep the voltage and measure the current
current_values = np.empty_like(voltage_values)
time.sleep(0.5) # Wait for the instrument to settle
for i, voltage in enumerate(voltage_values):
keithley.write("smua.source.levelv = {}".format(voltage))
time.sleep(sweep_time/num_points) # Wait for next data point
current_values[i] = float(keithley.query("smua.measure.i()"))
time.sleep(0.1) # Wait for instrument to settle
# turn off the output
keithley.write("smua.source.output = smua.OUTPUT_OFF")
# plot the data
plt.plot(voltage_values, current_values)
plt.xlabel("Voltage (V)")
plt.ylabel("Current (A)")
plt.show()