ST_IEC870_5_101Stream

Variables of this type are used for data buffer (Stream). In the stream "raw" databytes are buffered in that order they have to be sent /received later. During sending or receiving the data byte zero is sent/received first.

TYPE ST_IEC870_5_101Stream :
STRUCT
    length  : DWORD := 0; (* current stream length *)
    data    : ARRAY[0..IEC870_MAX_ASDU_DATA_BYTE] OF BYTE; (* stream data *)
END_STRUCT
END_TYPE

length: Current number of data bytes in the stream;

data: Stream data buffer;

 

Memory description of a stream variable with an intermediate stored DWORD variable with the value: 16#BECF1234. Please regard the interchanged data bytes in the Intel format!

length

data

4

16#34

16#12

16#CF

16#BE

...

...

...

...

...

...

...

IEC870_MAX_ASDU_DATA_BYTE

 

Please use the following functions to change the memory content of  a stream variable:

Function

Description

F_iecResetStream

Stream Initialisation /Reset.

F_iecCopyBufferToStream

Copies data bytes from an external buffer variable to the stream. The memory content of the stream variable increases.

F_iecCopyStreamToBuffer

Copies data bytes from the stream to an external buffer variable. The memory content of the stream variable remains unchanged.

F_iecCopyStreamToStream

Copies data bytes from one stream to another stream. The memory content of the source variable remains unchanged. The memory content of the target variable increases.

F_iecMoveStreamToBuffer

Copies data bytes from the stream to an external buffer variable and deletes afterwards the copied data bytes in the stream. The memory content of the stream variable decreases.

F_iecMoveStreamToStream

Copies data bytes from the source stream to the target stream an deletes afterwards the copied data bytes in the source stream. The memory content of the source variable decreases and the memory content of the target variable increases.

 

Requirements

Development Environment

Target System

PLC libraries to include

TwinCAT v2.9.0 Build >= 1030

PC or CX (x86)

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

TwinCAT v2.10.0 Build >= 1301

CX (ARM)