Basic instructions
8.6 Move operations
8.6.3
Serialize
You can use the "Serialize" instruction to convert several PLC data types (UDTs) to a
sequential representation without any loss of structure.
You can use the instruction to temporarily save multiple structured data items from your
program to a buffer, for example to a global data block, and send them to another CPU. The
memory area in which the converted PLC data types are stored must have the ARRAY of
BYTE data type and be declared with standard access. Make sure that there is enough
memory space prior to the conversion.
The POS parameter contains information about the number of bytes that the converted PLC
data types use.
Note
If you only want to send a single PLC data type (UDT), you can use the instruction "TSEND:
Send data via communication connection".
Table 8- 77
SERIALIZE instruction
LAD / FBD
Table 8- 78
Parameters for the SERIALIZE instruction
Parameter
SRC_VARIABLE
DEST_ARRAY
POS
RET_VAL
272
SCL
ret_val := Serialize(
Type
Data type
IN
Variant
INOUT
Variant
INOUT
DInt
OUT
Int
SRC_VARIABLE=>_variant_in_,
DEST_ARRAY:=_variant_out_,
POS:=_dint_inout_);
Description
Converts a PLC data type
(UDT) to a sequential repre-
sentation.
Description
PLC data type (UDT) that is
to be converted to a serial
representation
Data block in which the gen-
erated data stream is to be
stored
Number of bytes that the
converted PLC data types
use. The calculated POS
parameter is zero-based.
Error information
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK