-

PACK

Type Function block
Description The PACK function block converts the data (array, structure, etc.) applied to the SRC input/output to a proprietary data exchange format that can be read by all target systems. The converted (packed) data are stored to the DST data buffer (declared as byte array).

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.

Using the UNPACK function block, the data exchange format created with the PACK function block can be re-converted to the data format required for the actual target system.
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 Input

REQ

Input/Output

SRC

DST

Outputs

DONE

BUSY

ERROR

ERROR_ID

CNT
Error codes Error codes at the ERROR_ID output