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

W0005: REF() of a variable at an input address

A variable at an input address (AT %IW0, or %I*) is written by the host from the inputs before each task runs. Reading it through a reference is the common use; writing through the reference changes the copy in the process image, which the next inputs overwrite. CODESYS warns the same way (“invalid assignment target”) when a reference is taken to an input; iecf compiles it and warns (docs/dependencies.md).

VAR level AT %IW0 : INT; END_VAR
VAR r : REF_TO INT; END_VAR
r := REF(level);     (* W0005 *)