Type
| Function block |
Description
| The UNPACK function block re-converts the data applied to the SRC input/output (data converted to a proprietary data exchange format valid for all target systems with the PACK function block) to the data format required for the actual target system. The re-converted (unpacked) data are stored to the DST data buffer.Data conversion is started with a rising edge at the REQ input. When the process is completed, the DONE output is set to TRUE. If an error occurs during execution, the ERROR output is set to TRUE. While ERROR = TRUE, the ERROR_ID output provides information on the cause of the error.The conversion process runs in the background, i.e., the process is assigned to a background task. |
Notes
|
- The converted data are only valid if the DONE output is set to TRUE and the ERROR_ID output indicates the value '0'.
- Function blocks have to be instantiated. The instance name of the function block has to be declared in the 'Variables' table of the POU where the FB is going to be used. The instance name must be unique within the POU.
|
Parameters
| Inputs
REQ
Data type: | BOOL |
Description: | The function block is executed with a rising edge. |
Input/Output
SRC
Data type: | ANY |
Description: | Data buffer which contains the converted data in the data exchange format that can be read by all target systems. |
DST
Data type: | ANY |
Description: | Data buffer which contains the data in the format required for the actual target system. |
Outputs
DONE
Data type: | BOOL |
Description: | The value TRUE indicates the completion of the data conversion. However, the converted data are only valid if the ERROR_ID output indicates the value '0' at the same time. |
BUSY
Data type: | BOOL |
Description: | The output is set to TRUE while the data conversion is in progress. After completion of the data conversion, the output is set to FALSE. |
ERROR
Data type: | BOOL |
Description: | If an error occurred during execution of the function block, the output is set to TRUE. The ERROR_ID output provides information on the error occurred while ERROR = TRUE. |
ERROR_ID
Data type: | UINT |
Description: | If an error occurred during execution of the function block, the output returns the error code providing information on the cause of the error (see below for the list of errors). The value of the output is only valid while ERROR = TRUE. |
|
Error codes
| Error codes at the ERROR_ID output
Value | Meaning |
0 | Data successfully converted. |
2 | The size of the destination buffer that is connected to the PACK function block is too small.(This error code is specific to the PACK function block.) |
3 | A new job was started while another job has not been finished. |
4 | The data format of the packed data is not congruent to the type of the destination buffer. |
6 | The version number of the packed data is not supported by the UNPACK function block.(This error code is specific to the UNPACK function block.) |
7 | The connected data type is not supported for the PACK/UNPACK function blocks.Supported data types:
- Elementary, single byte strings that are generated by the IEC Engineering tool
- Structs and arrays, generated by the IEC Engineering tool
- Combinations of previous mentioned data types
|
8 | Maximum nesting level (of 12) of user data types exceeded. |
>= 1000 | Internal error |
|