2600AS-901-01 Rev. B / September 2008
Return to
12-9
Series 2600A System SourceMeter® Instruments Reference Manual
Section 12: TSP Fundamentals and Script Management
Script examples
Script using commands and statements only
The script in
sweeps voltage (1V to 5V) and measures current at each step. The five
current readings are returned to the host computer:
NOTE When creating a script using the Test Script Builder, only the chunk is
typed in as shown above. See
for details on creating, loading and running the script.
When creating a script using a programming language, shell
commands must be included to manage interactions between the
host computer and TSP. The
loadscript
command loads the script
into the Series 2600A and
endscript
signifies the end of the script.
Script using a function
TSL facilitates grouping commands and statements using the
function
keyword. Therefore, a
script can also consist of one or more functions. Once a script has been RUN, the host computer
can then call a function in the script directly.
The script in
contains an ICL command to set measurement speed (NPLC) and a
function (named
sourcev
). When this script is run, the measurement speed will set to 0.5 PLC and
make the
sourcev
function available for calling.
When calling the function, you must specify the source voltage in the argument for the function.
For example, to set the source to 2V, call the function as follows:
sourcev(2)
Table 12-1
Example script to sweep V and measure I
Test Script Builder
User’s Program Script
loadscript
current = {}
current = {}
smua.source.output = smua.OUTPUT_ON
smua.source.output = smua.OUTPUT_ON
for j = 1, 5 do
for j = 1, 5 do
smua.source.levelv = j
smua.source.levelv = j
current[j] = smua.measure.i()
current[j] = smua.measure.i()
print(current[j])
print(current[j])
end
end
smua.source.output = smua.OUTPUT_OFF
smua.source.output = smua.OUTPUT_OFF
endscript
Table 12-2
Example script using a function
Test Script Builder
User’s Program Script
loadscript
smua.measure.nplc = 0.5
smua.measure.nplc = 0.5
function sourcev(v)
function sourcev(v)
smua.source.levelv = v
smua.source.levelv = v
i = smua.measure.i()
i = smua.measure.i()
print(i)
print(i)
return(i)
return(i)
end
end
endscript