Operator ‘BITADR’

This operator is an extension of the IEC 61131-3 standard.

BITADR yields the bit offset within a segment in a DWORD.

Attention

The offset depends on whether the byte addressing check box is selected or cleared in the target system settings.

The highest value nibble (4 bits) in this DWORD defines the memory range:

Flag: 16x40000000

Input: 16x80000000

Output: 16xC0000000

Caution

When using pointers to addresses, please note that applying an online change can shift address contents.

Examples

ST:

VAR
     Var1 AT %IX2.3 : BOOL;
     bitoffset: DWORD;
END_VAR

bitoffset := BITADR(var1); (* Result if byte addressing = TRUE: 16x80000013, if byte addressing = FALSE: 16x80000023 *)