Tektronix Technical Forums are maintained by community involvement. Feel free to post questions or respond to questions by other members. Should you require a time-sensitive answer, please contact your local Tektronix support center here.

Script for sweeping voltage forward and reverse

Use this forum for questions about Keithley Test Script Builder software.
Post Reply
Shaleen
Posts: 5
Joined: July 11th, 2013, 6:45 am
Country: India

Script for sweeping voltage forward and reverse

Post by Shaleen » July 12th, 2013, 10:50 am

Hello,
I am using Keithley 2602a instrument and I needed to write a TSB script to measure hysteresis in current by applying sweeping voltage from an initial value to end value and then back to initial value with no time lag during transition from forward to reverse sweep measuring current according to the number of points entered.I wrote the following script-



--TODO Please insert code here.
function hysteresis(smu,startvalue,endvalue,points,compliance,scrdelay)

--Sweeping voltage first increasing then decreasing, forming a loop on selected smu channel and measure current.
--Measure and return current for given corresponding voltages in a tabular format.

--Pass parameters:
-- smu is the smu channel selected for the test (A or B); smub is default
-- startvalue is source loop voltage minimum value; -1V default
-- endvalue is source loop voltage maximum value value; 1V default
-- points are the number of current measurements to be made; 100 default

--default to smua if no smu specified
if smu == nil then smu = smub end

--prompt for input parameters if missing from list


if startvalue == nil then
startvalue = display.prompt("0.000E+00", " Volts", "Enter Minimum value of loop voltage.", -1,-20,20)
end --end if

if endvalue == nil then
endvalue = display.prompt("0.000E+00", " Volts", "Enter Maximum value of loop voltage.", 1,-20,20)
end



if points == nil then
points = display.prompt("000", " Enter the number of measurements to be made", 100,100,200)
end --end if

if compliance == nil then
compliance = display.prompt("00.000", " Enter the Compliance current value", 1,100E-9,1)
end --end if

--wait before making measurement

if srcdelay == nil then
srcdelay = display.prompt("000", " Seconds", "Enter Source Delay.", 0,0,20)
end --end if

delay(srcdelay)

smu.source.limiti = compliance

--Configure source and measure settings
smu.source.func = smu.OUTPUT_DCVOLTS


function clearBuffers()
smu.nvbuffer1.clear() --clear smui nvbuffer1
smu.nvbuffer2.clear() --clear smui nvbuffer2
end

function setsmu1()
smu.trigger.source.linearv(startvalue, endvalue, points)
smu.trigger.measure.i(smu.nvbuffer1)
smu.trigger.source.action = smu.ENABLE
end

function output1()
smu.nvbuffer1.collectsourcevalues=1
smu.measure.count=1
smu.source.output = smu.OUTPUT_ON
smua.source.output = smu.OUTPUT_ON
smua.trigger.initiate()
waitcomplete()
printbuffer(1, 150, smu.nvbuffer1.readings)
printbuffer(smu.nvbuffer1.sourcevalues)
print("*********************")
smu.source.output = smu.OUTPUT_OFF
smua.source.output = smu.OUTPUT_OFF
end

function setsmu2()
smu.trigger.source.action = smu.DISABLE
smu.trigger.source.linearv(endvalue, startvalue, points)
smu.trigger.measure.i(smu.nvbuffer2)
smu.trigger.source.action = smu.ENABLE
end

function output2()
smu.nvbuffer2.collectsourcevalues=1
smu.measure.count=1
smu.source.output = smu.OUTPUT_ON
smua.source.output = smu.OUTPUT_ON
smua.trigger.initiate()
waitcomplete()
printbuffer(1, 150, smu.nvbuffer2.readings)
printbuffer(smu.nvbuffer2.sourcevalues)
print("*********************")
smu.source.output = smu.OUTPUT_OFF
smua.source.output = smu.OUTPUT_OFF
end
clearBuffers()
setsmu1()
output1()
setsmu2()
output2()

end --function Hysteresis()



the program was built successfully
the program was run and the following parameters were passed-


hysteresis(smu,-5,5,150,0.01,0)


to which I got the following output-


9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37
*********************
9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37, 9.91000e+37
*********************
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
5038, SMU B: Index exceeds maximum reading
-350, Queue full error


Please help me.I am a fairly new user of TSB, I don't know where I am going wrong.
I need voltage and the corresponding current measurement value in a tabular format.
-Thanks

Andrea C
Keithley Applications
Keithley Applications
Posts: 1263
Joined: October 15th, 2010, 10:35 am
Country: United States
Contact:

Re: Script for sweeping voltage forward and reverse

Post by Andrea C » July 17th, 2013, 8:33 am

Hi Shaleen,

You've not completely setup a trigger model based measurement, so this is why it's not quite doing what you want.

If you have version E02 of the Test Script Builder software, check out the examples that are distributed with the application.
In particular, look at the KE26XXB_DC_Sweeps.tsp file located in the KE26XXB_Example_Scripts project folder.
There is a DCSweepVList() function defined in that file. By passing a voltage list that represents your forward and reverse sweep, you'll be able to do the hysteresis test.

Andrea

Post Reply

Return to “Test Script Builder”

Who is online

Users browsing this forum: No registered users and 2 guests