Immutable Hardware Binding
Variables configured in a VAR_CONFIG
block can not override their hardware binding.
Erroneous code example:
VAR_CONFIG
main.foo.bar AT %IX1.0 : BOOL;
END_VAR
PROGRAM main
VAR
foo : foo_fb;
END_VAR
END_PROGRAM
FUNCTION_BLOCK foo_fb
VAR
bar AT IX1.5: BOOL;
END_VAR
END_FUNCTION_BLOCK
In this example the VAR_CONFIG
block configures bar
to have a hardware adress IX1.0
.
However, at the same time the bar
inside the POU foo_fb
assigns a hardware address IX1.5
.
For the code to be considered valid, bar
should have been declared as bar AT %I* : BOOL
.