Topic: DMD0423

Help File Version: 2.9.4.37

COPY - Copy Data


The Copy Data (COPY) instruction copies the source data values to the destination locations. The instruction contains up to 50 rows, with each row containing one copy data operation. Each time the instruction is executed, all of the copy operations are performed in the order they are listed in the instruction.

 

Generally speaking, a copy operation can copy a single constant value to one or more sequential locations, or copy the data in one sequential range of locations to a different sequential range of locations. There are some caveats based on the data type which are discussed in the parameter section below and will be enforced by the instruction editor.

 

Note: pay attention to the Red / Green dot in the upper right corner of the instruction editor. If the dot is green all of the currently entered rows are correct. If the dot is red there's a problem with one or more of the rows; you can press the Return key to get a detailed explanation of what is wrong with the contents of the rows.

 

Row Editor Keys:

The following functions are used to add or remove rows, edit existing rows or reorganize the rows in the instruction: OK closes the editor, saving any changes / Cancel closes the editor, discarding any changes. Insert inserts an empty row before the currently selected row / Remove deletes the currently selected row. Move Up / Move Downmoves the currently selected row up one row or down one row respectively.

 


Parameters:

Note: Use the F9 key to open the Default Element Selection Tool (the Element Picker or the Element Browser) or use the Down-Arrow key (Auto-Complete) on any parameter field to see a complete list of the memory locations that are valid for that parameter of the instruction.

 

Source is the constant value, memory location, structure or string that contains the data to be copied. Casts are allowed.

 

Destination is the writable memory location (or first element in the range if multiple destination locations will be used). Casts are allowed.

If Source is one bit of data (constant or bit memory location):

Can copy single constant value of 0 or 1 to single bit location or multiple sequential bit locations. Can copy a sequential range of bit locations to a different sequential range of bit locations.

If Source is numeric data (constant or numeric memory location):

Can copy single constant value to single numeric location or multiple sequential numeric locations. Can copy a sequential range of numeric locations to a different sequential range of numeric locations.

If Source is a structure:

Can copy one structure to a single structure of the same type. Can copy a sequential range of structures to a different sequential range of structures of the same type.

If Source is a string:

Can copy one string to another string, or copy a sequential range of strings to a different sequential range of strings. If the Destination string’s maximum length is smaller than the Source string’s actual string length, the Destination string will be truncated in order to fit its maximum length.

Number of Elements specifies the number of sequential elements to copy. This can be any integer constant value that is within the range Source and Destination locations.


Input Leg selects which of the following power-flow conditions will cause this instruction to run:

 

  • Edge Triggered means the instruction will run to completion each time the input ladder logic transitions from OFF to ON.
     
  • Power flow enabled means the instruction will run repeatedly as long as the input ladder logic remains ON.

Ladder Display:

 

By default, this instruction will expand vertically to display all of the steps in the instruction. The displayed size of the instructions can be limited to a single line that displays the total number of line by setting the View -> Options -> Ladder Tab -> Lengthy Instructions... option to 'Display Short Summary'.

 

 

The resulting status display will be reduced to the following:

 

 


See Also:

COPY - Copy Data

 

INIT - Initialize Data

 

MAPIO - Map Inputs and Outputs

 

MEMCLEAR - Clear Memory Range

 

MEMCOPY - Copy Memory Range

 

MOVE - Move Value

 

MOVEBIT - Move Single Bit

 

MOVER - Move Range of Values

 

REFWRITE - Write Value Indirectly

 

RSTR - Reset Range

 

SETNUMR - Set Numeric Range

 

SETR - Set Range

 

STRCOPY - Copy String

 

STRCOPYR - Copy a Range of Strings

 


Rung Example: