User manual

Section 13: Instrument Control Library (ICL) Series 3700 System Switch/Multimeter Reference Manual
13-58 3700S-901-01 Rev. C / July 2008
channel.getstate()
Example
To query the state of the first 20 channels on Slot 4:
MyState = channel.getstate('4001:4020')
To see the state of channels and analog backplane relays in channel pattern called
'mypath':
MyPathList = channel.pattern.getimage('mypath')
print(MyPathList)
print(channel.getstate(MyPathList))
or
MyPathState = channel.getstate('mypath')
Although the channel.getstate() command returns a string representing a
number, this can be easily changed to a number and then compared to one of
the provide Lua constants. For example, use the following command to check
for an overload on a DAC channel:
TSP> if bit.bitand(channel.IND_OVERLOAD,
tonumber(channel.getstate("4009"))) == 1 then
print("OVERLOAD") end
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, the state must be ANDed to 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.
channel.getstatelatch()
Function
Gets the mask representing the states which would be latched if they occurred.
Usage
channel.getstatelatch(<ch_list>)
ch_list: String specifying the channels to query, using normal channel list syntax.
Also see
channel.setstatelatch() (on page 13-81)
Example
To query the state event latch on digital I/O Channel 1:
channel.getstatelatch("1001")
channel.gettype()
Function
Returns the type associated with a channel.
Usage
<type> = channel.gettype(<ch_list>)
type: Return string listing the comma-delimited states for channels in ch_list.
ch_list: String specifying the channels to query, using normal channel list syntax.