
Section 5: Introduction to TSP operation
Model 2657A High Power System SourceMeter® Instrument Reference Manual
5-2
2657A-901-01 Rev. B/December 2012
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 saves the value you enter from the front panel and prints it.
value = display.inputvalue("+0.00")
print(value)
If the operator enters 2.36 from the front panel,
the resulting output is:
2.00
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 number of errors in the error queue (
errorqueue.count
).
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
format.data = 3
This attribute sets the format of data printed by
other commands. Setting this attribute to 3 sets
the print format to double precision floating
point format.
Example 2: Set an attribute using a constant
format.data = format.REAL64
Using the constant
REAL64
instead of 3 also
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()
command and other related 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 might be different if you set your ASCII
precision setting to a different value.
Содержание 2657A
Страница 3: ......