Skip to main content

7.11.6 DESERIALIZE

Function

The unsequence instruction reverses the sequence representation of the PLC data type (UDT), STRUCT or ARRAY of (data type) and fills everything. This instruction can gradually convert multiple sequential representations of converted data back to the original state

NOTE
  • PLC data type (UDT), STRUCT or ARRAY of (data type) sequence indicates that the data type of the storage area must be ARRAY of BYTE or ARRAY of CHAR. The maximum size of the array is 64 KB
  • It is recommended to define the lower limit of ARRAY as "0", because the subscript in ARRAY corresponds to the POS parameter value. For example, ARRAY[0] = POS0. The explanations and examples below are based on this formula. After the instruction is executed, POS=POS+the number of bytes occupied by the data

LD graphics

alt text

Parameter description

Interface variableDeclarationData typeDescription
SOURCE_ARRAYVAR_InputARRAY of BYTE or ARRAY of CHARARRAY variable name used to save the data stream that will be deserialized
POSVAR_IN_OUTDINTThe relative subscript position of the array calculated by the POS parameter. The POS parameter will be calculated starting from 0, corresponding to the starting index position of the array. After the instruction is executed, POS=POS+the number of bytes occupied by the data s
DEST_VARVAR_IN_OUTANY_TYPEDestination variable used to deserialize data to be written
Function nameReturn valueINTError message

Return value error code

Error code (hexadecimal code)Description
0000No error
80B0The storage areas of parameters SOURCE_ARRAY and DEST_VAR overlap
8136The variable at the SOURCE_ARRAY parameter is illegal
8151Invalid reference in SOURCE_ARRAY parameter
8153SOURCE_ARRAY parameter does not have enough available data COPY to DEST_VAR
8154The data type in the SOURCE_ARRAY parameter is invalid
8250NULL pointer passed at DEST_VAR parameter
8251Invalid reference in DEST_VAR parameter
8382The value of the POS parameter exceeds the limit of the array

Example

  • LD sample pictures are shown below: alt text

  • ST example is shown in the following code:

ss:=DESERIALIZE(SOURCE_ARRAY:=dd,POS:=darr[0],DEST_VAR:=ss);