COP (copy)
Copies the binary data in the source element to the destination element. The source element remains unchanged.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the L20E, L50E, and L70E controllers.
COP

Parameter | Parameter Type | Data Type | Description | |
---|---|---|---|---|
Enable | Input | BOOL | Instruction block enable. COP is level triggered.
| |
Src | Input | BOOL SINT USINT BYTE INT UINT WORD DINT UDINT | DWORD REAL TIME DATE STRING LWORD ULINT LINT LREAL | The source element for copying, one-dimensional array or non-array. If the source is a STRING data type the destination must be a either a STRING data type or a USINT (UCHAR and BYTE) data type. If it is not, a data type mismatch is reported. |
SrcOffset | Input | UINT | The input parameter that defines the starting point of a one-dimensional array within the source data to start the copying process. Set the offset to 0:
| |
Dest | Input | BOOL SINT USINT BYTE INT UINT WORD DINT UDINT | DWORD REAL TIME DATE STRING LWORD ULINT LINT | The destination element to store the copied value from the one-dimensional array or non-array source element. If the destination is a STRING data type, the source must be either a STRING data type or a USINT (UCHAR and BYTE) data type. If it is not, a data type mismatch is reported. |
DestOffset | Input | UINT | The input parameter that defines the starting point within the destination data to store the copied elements. Set the offset to 0:
| |
Length | Input | UINT | The number of destination elements to copy. When the destination is a STRING data type, it indicates the number of strings to be copied. | |
Swap | Input | BOOL | Byte-swapping happens before extracting and manipulating high and low 8-bit parameters
A swap operation does not occur if:
| |
Sts | Output | UINT | Status of the copy operation. The definitions for the Sts parameter are defined in COP status codes. | |
ENO | Output | BOOL | Enables output. Applies only to ladder diagram programs. |
COP Status code | Status description |
---|---|
0x00 | No action taken (not enabled). |
0x01 | COP function block success. |
0x02 | Destination has spare bytes when copying from String. |
0x03 | Source data are truncated. |
0x04 | Copy length is invalid. |
0x05 | Data type mismatch when there is String Data type as either source or destination. |
0x06 | Source data size is too small for copy. |
0x07 | Destination data size is too small for copy. |
0x08 | Source Data offset is invalid. |
0x09 | Destination Data offset is invalid. |
0x0A | Data is invalid in either source or destination. |
COP examples
COP function block diagram example

COP ladder diagram example

COP structured text example

Provide Feedback