F_iecGetSPI

 

F_iecGetSPI 1:

This function decodes the single point information from byte variable. One byte variable yields up to 8 single points information. Every single point information occupies 1 bit.

FUNCTION F_iecGetSPI: E_IEC870_5_101SPI

E_IEC870_5_101SPI

VAR_INPUT
    in     : BYTE; (* Byte variable from where the single point information have to be decoded *)
    offset : UDINT(0..7); (* Single point information offset *)
END_VAR

 

Example:

Decoding the information of 4 single points from byte variable.

PROGRAM MAIN
VAR
    memarea AT%MB0 : ARRAY[0..10] OF BYTE;
    eSPI           : E_IEC870_5_101SPI;
ENd_VAR
eSPI := F_iecGetSPI( memarea[0], 0 );
eSPI := F_iecGetSPI( memarea[0], 1 );
eSPI := F_iecGetSPI( memarea[0], 2 );
eSPI := F_iecGetSPI( memarea[0], 3 );

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 )