Series 3700A System Switch/Multimeter Reference Manual
Section 10: Instrument programming
3700AS-901-01 Rev. D/June 2018
10-33
Programming example: Script with a for loop
The following script puts a message on the front panel display slowly
— one character at a time. The
intent of this example is to demonstrate:
•
The use of a
for
loop
•
Simple display remote commands
•
Simple Lua string manipulation
When creating a script using the TSB Embedded, you do not need the shell commands
loadscript
and
endscript
, as shown in the examples below.
Example: User script
User script created in TSB Embedded
User script created in user's own program
loadscript
display.clear()
myMessage = "Hello World!"
for k = 1, string.len(myMessage) do
x = string.sub(myMessage, k, k)
display.settext(x)
print(x)
delay(1)
end
display.clear()
myMessage = "Hello World!"
for k = 1, string.len(myMessage) do
x = string.sub(myMessage, k, k)
display.settext(x)
print(x)
delay(1)
end
endscript
Using Test Script Builder (TSB)
Keithley Instruments Test Script Builder (TSB) is a software tool that simplifies building test scripts.
You can use TSB to perform the following operations:
•
Send remote commands and Lua statements
•
Receive responses (data) from commands and scripts
•
Create, manage, and run user scripts
•
Debug scripts
•
Import factory scripts to view or edit and convert to user scripts
The Keithley Instruments Test Script Processor (TSP
®
) scripting engine is a Lua interpreter. In TSP-
enabled instruments, the Lua programming language has been extended with Keithley-specific
instrument control commands. For more information about using the Lua scripting language with
Keithley TSP-enabled instruments, refer to
Fundamentals of programming for TSP