Keithley 708B Reference Manual page 212

Switching matrix
Hide thumbs Also See for 708B:
Table of Contents

Advertisement

Models 707B and 708B Switching Matrix Reference Manual
Steps to create a function using a script
Steps
1. In TSB Embedded, enter a name into the
TSP Script box
2. Enter the function as the body of the script
3. Click Save Script
4. Run the script as a function
5. Run the new function with a value
Group commands using the function keyword
The following script contains Instrument Control Library (ICL) commands that display the name of the
person that is using the script on the front panel of the instrument. It takes one parameter to represent
this name. When this script is run, the function is loaded in memory. Once loaded into memory, you
can call the function outside of the script to execute it.
When calling the function, you must specify a string for the name argument of the function. For
example, to set the name to John, call the function as follows:
myDisplay("John")
Example: User script
User script created in Test Script Builder
function myDisplay(name)
display.clear()
display.settext(name .. "$N is here!")
end
Operators
Lua variables and constants can be compared and manipulated using operators.
707B-901-01 Rev. A / August 2010
Section 6: Instrument programming
Example
MakeMyFunction
This example concatenates two strings:
MyFunction = function (who)
print("Hello " .. who)
end
MakeMyFunction now exists on the instrument in a global
variable with the same name as the script
(MakeMyFunction). However, the function defined in the
script does not yet exist because the script has not been
executed.
MakeMyFunction()
This instructs the instrument to run the script, which creates
the MyFunction global variable (which is also a function).
MyFunction("world")
The response message is:
Hello world
User script created in user's own program
loadscript
function myDisplay(name)
display.clear()
display.settext(name.." $N is here!")
end
endscript
6-21

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

707b

Table of Contents