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

AsString – memset()

Fills the memory area with specific values

 

Call syntax (Automation Basic)

nxt_adr = memset(adr(Dest),value,length)

 

I/OParameterData typeDescription
INpDestANY (transferred as a pointer)Address of destination memory
INvalueUSINTInitialization value
INlengthUDINTNumber of bytes to be initialized
OUTnxt_adrUDINTAddress of pDest (for cascading)

Code example (Init-Sp)

(* init program *)

value:= 255;

length := 2000;

FOR i := 1 TO 2000 DO

Mem[i]:=0;

END_FOR

Code example (cyclic)

(* cyclic program *)

nxt_adr := memset(ADR(Mem),value,length);

Variable declaration

NameData typeScope
valueUSINTLocal
lengthUDINTLocal
MemUSINT[2000]Local
nxt_adrUDINTLocal
iUINTLocal