Query the state of a system switch.
A system switch is a software controlled switch, which is an alternative to hardware a jumper. The state of the switch is persistent.
The state of the system switch can be changed with the boardSysSwitchSet function.
Input:
id : DINT;
The id of the system switch to query.
_SSW_CAN_1_TERM
|
CAN Termination
|
_SSW_CAN_1_WR
|
CAN Write enable
|
_SSW_CAN_2_TERM
|
CAN2 Termination
|
_SSW_CAN_2_WR
|
CAN2 Write enable
|
_SSW_RS485_1_TERM
|
RS485_1 Termination
|
_SSW_RS485_2_TERM
|
RS485_2 Termination
|
Output:
state : SINT;
The state of the system switch.
Returns: BOOL
1
|
Successful.
|
0
|
Not supported.
|
-1
|
The system switch do not exist
|
Declaration:
FUNCTION boardSysSwitchGet : INT;
VAR_INPUT
id : DINT;
state : ACCESS SINT;
END_VAR;
Example:
INCLUDE rtcu.inc
PROGRAM example;
VAR
state : SINT;
END_VAR;
boardSysSwitchGet(id:=_SSW_CAN_1_WR, state:=state);
IF state = 1 THEN
DebugMsg(message := "CAN write is supported");
ELSE
DebugMsg(message := "CAN write is not supported");
END_IF;
BEGIN
. . .
END;
END_PROGRAM;
|