MEMSET

MEMSET 1:

The function MEMSET allows PLC variables in a particular memory area to be set to a particular value.

FUNCTION MEMSET : UINT

VAR_INPUT

destAddr  :DWORD;
fillByte  :USINT;
n         :UINT;

destAddr: start address of the memory area that is to be set.

fillByte: value of the padding bytes.

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).

 

Sample of a call in FBD

VAR
    Buffer1    : ARRAY[0..3] OF BYTE;
    SetResult  : UINT;
END_VAR

MEMSET 2:

 In the sample, 4 bytes in Buffer1 are set to the value 0xAF.