MEMCPY

MEMCPY 1:

The function MEMCPY can be used to copy the values of PLC variables from one memory area to another.

FUNCTION MEMCPY : UINT

VAR_INPUT

destAddr      : DWORD;
srcAddr       : DWORD;
n             : UINT;

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).

Sample of a call in FBD

VAR
    Buffer1    : ARRAY[0..3] OF BYTE;
    Buffer2    : ARRAY[0..3] OF BYTE;
    CpyResult  : UINT;
END_VAR

 

MEMCPY 2:

In the sample, 4 bytes are copied from Buffer2 to Buffer1.