ST_IEC870_5_103TBuffer

This data structure is used for data exchange (TX/RX data buffer) via the IEC60870-5-103 Serial Link Interface.

TYPE ST_IEC870_5_103TBuffer :
STRUCT
    eDbg     : E_IEC870_5_101FifoDbgFlags :=eIEC870_FIFO_DBG_OFF; (* enable/disable log view hex output *)
    asduSize : BYTE := 249; (* max. length of ASDU data *)
    mode     : DWORD := 0; dataLink : ST_IEC870_5_101DataLink; (* internal tx/rx buffer *)
ND_STRUCT
END_TYPE

eDbg: Debug output parameter.

asduSize: Common asdu address octet size.

mode: Reserved, not used. This value must be zero.

dataLink: Internal Tx/Rx buffer. The access to the elements of this data structure should only occur with an instance of the function block FB_IEC870_5_103TBufferCtrl, not directly.

The TX/RX data buffer uses internal two send Fifos and one receive Fifo:

  1. Class 1 send Fifo with (high prior) data;
  2. Class 2 send Fifo with (low prior) data;
  3. Receive Fifo (for Class 1 and Class 2 data);

The lower transport functions of the library emtpy first the class 1 Fifo and afterwards the class 2 Fifo. The class 2 data are only sent if the class 1 Fifo contains no data to be sent.

Each internal Fifo hast a fixed size of 10000 bytes. This is enough for the most applications, because the number of frames which can once be sent is limited by the iK and iW protocol parameters.
According to experience it is possible to store 200 ADSUs with an information element (object), or approx. 20 ADSUs with with a sequence of 100 information elements (objects) in each Fifo.

If a higher number of frames (to be sent or to be received) should be buffered ( e.g. ~20000), they can be kept in external buffers/Fifos which are defined by the PLC programmer. The PLC application can refill the TwinCAT send Fifos with own Fifo entries, or empty the TwinCAT receive Fifo.

As an alternative it is possible to use two buffers and to fill/read them alternately and give them to the communication block .

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.10.0 Build >= 1313

PC or CX (x86, ARM)

TcIEC870_5_103Link.Lib

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