FUNCTION_BLOCK FB_TwinSAFE_KLx904_output

The function block FB_TwinSAFE_KLx904_output can be used for evaluation of TwinSAFE data sent from a KL6904 to a KL1904 or KL2904. The input parameter is doubly linked to the SafetyQBx data of a KL6904 in the System Manager.
VAR_INPUT
VAR_INPUT
KL6904_SafetyQBx AT%I* : TwinSAFE_Data; (* Additional link to "SafetyQBx" *)
END_VAR
KL6904_SafetyQBx: TwinSAFE telegram sent from a KL6904 to a KL1904 or KL2904. This parameter is doubly linked to SafetyQBx in the System Manager (input data of the KL6904); x represents for numerals between 1 and 15, according to the TwinSAFE connection used.
VAR_OUTPUT
VAR_OUTPUT
bOutput1 : BOOL;
bOutput2 : BOOL;
bOutput3 : BOOL;
bOutput4 : BOOL;
tCycleTime : TIME;
bConnectionInRun : BOOL;
END_VAR
bOutput1: Returns output 1 of a KL2904. If the function block is used for a connection to the KL1904, this value is always 0.
bOutput2: Returns output 2 of a KL2904. If the function block is used for a connection to the KL1904, this value is always 0.
bOutput3: Returns output 3 of a KL2904. If the function block is used for a connection to the KL1904, this value is always 0.
bOutput4: Returns output 4 of a KL2904. If the function block is used for a connection to the KL1904, this value is always 0.
tCycleTime: Returns the cycle time in ms for exchanging the TwinSAFE telegram between the devices.
bConnectionInRun: Returns TRUE if there is no error in the connection between the KL6904 and the KLx904.
Example of a call in the FBD
PROGRAM MAIN
VAR
fbTwinSAFE_KLx904_output : FB_TwinSAFE_KLx904_output;
bOutput1_KL6904_Connection_to_113 : BOOL;
bOutput2_KL6904_Connection_to_113 : BOOL;
bOutput3_KL6904_Connection_to_113 : BOOL;
bOutput4_KL6904_Connection_to_113 : BOOL;
tCycleTime_KL6904_KL1904 : TIME;
bConnection3_In_Run_2 : BOOL;
END_VAR

In the example the values of TwinSAFE terminals KL6904 and KL1904 are evaluated. Since no output signals are used in this connection, the outputs are always FALSE. Only tCycleTime and bConnectionInRun can be evaluated.

In the example the values of TwinSAFE terminals KL6904 and KL1904 are evaluated. In this connection the output signals are written to the KL2904 and copied from the function block to the connected variables. If the output bConnectionInRun is FALSE, all outputs are set to FALSE.
To link the input data, select the parameter KL6904_SafetyQBx and select "Modify link..." from the context menu.

and select the corresponding SafetyQBx variable in the dialog that follows.

Development environment |
Target platform |
IO Hardware |
PLC libraries to include |
---|---|---|---|
TwinCAT v2.10.0 Build > 914 |
PC (i386) |
KLx904 |
TcTwinSAFE.Lib |
TwinCAT v2.10.0 Build > 914 |
BX series |
KLx904 |
TcTwinSAFE.LBX |