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.

How to run Channel A and Channel B simultaneously

Use this forum for questions about Keithley Test Script Builder software.
Post Reply
Posts: 1
Joined: February 3rd, 2016, 7:36 pm
Country: Malaysia

How to run Channel A and Channel B simultaneously

Post by maxxlr8 » February 3rd, 2016, 7:45 pm

Dear Keithley,

I am trying to write a script in TSB. The script is suppose to bias channel A, and take both voltage and current reading into buffers of channel A. Concurrently, Channel B should pulse while channel A is taking the measurement. However, instead of simultaneously running, Channel A and Channel B runs in series. How do I get both channels to run at the same time? Below is my code:

Code: Select all

-- This script is for photodetector measurement of responsivity. 
-- Channel A is for the photodetector,channel B is for the light source
-- Steps are as follows
-- Set Parameters for Channel B and Channel A 
-- Run

--remove all entries in buffer memories, and tell to collect timestamp  
smua.nvbuffer1.collecttimestamps = 1  
smua.nvbuffer2.collecttimestamps = 1 
smub.nvbuffer1.collecttimestamps = 1 
smub.nvbuffer2.collecttimestamps = 1
smua.nvbuffer1.timestampresolution = 0.001
smua.nvbuffer2.timestampresolution = 0.001
smub.nvbuffer1.timestampresolution = 0.001
smub.nvbuffer2.timestampresolution = 0.001

--Autorange off and setting new range for source and measure for SMUB
smub.source.autorangev = smub.AUTORANGE_OFF
smub.measure.autorangev = smub.AUTORANGE_OFF
smub.measure.autorangei = smub.AUTORANGE_OFF
smub.source.rangev = 6
smub.measure.rangei = 100e-6
smub.measure.rangev = 6
--Parameters for Channel B
biasb		= 0
levelb	= 3.4
pon		= 1
poff		= 0.5
points	= 4

--turn on SMUA  
smua.source.output = smua.OUTPUT_ON

--Parameters for Channel A
biasa 	= 5
interval	= 0.1 
ndata	= ((pon + poff)*points)/interval
smua.source.levelv = biasa 
smua.measure.count = ndata
smua.measure.interval = interval

--Start pulsing source on SMUB
--PulseVMeasureI(smu, bias, level, ton, toff, points)  
PulseVMeasureI(smub, biasb, levelb, pon, poff, points)  
--Instruct SMUA to store current in buffer1 and voltage in buffer2
smua.measure.iv(smua.nvbuffer1, smua.nvbuffer2)
smua.source.output = smua.OUTPUT_OFF

	for x=1,smua.nvbuffer1.n do    
		-- Voltage readings are in nvbuffer2.  Current readings are in nvbuffer1.    
		print(smua.nvbuffer1.timestamps[x], smua.nvbuffer2[x], smua.nvbuffer1[x])    

Kenneth P
Keithley Applications
Keithley Applications
Posts: 212
Joined: October 25th, 2010, 1:31 pm
Country: United States

Re: How to run Channel A and Channel B simultaneously

Post by Kenneth P » February 8th, 2016, 3:48 pm

The script you've created is apparently using a factory default script for pulsing. The script uses simple delays to generate the On and Off portions of the pulse waveform. You need to remove the smua.measure.iv(smua.nvbuffer1, smua.nvbuffer2) function from the main script and move it into the PulseVMeasureI() function at the point where the pulse loop occurs. You can place it either just before the smu.measure.i() function within the loop. Here is the PulseVMeasureI() function. I've made a few edits but it should work. I also suggest that you set your NPLC to a small value. 0.01 is a good point to start.
Typically, using the Trigger Model is the best choice however this is sufficient if your timing isn't too critical. Given the interval is quite long (100 msec in your case), adding a second measurement with a PLC of 0.01 (167 usec) will have minimal impact on the pulse timing.
-- add a small PLC setting before the function.
smua.measure.nplc = 0.01

function PulseVMeasureI(smu, bias, level, ton, toff, points)
-- Default to smua if no smu is specified.

smu = smub -- fix prefix smu to smub

-- if smu == nil then smu = smua end

-- Save settings in temporary variables so they can be restored at the end.
local l_s_levelv = smu.source.levelv
local l_s_rangev = smu.source.rangev
local l_s_autorangev = smu.source.autorangev
local l_s_func = smu.source.func
local l_m_autozero = smu.measure.autozero
local l_m_filter = smua.measure.filter.enable

-- Temporary variables used by this function.
local l_j, l_tonwm

-- Clear the front panel display then prompt for input parameters if missing.
if bias == nil then
bias = display.prompt("+00.000", " Volts", "Enter BIAS Voltage.", 0, -40, 40)
if level == nil then
level = display.prompt("+00.000", " Volts", "Enter PULSE Voltage.", 1, -40, 40)
if ton == nil then
ton = display.prompt("00.000E+00", " Seconds", "Enter pulse ON time.", 20E-3, 0, 20)
if toff == nil then
toff = display.prompt("00.000E+00", " Seconds", "Enter pulse OFF time.", 20E-3, 0, 20)
if points == nil then
points = display.prompt("0000", " Pulses", "Enter number of pulses", 10, 1, 1000)

-- Configure source and measure settings.
smu.source.output = smu.OUTPUT_OFF
smu.source.rangev = level
smu.source.levelv = bias
smu.source.func = smu.OUTPUT_DCVOLTS
smu.measure.autozero = smu.AUTOZERO_OFF
smu.measure.filter.enable = smu.FILTER_OFF
l_tonwm = ton - (smu.measure.nplc/localnode.linefreq) - 250E-6

-- Setup a buffer to store the result(s) in and start testing.
smu.nvbuffer1.appendmode = 1
smu.nvbuffer1.collecttimestamps = 1
smu.nvbuffer1.collectsourcevalues = 1

-- prepare channel A for measurements
smua.nvbuffer1.appendmode = 1
smua.nvbuffer1.collecttimestamps = 1
smua.nvbuffer1.collectsourcevalues = 1
smua.source.levelv = 5
smua.source.output = smua.OUTPUT_ON
smu.source.output = smu.OUTPUT_ON
for l_j = 1,points do
smu.source.levelv = bias -- Program source to bias level.
delay(ton) -- Wait for initial bias time, ton.

smu.source.levelv = level -- Program source to pulse level.
delay(l_tonwm) -- Wait pulse time - measurement & overhead time.
smua.measure.iv(smua.nvbuffer1, smua.nvbuffer2) -- added smua channel measurements into the loop
smu.measure.i(smu.nvbuffer1) -- Measure current and store in reading buffer.

smu.source.levelv = bias -- Return source to bias level.
delay(toff) -- Wait pulse off time.
smu.source.output = smu.OUTPUT_OFF

-- Update the front panel display and restore modified settings.
display.settext("PulseVMeasureI") -- Line 1 (20 characters max)
display.settext("Test complete.") -- Line 2 (32 characters max)
smu.source.levelv = 0
smu.source.rangev = l_s_rangev
smu.source.autorangev = l_s_autorangev
smu.source.func = l_s_func
smu.source.levelv = l_s_levelv
smu.measure.autozero = l_m_autozero
smu.measure.filter.enable = l_m_filter

Post Reply

Return to “Test Script Builder”

Who is online

Users browsing this forum: No registered users and 1 guest