AsString – memcpy()
Copies the memory area
Call syntax (Automation Basic)
nxt_adr = memcpy(adr(Dest),adr(Src),length)
Parameters
I/O | Parameter | Data type | Description |
---|---|---|---|
IN | pDest | ANY (transferred as a pointer) | Address of destination memory |
IN | pSrc | ANY (transferred as a pointer) | Address of data to be copied |
IN | length | UDINT | Number of bytes to be copied |
OUT | nxt_adr | UDINT | Address 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
Name | Data type | Scope |
---|---|---|
length | UDINT | Local |
Mem_Src | USINT[2000] | Local |
Mem_Dest | USINT[2000] | Local |
nxt_adr | UDINT | Local |
i | UINT | Local |