Section 5: Introduction to TSP operation
Series 2600B System SourceMeter® Instrument Reference Manual
5-2
2600BS-901-01 Rev. B / May 2013
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 state of the beeper (
beeper.enable
).
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.00
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
.
Queries
Test Script Processor (TSP
®
) enabled instruments do not have inherent query commands. Like any
other scripting environment, the
print()
and
printnumber()
commands generate output in the
form of response messages. Each
print()
command creates one response message.
Example
x = 10
print(x)
Example of an output response message:
1.01
Note that your output may be different if you set your ASCII
precision setting to a different value.
Содержание System SourceMeter 2601B
Страница 841: ......