PLC Copy, Pack & Unpack

Copy functions copy a value from a source register to destination register.  
The source register isn’t affected by the operation.

Source# of BitsDestinationWhat Happens
=Data is copied.
<Source is copied into lower bits. Upper bits are typically left in their previous state. Verify with PLC manual.
>Lower bits of source are copied into destination.

Pack functions copy bits from specific locations into an integer.
Why: It may be more convenient to store a set of On Off values inside an integer, instead of keeping track of individual bits, or perhaps you need the in integer form to export them serially.

Example: ¬†Pack Bit_A into the 3’rd bit of Integer_B

Unpack¬†functions copy an integer’s¬†individual¬†bits into specific bit registers.
Why: An integer may represent many On Off values and now you need to break them out

Example: Unpack the 3’rd bit of Integer_B into Bit_A