pipx40_operateSwitch
|
Function |
pipx40_operateSwitch (ByVal vi As Long, ByVal subUnit As Long, ByVal switchFunc As Long, ByVal segNum As Long, ByVal switchNum As Long, ByVal subSwitch As Long, ByVal switchAction As Long, ByRef state As Boolean) As Long | |
|
ViStatus |
pipx40_operateSwitch (ViSession vi, ViUInt32 subUnit, ViUInt32 switchFunc, ViUInt32 segNum, ViUInt32 switchNum, ViUInt32 subSwitch, ViUInt32 switchAction, ViPBoolean state); |
|
Parameter |
I/O |
Description |
|
vi |
in |
Instrument handle |
|
subUnit |
in |
Numeric variable indicating the sub-unit for which information is to be obtained |
|
switchFunc |
in |
A code indicating the functional group of the switch |
|
segNum |
in |
The segment in which the switch is located |
|
switchNum |
in |
The logical number of the switch |
|
subSwitch |
in |
The logical sub-switch |
|
switchAction |
in |
A code indicating the action to perform |
|
state |
out |
The state of the switch (after performing any action) |
Return Value
0 = Successful operation. Negative values are error codes and positive values are warnings. To get a description of the error, pass the error code to pipx40_error_message.
Description
This function obtains, and optionally sets, the state of a switch. It allows explicit access to the individual switches making up a sub-unit, in types where their operation is normally handled automatically by the driver. The main purpose of this is in implementing fault diagnostic programs for such types; it can also be used where normal automated behaviour does not suit an application.
Applicable sub-unit types
This function is only usable with matrix sub-units having auto-isolation and/or auto-loopthru features. For further information see: segmented matrix, unsegmented matrix.
switchFunc Value
A value indicating the functional group of the switch to be accessed.
|
Value |
Ident |
Function |
|
0 |
pipx40_SW_FUNC_CHANNEL |
A channel (matrix crosspoint) switch |
|
1 |
pipx40_SW_FUNC_X_ISO |
A matrix X-isolation switch |
|
2 |
pipx40_SW_FUNC_Y_ISO |
A matrix Y-isolation switch |
|
3 |
pipx40_SW_FUNC_X_LOOPTHRU |
A matrix X-loopthru switch |
|
4 |
pipx40_SW_FUNC_Y_LOOPTHRU |
A matrix Y-loopthru switch |
segNum Value
The segment location of the switch. The numbers and sizes of segments on each matrix axis can be obtained using pipx40_getSubAttribute.
In an unsegmented matrix, use segNum = 1.
In a segmented matrix, segment numbers for crosspoint and isolation switches are determined logically.
switchNum Value
The number of the switch in its functional group (unity-based).
For channel (crosspoint) switches, the switch number can be either:
if segNum is zero, the global channel number of the switch (see channel number)
if segNum is non-zero, the segment-local number of the switch, calculated in a similar way to the above
subSwitch Value
The number of the subswitch to operate (unity-based). This parameter caters for a situation in which a logical channel, isolation or loopthru switch is served by more than one physical relay (as for example when 2-pole operation is implemented using independently-driven single-pole relays).
The numbers of subswitches for each functional group can be obtained using pipx40_getSubAttribute.
switchAction Value
A code indicating the action to be performed.
|
Value |
Ident |
Function |
|
0 |
pipx40_SW_ACT_NONE |
No switch change - just set state result |
|
1 |
pipx40_SW_ACT_OPEN |
Open switch |
|
2 |
pipx40_SW_ACT_CLOSE |
Close switch |
Loopthru switches
Loopthru switches are initialised by the driver to a closed state, which may mean that they are either energised or de-energised depending upon their type. In normal automated operation loopthru switches open when any crosspoint on their associated line is closed. Actions pipx40_SW_ACT_CLOSE and pipx40_SW_ACT_OPEN close or open loopthru switch contacts as their names imply.
Operational considerations
This function can be used to alter a pre-existing switch state in a sub-unit, set up by fuctions such as pipx40_setChannelState or pipx40_setChannelPattern. However once the state of any switch is changed by pipx40_operateSwitch the logical state of the sub-unit is considered to have been destroyed. This condition is flagged in the result of pipx40_getSubStatus (bit pipx40_STAT_CORRUPTED). Subsequent attempts to operate it using 'ordinary' switch functions such as pipx40_setChannelState, pipx40_getChannelState etc. will fail (result pipx40_ERROR_STATE_CORRUPT). Normal operation can be restored by clearing the sub-unit using pipx40_clearSub or pipx40_clearCard.