User manual
Section 2: TSP Programming Fundamentals Series 3700 System Switch/Multimeter Reference Manual
2-2 3700S-901-01 Rev. C / July 2008
Test Script Processor (TSPTM)
The Test Script Processor (TSP) is a scripting engine that runs inside the
instrument. It is capable of running code written in a scripting language called
Lua (http://www.lua.org). This makes the instrument fully capable of interpreting
and executing code in a way that is similar to Visual Basic (VB) or Java, rather
than only responding to single-line commands. Program statements control
script execution and provide capabilities such as variables, functions, branching,
and loop control.
Because scripts are programs, they are written using a programming language,
called the test script language or TSL. TSL is derived from the Lua scripting
language. For details about TSL, see the Test Script Language (TSL) reference
(on page 2-33).
In this manual, we refer to Lua as the "test script language" or "TSL." The TSP
runs portions of TSL code called "chunks." Most messages sent to the
instrument are directly executed by the TSP as TSL chunks. The simplest
messages sent to the instrument are individual instrument control commands.
Even though these messages are executed as TSL chunks, using them is no
different than using a conventional instrument. You send a command message
and the instrument executes that command. When sending individual command
messages, it is irrelevant that the TSP is executing the message as a chunk.
The command set for each TSP-enabled instrument is referred to as the
"instrument control library" or ICL. Each TSP-enabled instrument will have its
own set of ICL commands. Although each TSP-enabled instrument inherits the
same TSL, different instruments extend the language in their own way.
ICL commands are similar to the commands sent to a conventional instrument,
but ICL commands appear like function calls or assignment statements. For
example, the command to set ASCII precision to 10 for ASCII readings is:
format.asciiprecision = 10
Similarly, the command to format readings as ASCII is:
format.data = format.ASCII
These commands do not need to be sent as separate messages. They can be
combined into one message by joining the two commands together with a space
separating them. The resulting chunk would be as follows:
format.asciiprecision = 10 format.data = format.ASCII