Introduction
This application note introduces scripting with Keithley's Test
Script Processor (TSP) technology and its most powerful and
enticing features. With scripting, programs and code can be
loaded directly onto an instrument and run locally.
Keithley’s TSP goes well beyond just sending instrument
commands. The TSP language is a fully featured
programming language with all the capabilities you
would expect including variables and variable typing,
math operators, tables, creation of user functions, logical
operators, string manipulation, conditional branching,
loop control, and built-in standard libraries. All these tools
together, built into the TSP language, allow TSP-enabled
instruments to be their own controller and execute complete
test sequences, running local scripts and performing local
data analysis without the communication overhead inherent
in other remote instrument control methods.
What is TSP?
Keithley’s TSP is a exible hardware/software architecture
that allows message-based programming, much like SCPI,
with enhanced capabilities for controlling test sequencing/
ow, decision-making, and instrument autonomy. TSP-
enabled instruments operate like conventional SCPI
instruments by responding to a sequence of commands
sent by the controller. You can send individual commands
to the TSP-enabled instrument the same way you would
when using SCPI with any other instrument. Making the
switch to TSP will afford you improved throughput, access to
additional interfacing options between instruments, and the
convenience of autonomous instrumentation.
The use of an on-board Test Script Processor has made it
possible to create “smart” instruments, with built-in decision-
making capabilities, which reduces the need to communicate
so frequently with an external controller over the bus. This
approach to test system design allows smart instrument
systems to be much more efcient than those that rely
on standard programming. As the number of TSP-based
instruments grows, test system developers will have greater
exibility to build test systems with far higher throughput
without compromising measurement integrity.
TSPencompassesboththe TSP command set and the TSP
scripting language.The TSP scripting language isbased
on Luaversion 5.0, and when used together with the TSP
command set,allowsfor logic and subroutines that would
normally reside on a PC to run inside the instrument, which
reduces the amount of data and number of messages sent
over the communications bus by a considerable amount.
What is Lua?
Lua is a powerful and robust yet lightweight scripting
language that is easy to learn. Lua’s small footprint and
readability made this scripting language the best choice to
implement into measurement instruments. The Test Script
Processor scripting engine is a Lua interpreter. Keithley
instruments use a modied Lua version 5.0. In TSP-
enabled instruments, the Lua programming language has
been extended with Keithley-specic instrument control
commands. Lua commands can be sent and executed one
at a time like with SCPI. Unlike instruments that are only
compatible with SCPI, TSP instruments can store full scripts,
functions, or variables in their memory, meaning that an
instrument can function completely autonomously once
loaded with a script. For writing these scripts, Keithley Test
Script Builder is the obvious choice.
Keithley Test Script Builder
Keithley Test Script Builder (TSB) is a free integrated
development environment (IDE) available for TSP. Using
TSB allows you to maximize the benets of scripting with
TSP. The included instrument console can open a direct
connection to the instrument from the controlling PC. Unlike
other programming environments, TSB does not require you
to directly reference communications libraries or wrappers
in their code. You can integrate TSP commands in with the
rest of your code seamlessly, without having to use a function
to send the command to the instrument because Test Script
Builder automatically runs IVI VISA in the background.
Test Script Builder has a built-in control structure, and
allows you to debug your code, including the usage of TSP
commands. The included instrument console allows you
to read error messages and “watch” returned data with the
appropriate commands. It should be noted that the TSP
2 | WWW.TEK.COM
How to Write Scripts for Test Script Processing (TSP
®
)
APPLICATION NOTE