rfbcSetSwitchState (Function)

Top  Previous  Next

Architecture:

X32 / NX32L

Device support:

AX9 pro, CX1 pro/pro-c/warp/warp-c, SX1, AX9 turbo, NX-900, LX5

Firmware version:

2.60 / 1.51.00


This function will send a switch-change request.

Most devices will only accept switch-change requests when paired with the RTCU device.

 

Note: if the request is broadcasted then the function will not wait for any confirmation.

 

Input:

id  : DINT [0 .. 16_777_215] (default 0)

The ID of the device to receive the request.

If the ID is "0" (zero), the request will be broadcast.

 

output : SINT [0..31] (default 1)

The index of the output to update.

 

state : BOOL (default ON)

ON/TRUE

-

Request switch to power on output.

OFF/FALSE

-

Request switch to power off output.

 

Output:

None.

 

Returns: INT

0

-

Sent.

-1

-

Interface is not open (see rfbcOpen).

-4

-

RF communication is not available.

-5

-

Communication error - addressed message sent but not confirmed.

-6

-

Error in parameter.

 

Declaration:

FUNCTION rfbcSetSwitchState : INT;
VAR_INPUT
  id          : DINT := 0;
  output      : SINT := 1;
  State       : BOOL := ON;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
VAR_INPUT
  hisId : DINT;
END_VAR;
 
PROGRAM example;
hisId := 208024011 MOD 16#FFFFFF; // id of known device
rfbcOpen();
BEGIN
 ...
  rfbcSetSwitchState(id := hisId, output := 1, state := ON);
 ...
END;
END_PROGRAM;