2-4
Return to
2600S-901-01 Rev. C / January 2008
Section 2: TSP Programming
Series 2600 System SourceMeter® Instruments Reference Manual
When the unit is turned off, the entire run-time environment will be lost. Note that SMU non-volatile
reading buffers are not lost.
Queries
TSP-enabled instruments do not have inherent query commands. Like any other scripting
environment the
command and other related
commands are used to generate
output. The
command will create one response message.
An example of generating an output message is the following chunk (two commands) that takes a
measurement and returns its value:
x = smua.measure.v() print(x)
Note that the measurement value is stored in the global variable x between the two commands.
Scripts
When taking advantage of the TSP to perform more complicated sequences of commands,
especially sequences utilizing advanced scripting features such as looping and branching, sending
the entire sequence in one message is very cumbersome. Two special messages can be used to
collect a sequence of command messages together into one chunk.
The
loadscript
message will instruct the TSP-enabled instrument to begin collecting all
subsequent messages rather than executing them immediately. After sending the sequence of
command messages, the
endscript
message is used to instruct the TSP-enabled instrument to
compile the test sequence and make it available to run in a subsequent message. This chunk is
called the “active script.”
The active script can be run at any time by sending the command
script.run()
. The active script
can be run many times without needing to re-send it. Each time the
script.run()
command is
given, the active script will be executed.
Sending a new script using the
loadscript
and
endscript
messages will instruct the TSP-
enabled instrument to replace the active script with the new script. While creating and using scripts
this way is a very powerful feature of TSP-enabled instruments, only being able to access one
script at a time in this way would be very limited. The “
” topic describes how to use
named scripts to store many scripts in the instrument at one time.
Named scripts
The
loadscript
message can also be used to create named scripts. When the
loadscript
message is used to create a named script, the active script is not replaced with the named script.
Instead, a global variable in the run-time environment is created to store the script. Because the
script is stored in a global variable, the name of the script must be a legal TSL variable name.
The name of the script is specified in the
loadscript
message by appending it to the name and
separating it from the
loadscript
keyword with a space character. The message
loadscript
MyScript
will instruct the TSP-enabled instrument to begin gathering command messages that
will be used to create a script named
MyScript
. After sending the command messages, the
endscript
message is still used to indicate the end of the script. Upon receipt of the
endscript
message, the instrument will compile the script. If there are no errors, the script will be made
available as the global variable
MyScript
because that is the name we used in the
loadscript
MyScript
message. After a named script has been successfully sent to the instrument, it can be
run at any time by sending the
MyScript()
message. If the name given to the script were different,
that name would be used instead.
If a new script is sent with the same name, it will replace the old one. Sending new scripts with
different names will not remove any previously sent scripts. By using named scripts, any number of