Move Operations
Data Transfer & Management
Data transfer is the circulatory system of your PLC program. Efficiently manage variable copies, structure serialization, and memory block manipulations.
What are Move Operations in TIA Portal?
Move operations allow copying data from one memory location to another. They range from simple variable copying (MOVE) to complex manipulation of entire structures for communication (Serialize/Deserialize) or managing contiguous data areas (MOVE_BLK).
TIA Portal offers modern instructions for symbolic access, dynamic management via Variant types, and optimized functions for Array DBs, while retaining Legacy instructions for compatibility with older S7-300 systems.
Basic Transfer
Fundamental copy and formatting instructions
MOVE — Copy value
MOVEWhat it does
Copies the content of the IN input to the OUT output. If the data type differs, an implicit conversion may take place if it is safe.
When to use it
Initialize variables, copy HMI setpoints, or transfer calculation results.
Pro Tips
You can add multiple outputs (OUT1, OUT2...) to copy a value to several destinations simultaneously.
In SCL, simply use assignment: destination := source;
Works with almost all data types (Bool, Int, Real, Struct, String).
Serialize / Deserialize
SERWhat they do
Serialize converts a complex structure into a sequential byte stream (Array of Byte). Deserialize does the opposite.
When to use it
Preparing data for sending via communication protocols (TCP/IP, UDP) or compact storage.
Pro Tips
Use the POS parameter to track the fill index in the destination buffer.
Essential for exchanges with third-party systems that do not understand Siemens UDTs.
Ensure the buffer size is sufficient to avoid runtime errors.
SWAP — Swap bytes
SWAPWhat it does
Reverses the byte order (Endianness) in the IN operand.
When to use it
Communication with devices using 'Little-Endian' format while the PLC uses 'Big-Endian'.
Pro Tips
Generally used on Word or DWord types.
Useful for processing data from certain Modbus sensors.
Can be used to reorganize ASCII codes received backwards.
Block Move
Manipulation of massive and contiguous memory areas
MOVE_BLK / UMOVE_BLK
MOVE_BLKWhat it does
Copies a defined number of elements from a source Array to a destination Array. UMOVE_BLK is the uninterruptible (atomic) version.
When to use it
Buffer management, historical data archiving, or duplicating manufacturing recipes.
Pro Tips
The starting index (COUNT) defines the number of elements to copy.
UMOVE_BLK ensures that data is not modified by an alarm OB during copying.
Source and destination data types must be identical.
MOVE_BLK_VARIANT
What it does
Advanced version of MOVE_BLK supporting Variant data types for flexible addressing.
When to use it
Developing reusable library blocks working on arrays of different sizes or types.
Pro Tips
Allows copying between arrays whose types are determined at runtime.
Use CountOfElements to automate the COUNT parameter.
Very powerful in S7-1500 for generic programming.
Fill Area
Fast initialization of memory ranges
FILL_BLK / UFILL_BLK
FILLWhat it does
Fills a memory area (Array) with a single value specified at the IN input.
When to use it
Resetting a measurement array to zero, or initializing a buffer with a default value.
Pro Tips
UFILL_BLK is preferable for critical areas shared with interrupts.
Much more performant than a FOR loop for initializing a large array.
COUNT specifies the number of elements to fill starting from the specified pointer.
Scatter / Gather
Bit decomposition and composition
SCATTER / GATHER
What they do
SCATTER decomposes a word (Word, DWord...) into individual bits to a structure or an array. GATHER does the opposite.
When to use it
Extracting status bits from a diagnostic word or composing a command word from control bits.
Pro Tips
Advantageously replaces a multitude of bit accesses (e.g., %X0).
Available on S7-1200 and S7-1500.
Ensures cleaner and easier to maintain code.
Array DB Access
Reading and writing in array-type data blocks
ReadFromArrayDB / WriteToArrayDB
What they do
Allow reading or writing a specific element in a data block configured as 'Array DB'.
When to use it
Managing large data lists where indexing must be dynamic and fast.
Pro Tips
The 'L' versions (e.g., ReadFromArrayDBL) access the Load Memory for infrequent data.
Using Array DB is often more performant than classic indexed access.
Check that the index is within bounds to avoid an access error.
Variant Manipulation
Tools for dynamic programming
VariantGet / VariantPut
What they do
VariantGet extracts the value of a Variant variable to a typed variable. VariantPut writes a typed value into a Variant variable.
When to use it
Processing data whose exact type is only known at the time of the block call.
Pro Tips
Use EQ_Type to check the type before extracting the value.
Fundamental for creating generic communication functions.
CountOfElements returns the number of elements if the Variant points to an Array.
Array Bounds
Dynamic limit determination
LOWER_BOUND / UPPER_BOUND
What it does
Returns the lower (LOWER) or upper (UPPER) bound of an array passed as a Variant parameter.
When to use it
Looping over an array of unknown size (e.g., Array[*] of MyUDT).
Pro Tips
Essential for writing robust FOR loops: FOR i := LOWER_BOUND(...) TO UPPER_BOUND(...) DO
Works on both single and multi-dimensional arrays.
The DIM parameter specifies the desired dimension (1 by default).
Legacy Instructions
Compatibility with older S7-300/400 systems
Instructions like BLKMOV, FILL, and FieldRead/FieldWrite are retained for compatibility. For new S7-1200/1500 projects, prefer MOVE_BLK, FILL_BLK, and direct symbolic accesses.
Copy Method Comparison
Choosing the right transfer instruction
| You need to... | Recommended instruction | Example |
|---|---|---|
| Copy a simple variable | MOVE | Setpoint -> Actual |
| Copy a memory area | MOVE_BLK | FIFO Buffer |
| Initialize an array | FILL_BLK | Fault reset |
| Prepare a TCP message | Serialize | Structure -> Byte stream |
| Split a word into bits | SCATTER | Word diagnostic -> structure |
| Dynamic access | VARIANT | Universal library block |
Frequently Asked Questions
What is the difference between MOVE and MOVE_BLK?
MOVE is intended to copy a single value or a complete structure at once. MOVE_BLK is optimized for copying part of an array (a certain number of consecutive elements).
Why use UMOVE_BLK instead of MOVE_BLK?
The 'U' stands for Uninterruptible. This instruction ensures that the copy operation will not be interrupted by an alarm cycle (priority OBs), ensuring total consistency of the copied data.
When to use Serialize and Deserialize?
These instructions are vital when you need to send structured data via 'raw' protocols like TSEND/TRCV or to third-party equipment. They handle byte alignment in a standardized way.
Does MOVE_BLK work with absolute addresses (P#DB1.DBX0.0...)?
Yes, but TIA Portal encourages the use of symbolic access. For complex absolute addressing, BLKMOV (Legacy) is still used, although MOVE_BLK_VARIANT is the recommended modern solution.