Testing the communication

Here you can unpack the complete PLC sources: TutorialSample.zip

You can simulate the command transmission. Setting the bExecuteCmd variable to TRUE enables and to FALSE disables the simulation. In our example single command (C_SC_NA_1, IOA = 10) is send cyclicaly every 10 seconds to the controlled station.

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

...