UBLKMOV: Move block uninterruptible (S7-1500) - STEP 7

FBD (S7-1200, S7-1500)

ft:publication_title
FBD (S7-1200, S7-1500)
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
UBLKMOV: Move block uninterruptible

Description

You can use the "Move block uninterruptible" instruction to move the content of a memory area (source area) to another memory area (destination area). The move operation takes place in the direction of ascending addresses. You use VARIANT to define the source and destination areas.

The move operation cannot be interrupted by other operating system activities. As a result the interrupt reaction time of the CPU can increase during the execution of the "Move block uninterruptible" instruction.

Note

The tags of the instruction can only be used within memory areas in which the "Optimized block access" attribute is not activated. This applies to data blocks (DBs), organization blocks (OBs), functions (FCs), bit memory (M), inputs (I), and outputs (Q).

If a tag of the instruction has been declared with the retentivity setting "Set in IDB", however, you can use this tag in memory areas "with optimized block access".

Memory areas

You can use the "Move block uninterruptible" instruction to move the following memory areas:

  • Areas of a data block

  • Bit memory

  • Process image input

  • Process image output

General rules for moving

The source and destination area must not overlap during the execution of the "Move block uninterruptible" instruction. If the source area is smaller than the destination area, the entire source area will be written to the destination area. The remaining bytes of the destination area remain unchanged.

If the destination area is smaller than the source area, the entire destination area will be written. The remaining bytes of the source area are ignored.

If a source or destination area defined as a formal parameter is smaller than a destination or source area specified in the SRCBLK or DSTBLK parameter, no data is transferred.

If a block of data type BOOL is moved, the tag must be addressed absolutely and the specified length of the area must be divisible by 8, otherwise the instruction cannot be executed.

You can use the "Move block uninterruptible" instruction to move a maximum of 16 KB. Note the CPU-specific restrictions for this.

Rules for moving character strings

You can use the "Move block uninterruptible" instruction to also move source and destination areas of the STRING data type. If only the source area is STRING data type, the characters will be moved that are actually contained in the character string. Information on the actual and maximum length are not written in the destination area. If the source and destination area are both STRING data type, the current length of the character string in the destination area is set to the number of characters actually moved. If areas of the STRING data type are moved, specify "1" as area length.

Parameters

The following table shows the parameters of the "Move block uninterruptible" instruction:

Parameters

Declaration

Data type

Memory area

Description

EN

Input

BOOL

I, Q, M, D, L, T, C or constant

Enable input

ENO

Output

BOOL

I, Q, M, D, L

Enable output

SRCBLK

Input

VARIANT

I, Q, M, D, L, P

Specifies the memory area to be moved (source area).

RET_VAL

Output

INT

I, Q, M, D, L, P

Error information:

If an error occurs during execution of the instruction, an error code is output in the RET_VAL parameter.

DSTBLK

Output 1)

VARIANT

I, Q, M, D, L, P

Specifies the memory area to which the block is to be moved (destination area).

1) The DSTBLK parameter is declared as Output, since the data flow into the tag. However, the tag itself must be declared as InOut in the block interface.

Parameter RET_VAL

The following table shows the meaning of the values of the RET_VAL parameter:

Error code
(W#16#...)

Explanation

0000

No error

8091

The source or destination area is located in the load memory only.

8152

The WSTRING, WCHAR, BOOL, ARRAY of STRING, ARRAY of WSTRING and ARRAY of WCHAR data types are not supported at the SRCBLK parameter.

8352

The WSTRING, WCHAR, BOOL, ARRAY of STRING, ARRAY of WSTRING and ARRAY of WCHAR data types are not supported at the DSTBLK parameter.

General error information

See also: "GET_ERR_ID: Get error ID locally"

*The error codes can be displayed as integer or hexadecimal value in the program editor. You can find information on switching the display formats under "See also".

Example

The following example shows how the instruction works:

If the "TagIn" operand has signal state "1", the instruction is executed. The instruction copies 10 bytes starting from MB100 and writes them to DB1. If an error occurs during the move operation, its error code is output in the "Tag_RetVal" tag.