Move in Advanced Ladder

See also: Project Toolbox for Advanced Ladder

 

Topic Menu

 

Move Operations Overview

See also: Move Constant Data in Advanced Ladder

See also: Shift and Rotate Elements in Advanced Ladder

See also: Move Stepper in Advanced Ladder

 

Home > View > Project Toolbox > Move Operations

The Move Operations allow data values to be copied or moved from one place to another in variables or arrays or registers. They are useful for initializing values at run time or capturing the state of values during a process, among other things. The Move operations work at a bit level, ignoring data formats. The data formats REALClosed These numbers use IEEE 754-1985 format to store numbers in following ranges. 32-bit single-precision floating point (REAL) – -3.40282E+38 to +3.40282E+38 64-bit double-precision floating point (LREAL) – -1.79769E+308 to +1.7976E+308 Floating Point refers to both REAL and LREAL data types. and LREALClosed These numbers use IEEE 754-1985 format to store numbers in following ranges. 32-bit single-precision floating point (REAL) – -3.40282E+38 to +3.40282E+38 64-bit double-precision floating point (LREAL) – -1.79769E+308 to +1.7976E+308 Floating Point refers to both REAL and LREAL data types. are provided for ease of use in some instances. The Move operations will execute regardless of the values in the source and will always pass power flow. The only exception to this is the Indirect Block Move as noted below. Move Operations are configured with a Source and a Destination. In the case of Move operations that work to move multiple values, the Source and/or Destination may be just the first of multiple consecutive array elements or registers.

Move Data

The Move Data function will copy a single value from the Source (IN) to the Destination (Q).

Move Data Parameters

Note: The “Count” parameter is always locked to 1 and disabled for the Move function

Power Flow

The Move function executes immediately and entirely as soon as it receives power from the incoming rung. The resulting data in the Destination (Q) is available for any other use immediately.

The Move function will execute on every scan that it has received power from the incoming rung. The Move function will always pass power flow to the next function on the rung.

There is no need for any further functions to exist to the right of the Move function on the rung. The function’s result is considered an output.

Move Data Examples

Initialize a variable/register to a value of 0 on first scan:

In Register Based Advanced Ladder Logic:

In Variable Based Advanced Ladder Logic:

 

Capture a value if it exceeds a level: Compare in Advanced Ladder

 

Return to the Top: Move in Advanced Ladder

Move Block

The Block Move function will copy one or more values from the Source (IN) to the Destination (Q).

Move Block Parameters

Note: If there were a block of REAL values to move, a DWORD Block Move would work the same as a REAL Block Move since both types are 32-bits in length and since the Move Operations simply move all bits regardless of the specified type.

Power Flow

The Block Move function executes immediately and entirely as soon as it receives power from the incoming rung. The resulting data in the Destination (Q) is available for any other use immediately.

The Block Move function will execute on every scan that it has received power from the incoming rung. The Block Move function will always pass power flow to the next function on the rung.

There is no need for any further functions to exist to the right of the Block Move function on the rung. The function’s result is considered an output.

Return to the Top: Move in Advanced Ladder

Fill Block

The Block Fill function will copy one value from the Source (IN) into one or more locations specified by the Destination (Q).

Block Fill Parameters

  • IN: The Source of the data to be filled into all Destination locations. Can be a variable/register, array element, or a constant, “hard-coded” value

  • Q: The first of a group of consecutive locations of the Destination where a copy of the Source data will be placed. Must be a variable/register or array element

  • N: The Count parameter defines the number of values to move, i.e. the size of the block.

Note: The Block Fill function only supports WORD (16-bit) format.

Power Flow

  • The Block Fill function executes immediately and entirely as soon as it receives power from the incoming rung. The resulting data in the Destination (Q) is available for any other use immediately.

  • The Block Fill function will execute on every scan that it has received power from the incoming rung.

  • The Block Fill function will always pass power flow to the next function on the rung.

  • There is no need for any further functions to exist to the right of the Block Fill function on the rung. The function’s result is considered an output.

Block Fill Examples

Initialize 5 elements of an array, or 5 registers, to a value of 50 on first scan:

In Register Based Advanced Ladder Logic:

In Variable Based Advanced Ladder Logic:

Zero 20,000 registers on first scan:

Return to the Top: Move in Advanced Ladder

Indirect Move Block

Indirect Move Block - Register Based Advanced Ladder

See alsoIndirect Block Move – Variable Based Advanced Ladder

The Indirect Block Move function works similarly to the Block Move and will copy values from the Source (IN) into one or more locations specified by the Destination (Q). It is possible to specify the Source and/or the Destination as “Indirect”, meaning those locations can be changed during run time.

Indirect Block Move Parameters

  • IN: The Source of the data to be filled into all Destination locations. Must be a register reference

  • IN Mode: “Direct” to use data starting at the specified IN location, the same functionality as the regular Block Move function. “Indirect” to instead use the IN location as an address pointer to the starting %RClosed Retentive 16-bit registers. register of the Source to be used. Any register may be used for IN but the Indirect pointer always points to a %R location.

  • Q: The Destination where a copy of the Source data will be placed. Must be a register reference.

  • Q Mode: “Direct” to copy data to a location starting specified by Q, the same functionality as the regular Block Move function. “Indirect” to instead use the Q location as an address pointer to the starting %R register to which the data is to be copied. Any register may be used for Q but the Indirect pointer always points to a %R location.

  • N: The Count parameter defines the number of values to move, i.e. the size of the block.

  • Type: The type of the values to be copied, whether BYTE (8 bits), WORD (16 bits), DWORD / REAL (32 bits), or LREAL (64 bits).

