Addressing bits in variables, L-force | plc designer – Lenze PLC Designer PLC Designer (R2-x) User Manual
Page 512

L-force | PLC Designer
Operands in PLC Designer
510
DMS 3.2 EN 02/2011 TD29
10.2.3
Addressing bits in variables
In integer variables individual bits can be accessed. For this, the index of the bit to be
addressed is appended to the variable, separated by a dot. The bit-index can be given
by any constant. Indexing is 0-based.
Note!
Bitaccess in Direct variables is not allowed.
Example:
a : INT;
b : BOOL;
...
a.2 := b;
The third bit of the variable a will be set to the value of the variable b.
If the index is greater than the bit width of the variable, the following error message is
issued: Index '
Bit addressing is possible with the following variable types: SINT, INT, DINT, USINT,
UINT, UDINT, BYTE, WORD, DWORD.
If the variable type does not allow it, the following error message is issued: "Invalid
data type '
A bit access must not be assigned to a VAR_IN_OUT variable!
Bitaccess via a global constant:
If you have declared a global constant, which defines the bit-index, you can use this
constant for a bitaccess.
Note!
The project option 'Replace constants' (category Build) must be activated !