MEMMOVE
The function MEMMOVE can be used to copy the values of PLC variables from one memory area to another. If some regions of the source area and the destination overlap, MEMMOVE ensures that the original source bytes in the overlapping region are copied before being overwritten.
FUNCTION MEMMOVE : UDINT
VAR_INPUT
destAddr : UDINT;
srcAddr : UDINT;
n : UDINT;
END_VAR
destAddr: start address of the target memory area.
srcAddr: start address of the source memory area.
n: number of bytes to be copied.
The function copies n bytes from the memory area that starts at srcAddr to the memory area that starts at destAddr.
Return parameter | Meaning |
---|---|
0 | Incorrect parameter values. destAddr == 0 or srcAddr==0 or n == 0 |
> 0 | If successful, the number of bytes copied (n). |
Example of a call in FBD
VAR
Buffer1 : ARRAY[0..3] OF BYTE;
Buffer2 : ARRAY[0..3] OF BYTE;
MoveResult : UDINT;
END_VAR
In the example, 4 bytes are moved from Buffer2 to Buffer1.
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v2.8.0 Build > 737 | PC or CX (x86) | TcSystem.Lib |
TwinCAT v2.10.0 Build >= 1301 | CX (ARM) | TcSystem.Lib |