Skip to main content

Operator: BITADR

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

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

Important

The offset depends on whether the "Byte addressing" option is selected or cleared in the target system settings.

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

Marker M: 16#40000000

Input I: 16#80000000

Output Q: 16#C0000000

Caution

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

Example 134. Example

ST implementation language

VAR
    xVar AT %IX2.3 : BOOL;
    dwBitoffset : DWORD;
END_VAR

dwBitoffset := BITADR(xVar); (* If byte addressing = TRUE, result = 16#80000013; if byte addressing = FALSE, result =  16#80000023 *)