AsString – memset()
Fills the memory area with specific values
Call syntax (Automation Basic)
nxt_adr = memset(adr(Dest),value,length)
I/O | Parameter | Data type | Description |
---|---|---|---|
IN | pDest | ANY (transferred as a pointer) | Address of destination memory |
IN | value | USINT | Initialization value |
IN | length | UDINT | Number of bytes to be initialized |
OUT | nxt_adr | UDINT | Address 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
Name | Data type | Scope |
---|---|---|
value | USINT | Local |
length | UDINT | Local |
Mem | USINT[2000] | Local |
nxt_adr | UDINT | Local |
i | UINT | Local |