F_iecSetSPI

 

F_iecSetSPI 1:

This function encodes the single point information in the byte variable. One byte variable yields up to 8 single point information. Every single point information occupies 1 bit.

FUNCTION F_iecSetSPI: BYTE

VAR_INPUT
    in     : BYTE; (* Byte variable where the new single point information have to be encoded. *)
    offset : UDINT(0..7);(* Single point information offset. *)
    eSPI   : E_IEC870_5_101SPI; (* The new value of single point information. *)
END_VAR

 

Example:

Setting the information of 4 single points to ON.

PROGRAM MAIN
VAR
    memarea AT%MB0 : ARRAY[0..10] OF BYTE;
END_VAR
memarea[0] := F_iecSetSPI( memarea[0], 0, eIEC870_SPI_ON );
memarea[0] := F_iecSetSPI( memarea[0], 1, eIEC870_SPI_ON );
memarea[0] := F_iecSetSPI( memarea[0], 2, eIEC870_SPI_ON );
memarea[0] := F_iecSetSPI( memarea[0], 3, eIEC870_SPI_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 )