B&R – PLC – Structured Text – AsString – memcpy()

AsString – memcpy()

Copies the memory area

 

Call syntax (Automation Basic)

nxt_adr = memcpy(adr(Dest),adr(Src),length)

 

Parameters

I/OParameterData typeDescription
INpDestANY (transferred as a pointer)Address of destination memory
INpSrcANY (transferred as a pointer)Address of data to be copied
INlengthUDINTNumber of bytes to be copied
OUTnxt_adrUDINTAddress of the byte following the copied data in the destination memory

Code example (Init-Sp)

(* init program *)

length := 2000;

FOR i := 1 TO 2000 DO

Mem_Src[i]:=1;

Mem_Dest[i]:=0;

END_FOR

 

Code example (cyclic)

(* cyclic program *)

nxt_adr := memcpy(ADR(Mem_Dest),ADR(Mem_Src),length);

 

Variable declaration

NameData typeScope
lengthUDINTLocal
Mem_SrcUSINT[2000]Local
Mem_DestUSINT[2000]Local
nxt_adrUDINTLocal
iUINTLocal