
Model 2290-10 10 kV Power Supply User's Manual
Section 7: Typical applications
2290-10-900-01 Rev. A/December 2013
7-7
Example program code
The following code was created and tested using the Python programming language using the
pyVISA module. To learn more about Python, go to www.python.org.
The example python program code below can be copied and pasted for your testing purposes,
however, the code must match to include the indents of specific lines.
# Import pyVisa module into the Python environment
import visa
import time
# Open a VISA session with the 2290 at GPIB address 14
# and 263xB at GPIB address 26
ki2290 = visa.instrument("GPIB::14")
ki263x = visa.instrument("GPIB::26")
# Reset and clear the status of the 263xB
ki263x.write("reset()")
ki263x.write("*CLS")
# Reset and clear any errors of the 2290
ki2290.write("*RST")
ki2290.write("*CLS")
ki2290.write("*RCL 0")
# Configure the 263xB as an ammeter, set the current limit
# and current measurement range
ki263x.write("smua.source.rangev = 0.2")
ki263x.write("smua.source.levelv = 0")
ki263x.write("smua.source.limiti = 1e-3")
ki263x.write("smua.measure.rangei = 100e-6")
# Configure the display of the 263xB and turn on the output
ki263x.write("display.screen = display.SMUA")
ki263x.write("display.smua.measure.func = display.MEASURE_DCAMPS")
ki263x.write("smua.source.output = smua.OUTPUT_ON")
# Define sweep variables for the programmed output voltage
# and measured current readings
voltage = 0
currReading = ""
currRdgList = []
# turn on the output of the 2290
time.sleep(1)
ki2290.write("HVON")
# Perform a sweep from 0 to 3000V and make current measurements
# at each point of the sweep
for n in range(0,11):
ki2290.write("VSET " + str(voltage))
time.sleep(2) # Allow new voltage level to stabilize
currReading = ki263x.ask("print(smua.measure.i())")
time.sleep(1) # Allow measurement to be taken