Test of the communication
This chapter refers directly to the example tutorial. A simple simulation of the commands in the control direction is activated by setting the bExecuteCmd variable to TRUE and deactivated by setting it to FALSE. If there is an active connection, a single command (C_SC_NA_1, IOA = 10) is transmitted cyclically to the substation every 10 seconds in this example.
PROGRAM MAIN
VAR
...
bExecuteCmd : BOOL;
timer : TON;
...
END_VAR
...
(* Simple command simulation *)
timer( IN := bExecuteCmd, PT := T#10s ); (* Send cyclic command *)
IF timer.Q THEN
timer( IN := FALSE );
cmdSingle_0 := NOT cmdSingle_0; (* toggle single command ON<->OFF *)
(* cmdDouble_0 := SEL( cmdDouble_0 = 1, 1, 2 );
cmdBitStr_0 := cmdBitStr_0 + 1;
cmdNormalized_0 := cmdNormalized_0 + 2;
cmdScaled_0 := cmdScaled_0 + 4;
cmdFloating_0 := cmdFloating_0 + 1.2; *)
END_IF
...
The associated PLC example tutorial can be downloaded here.