Note: When the “Indirect” option is checked for either the Source or Destination, the address reference indicates “@” instead of “%”. Shown here is with Source checked, then Destination checked, then with both Source and Destination checked.

Power Flow

Assuming valid parameters are in place, the Indirect Block Move function executes immediately and entirely as soon as it receives power from the incoming rung. The resulting data in the Destination (Q) is available for any other use immediately.

The Indirect Block Move function will attempt to execute on every scan that it has received power from the incoming rung. The Indirect Block Move function will succeed and pass power flow to the next function on the rung unless:

  • The indirect Source or Destination is specified as “0” or some other number that exceeds the controller’s available %RClosed Retentive 16-bit registers. register space.

  • The parameters currently in place cause the function to exceed the controller’s available %R register space.

  • There is no need for any further functions to exist to the right of the Indirect Block Move function on the rung. The function’s result is considered an output.

Indirect Block Move Examples

Registers and their values before the Indirect Move function is executed:

Register Value Register Value Register Value
%R1 1 %R11 103 %R101 101
%R2 2 %R12 1500 %R102 102
%R3 3 %R13 85 %R103 103
%R4 4 %R14 0 %R104 104
%R5 5 %R15 0 %R105 105

The example Indirect Move function configuration:

After the example Indirect Move function is executed, the Source Block from %R1-%R3 is copied to a location specified by the value in %R11, which is %R103 in this example:

Register Value Register Value Register Value
%R1 1 %R11 103 %R101 101
%R2 2 %R12 1500 %R102 102
%R3 3 %R13 85 %R103 1
%R4 4 %R14 0 %R104 2
%R5 5 %R15 0 %R105 3

Return to the Top: Move in Advanced Ladder

Indirect Block Move – Variable Based Advanced Ladder

See also: Indirect Move Block - Register Based Advanced Ladder

The Indirect Block Move function works similarly to the Block Move and will copy values from elements in the Source (IN) array into one or more elements in the Destination (Q) array. It is possible to specify the Source and/or the Destination as “Based Indirect”, meaning those locations within the Source and Destination arrays can be changed during run time.

Indirect Block Move (Variable Based) Parameters

  • Source (IN): The Source of the data to be filled into all Destination locations. Must be an array variable reference, including the starting element in the array.

  • Source Mode: “Direct” to use data starting at the specified Source location, the same functionality as the regular Block Move function. “Based Indirect” to instead use the “Offset” parameter to determine the Source data.

  • Source Offset: When “Based Indirect” is selected as the Source Mode, the Source Offset is a variable that determines which element of the Source array is to be used as the Source data. This Offset value is added to the specified starting element of the Source array.

  • Destination (Q): The Destination where a copy of the Source data will be placed. Must be an array variable reference, including the starting element in the array.

  • Destination Mode: “Direct” to place data starting at the specified Source location, the same functionality as the regular Block Move function. “Based Indirect” to instead use the “Offset” parameter to determine the Source data.

  • Destination Offset: When “Based Indirect” is selected as the Destination Mode, the Destination Offset is a variable that determines which element of the Destination array is to be used as the Destination location. This Offset value is added to the specified starting element of the Destination array.

  • Count (N): The Count parameter defines the number of values to copy, i.e. the size of the block.

  • Data Type: The type of the values to be copied, whether BYTE (8 bits), WORD (16 bits), DWORD / REAL (32 bits), or LREAL (64 bits).

Note: When the “Indirect” option is checked for either the Source or Destination, the address reference indicates “@”. Shown here is with Source checked, then Destination checked, then with both Source and Destination checked.

Power Flow

Assuming valid parameters are in place, the Indirect Block Move function executes immediately and entirely as soon as it receives power from the incoming rung. The resulting data in the Destination (Q) is available for any other use immediately.

The Indirect Block Move function will attempt to execute on every scan that it has received power from the incoming rung. The Indirect Block Move function will succeed and pass power flow to the next function on the rung unless either the Source or Destination Offset is specified as some number that causes the function to exceed the boundaries of the Source or Destination arrays

There is no need for any further functions to exist to the right of the Indirect Block Move function on the rung. The function’s result is considered an output.

Indirect Block Move (Variable Based) Examples

Arrays and their values before the Indirect Move function is executed:

Array Value Array Value Variable Value
Source[0] 101 Destination[0] 1250 Source_Offset 2
Source[1] 102 Destination[1] 1500    
Source[2] 103 Destination[2] 85    
Source[3] 104 Destination[3] 0    
Source[4] 105 Destination[4] 0    

The example Indirect Move function configuration:

After the example Indirect Move function is executed, data from the Source Array, starting from the Offset-altered element, is copied to the Destination Array starting at the element specified as the Destination.

Array Value Array Value Variable Value
Source[0] 101 Destination[0] 103 Source_Offset 2
Source[1] 102 Destination[1] 104    
Source[2] 103 Destination[2] 105    
Source[3] 104 Destination[3] 0    
Source[4] 105 Destination[4] 0    

Return to the Top: Move in Advanced Ladder