
Series 3700A System Switch/Multimeter Reference Manual
Section 11: TSP command reference
3700AS-901-01 Rev. D/June 2018
11-73
Example 1
channel.close("4005, 4007, 4017, 4003")
State = channel.getstate("4001:4020")
print(State)
Close channels 5, 7, 17, and 3 on slot 4.
Query the state of the first 20 channels on
slot 4.
View the response assigned to State.
Output (assuming a Model 3720):
0,0,1,0,1,0,1,0,0,0,0,0,0,0,0,0,1
,0,0,0
Example 2
PathList = channel.pattern.getimage("Path")
print(Path)
print(channel.getstate(Path))
See the state of channels and analog
backplane relays in the channel pattern
called
"Path"
.
Output:
4003,4005,4007,4017,4911,4922
1,1,1,1,1,1
Example 3
PathState = channel.getstate("Path")
print(PathState)
Another way to see the state of channels and
analog backplane relays in channel pattern
"Path"
in Example 2 without getting the
channels and analog backplane relays first.
Output:
1,1,1,1,1,1
Example 4
if bit.bitand(channel.IND_OVERLOAD,
tonumber(channel.getstate("4010"))) == 1
then
print("OVERLOAD")
end
Use the following command to check for an
overload on a DAC channel.
In the previous example,
channel.getstate()
returns a string that
is converted to a number using the Lua
tonumber()
command.
channel.IND_OVERLOAD
equates to the
number 2. Because the state is a bit-oriented
value, a logical AND operation must be
performed on the state and the overload
constant to isolate it from other indicators.
The
tonumber()
command only works with
a single channel. When multiple channels
are returned (for example,
channel.getstate("slot4")
), this
string must be parsed by the comma
delimiter to find each value.
Also see
(on page 11-92)