IEC strings always contain the number of characters. Preceding is a 4 byte header.
The character string must be terminated with one byte containing zero. The memory representation may contain one byte padding to fulfill 2 byte alignment. All IEC strings use internally a structure IecStringEx
The default string IECString80's maximum size is 80 bytes, which is set implicitly. The memory representation is 80 characters of string content + 4 byte header + 1 byte terminating zero + padding for two byte alignment.
The IEC user string type can be defined to the users needs. The memory representation is the amount of characters in the string + 4 byte header + 1 byte terminating zero + padding for two byte alignment. For user defined strings, a structure of type "IecStringEx" is necessary. The Init()
method of this string must set its maximum size via .maximumLength
.
The IecStringEx structure contains the members maximumLength
and currentLength
The member maximumLength must be initialized to the required size before use.
A field of the type IecStringEx
must have the FieldOffset()
attribute, to define the beginning of the IEC strings physical representation.
Both function blocks copy the input string VALUE
to the output string RESULT1
and
set the output string RESULT2
to a different text controlled by input MESSAGE_ID
.
-
FunctionBlock1
Implements the function block with parameter passing by value
-
FunctionBlock2
Implements the function block with parameter passing by reference which means
[InOut]
parameter declaration is used.