Description
You use the "Move block" instruction to move the content of a memory area (source range) to another memory area (target range). The number of elements to be moved to the target range is specified with the COUNT parameter. The width of the elements to be moved is defined by the width of the element at input IN.
The instruction can only be executed if the source range and the target range have the same data type.
Enable output ENO returns the signal state "0" if one of the following conditions applies:
-
Enable input EN has the signal state "0".
-
More data is moved than is made available at input IN or output OUT.
When a ARRAY of BOOL is copied, the enable output ENO for an overflow is set to "1" until the byte limit of the ARRAY structure is exceeded. If the byte limit of the ARRAY structure is exceeded by the value at the COUNT input, the ENO enable output is reset to "0".
|
Note Use of ARRAYs The instruction copies the contents from the defined element n elements (n = depending on the value at the parameter COUNT) from the source range to the target range, starting at the specified index. |
Parameters
The following table shows the parameters of the "Move block" instruction:
|
Parameters |
Declaration |
Data type |
Memory area |
Description |
||
|---|---|---|---|---|---|---|
|
S7-1200 |
S7-1500 |
S7-1200 |
S7-1500 |
|||
|
EN |
Input |
BOOL |
BOOL |
I, Q, M, D, L or constant |
I, Q, M, D, L, T, C or constant |
Enable input |
|
ENO |
Output |
BOOL |
BOOL |
I, Q, M, D, L |
I, Q, M, D, L |
Enable output |
|
IN 1) |
Input |
Binary numbers, integers, floating-point numbers, timers, DATE, CHAR, WCHAR, TOD |
Binary numbers, integers, floating-point numbers, timers, DATE, CHAR, WCHAR, TOD, LTOD |
D, L |
D, L |
The first element of the source area that is being copied |
|
COUNT |
Input |
USINT, UINT, UDINT |
USINT, UINT, UDINT, ULINT |
I, Q, M, D, L, P or constant |
I, Q, M, D, L, P or constant |
Number of elements to be copied from the source range to the target range |
|
OUT 1) |
Output |
Binary numbers, integers, floating-point numbers, timers, DATE, CHAR, WCHAR, TOD |
Binary numbers, integers, floating-point numbers, timers, DATE, CHAR, WCHAR, TOD, LTOD |
D, L |
D, L |
The first element of the target range to which the contents of the source range are being copied |
|
1) The specified data types can only be used as elements of an ARRAY structure. |
||||||
You can find additional information on valid data types under "See also".
Example
The following example shows how the instruction works:
The following table shows how the instruction works using specific operand values:
|
Parameters |
Operand |
Value |
|---|---|---|
|
IN |
a_array[2] |
The data type of the "a_array" operand is ARRAY [0..5] of INT. It consists of six elements of data type INT. |
|
COUNT |
Tag_Count |
3 |
|
OUT |
b_array[1] |
The data type of the "b_array" operand is ARRAY [0..6] of INT. It consists of seven elements of data type INT. |
If the operands "TagIn_1" and "TagIn_2" have signal state "1", the instruction is executed. Starting from the third element, the instruction selects three INT elements from the #a_array tag and copies their contents to the #b_array output tag, beginning with the second element. If the instruction is executed without errors, the enable output ENO has the signal state "1" and the "TagOut" output is set.
|
Note You can find more information on the MOVE_BLK instruction in the following article in the Siemens Industry Online Support: In STEP 7 (TIA Portal) how do you copy memory areas and structured data from one data block to another? |