Indexof, Sizeof, L-force | plc designer – Lenze PLC Designer PLC Designer (R3-1) User Manual

Page 1091

Advertising
background image

L-force | PLC Designer

Programming Reference

DMS 4.1 EN 03/2011 TD29

1089

Example in IL:

Note: After an Online Change there might be changes concerning the data on some
addresses. Please notice this in this case of using pointers on addresses.

INDEXOF
This arithmetic operator is not prescribed by the standard IEC 61131-3.
Perform this function to find the internal index for a POU.
Example in ST:

var1 := INDEXOF(POU2);

SIZEOF
This arithmetic operator is not prescribed by the standard IEC 61131-3.
It can be used to determine the number of bytes required by the given variable x.
The SIZEOF operator returns an unsigned value. The type of the return value will be
adapted to the found size of variable x.

return value of SIZEOF(x)

data type of the constant implicitly used for the found size

0 <= size of x < 256

USINT

256 <= size of x < 65536

UINT

65536 <= size of x < 4294967296

UDINT

4294967296 <= size of x

ULINT

Example in ST:

var1 := SIZEOF(arr1); (* d.h.: var1:=USINT#10; *)


Example in IL: (Result is 10)

arr1:ARRAY[0..4] OF INT;
Var1:INT;

Advertising