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
Parameter description
| Interface variable | Declaration | Data type | Description |
|---|---|---|---|
| SOURCE_ARRAY | VAR_Input | ARRAY of BYTE or ARRAY of CHAR | ARRAY variable name used to save the data stream that will be deserialized |
| POS | VAR_IN_OUT | DINT | The 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_VAR | VAR_IN_OUT | ANY_TYPE | Destination variable used to deserialize data to be written |
| Function name | Return value | INT | Error message |
Return value error code
| Error code (hexadecimal code) | Description |
|---|---|
| 0000 | No error |
| 80B0 | The storage areas of parameters SOURCE_ARRAY and DEST_VAR overlap |
| 8136 | The variable at the SOURCE_ARRAY parameter is illegal |
| 8151 | Invalid reference in SOURCE_ARRAY parameter |
| 8153 | SOURCE_ARRAY parameter does not have enough available data COPY to DEST_VAR |
| 8154 | The data type in the SOURCE_ARRAY parameter is invalid |
| 8250 | NULL pointer passed at DEST_VAR parameter |
| 8251 | Invalid reference in DEST_VAR parameter |
| 8382 | The value of the POS parameter exceeds the limit of the array |
Example
-
LD sample pictures are shown below:

-
ST example is shown in the following code:
ss:=DESERIALIZE(SOURCE_ARRAY:=dd,POS:=darr[0],DEST_VAR:=ss);