Section 5: Introduction to TSP operation
Models 707B and 708B Switching Matrix Reference Manual
5-2
707B-901-01 Rev. B / January 2015
Example 1
beeper.beep(0.5, 2400)
delay(0.250)
beeper.beep(0.5, 2400)
Emit a double-beep at 2400 Hz. The sequence is
0.5 s on, 0.25 s off, 0.5 s on.
Example 2
You can use the results of a function-based command directly or assign variables to the results for
later access. The following code defines
x
and prints it.
x = math.abs(-100)
print(x)
Output:
100
Attributes
Attribute-based commands are commands that set the characteristics of an instrument feature or
operation. For example, some characteristics of TSP-enabled instruments are the model number
(
localnode.model
) and the brightness of the front-panel display (
display.lightstate
).
Attributes can be read-only, read-write, or write-only. They can be used as a parameter of a function
or assigned to another variable.
To set the characteristics, attribute-based commands define a value. For many attributes, the value is
in the form of a number or a predefined constant.
Example 1: Set an attribute using a number
beeper.enable = 0
This attribute controls the beeps that occur when
front-panel controls are selected. Setting this attribute to 0
turns off the beeper.
Example 2: Set an attribute using a constant
format.data = format.REAL64
Using the constant
REAL64
sets the print format
to double precision floating point format.
To read an attribute, you can use the attribute as the parameter of a function, or assign it to another
variable.
Example 3: Read an attribute using a function
print(format.data)
Reads the data format by passing the attribute
to the print function. If the data format is set to
3, the output is:
3.000
This shows that the data format is set to double
precision floating point.
Example 4: Read an attribute using a variable
fd = format.data
This reads the data format by assigning the
attribute to a variable named
fd
.