MEMSET
The function MEMSET allows PLC variables in a particular memory area to be set to a particular value.
FUNCTION MEMSET : UDINT
VAR_INPUT
destAddr :UDINT;
fillByte :USINT;
n :UDINT;
END_VAR
destAddr: start address of the memory area that is to be set.
fillByte: value of the filler byte.
n: number of bytes to be set.
The function fills n bytes in the memory area that starts at address destAddr with the value specified by fillByte.
Return parameter | Meaning |
---|---|
0 | Incorrect parameter values. destAddr == 0 or n == 0 |
> 0 | If successful, the number of bytes that have been set (n). |
Example of a call in FBD
VAR
Buffer1 : ARRAY[0..3] OF BYTE;
SetResult : UDINT;
END_VAR
In the example, 4 bytes in Buffer1 are set to the value 0xAF.
Requirements
Development environment | Target system type | PLC libraries to include |
---|---|---|
TwinCAT v2.7.0 | PC or CX (x86) | PLCHelper.Lib |
TwinCAT v2.8.0 | PC or CX (x86) | TcSystem.Lib |
TwinCAT v2.10.0 Build >= 1301 | CX (ARM) | TcSystem.Lib |