Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Incomplete hardware address in FUNCTION or METHOD

Variables with an incomplete hardware address (e.g. AT %I*) are placeholders that expect a complete address to be supplied later by a VAR_CONFIG block. They can only be declared in stateful contexts: PROGRAM, FUNCTION_BLOCK, or VAR_GLOBAL.

FUNCTION and METHOD bodies have no persistent state to bind a hardware address to, so an incomplete address there cannot be resolved.

Erroneous code example:

FUNCTION foo : DINT
VAR
    flag AT %I* : BOOL;
END_VAR
END_FUNCTION

Move the variable into a PROGRAM, FUNCTION_BLOCK, or VAR_GLOBAL block, or supply a complete address (e.g. AT %IX1.0) directly.