F_iecSetDCS

 

F_iecSetDCS 1:

This function encodes the double command state in the byte variable. One byte variable yields up to 4 double command states. Every double command state occupies 2 bits.

FUNCTION F_iecSetDCS: BYTE

VAR_INPUT
    in     : BYTE; (* Byte variable where the new double command state have to be encoded. *)
    offset : UDINT(0..3);(* Double command state offset. *)
    eDCS   : E_IEC870_5_101DCS; (* The new value of double command state *)
END_VAR

 

Example:

Setting the state of 4 doble commands to ON.

PROGRAM MAIN
VAR
    memarea AT%MB0 : ARRAY[0..10] OF BYTE;
END_VAR
memarea[0] := F_iecSetDCS( memarea[0], 0, eIEC870_DCS_ON );
memarea[0] := F_iecSetDCS( memarea[0], 1, eIEC870_DCS_ON );
memarea[0] := F_iecSetDCS( memarea[0], 2, eIEC870_DCS_ON );
memarea[0] := F_iecSetDCS( memarea[0], 3, eIEC870_DCS_ON );

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.10.0 Build >= 1324

PC or CX (x86, ARM)

TcIEC870_5_101.Lib

( Standard.Lib; TcBase.Lib; TcSystem.Lib; TcUtilities.Lib are included automatically )