Table 2-3
Example interactive chunk fragment for a script
Script Chunk Fragment (Test Script Builder or User’s Program)
--Prompt operator to select channel:
chan = display.menu ("Select Channel", "smua smub")
if (chan == "smua") then
chan = smua
end
if (chan == "smub") then
chan = smub
end
--Prompt operator to select (input) the source function:
func = display.menu("Select Function", "amps volts")
if (func == "amps") then
chan.source.func = chan.OUTPUT_DCAMPS
else chan.source.func = chan.OUTPUT_DCVOLTS
end
--Prompt operator to set (input) source level:
if (func == "amps") then
level = display.prompt("0.0E+00"," mA", "Enter I level",
1E- 3, 0.5E-3, 5E-3)
else
level = display.prompt("00.0", " V", "Enter V level",
1, 0.1, 10)
end
--Wait for operator to set source level:
if (func == "amps") then
chan.source.leveli = level
else chan.source.levelv = level
end
2-36 Return to Section Topics 2600S-901-01 Rev. C / January 2008
Section 2: TSP Programming Series 2600 System SourceMeter® Instruments Reference Manual
Creating a user script
To create a script and load it, the test program (chunk) must be framed by the following shell
commands:
loadscript or loadandrunscript, and endscript.
Load only – The following scripts will load only into the run-time environment of the Series 2600.
The script on the left is anonymous, while the one on the right is named (where
name is the user-
defined name):
loadscript loadscript name
(chunk) (chunk)
endscript endscript
Load and run – The following scripts will load into the run-time environment and then run. Keep in
mind that when a script is run, only the chunk is executed. The script on the left is anonymous,
while the script on the right is named (where
name is the user-defined name):
loadandrunscript loadandrunscript name
(chunk) (chunk)
endscript endscript