E0016: a call that does not fit what it calls
A function is called with its inputs either all by name or all in
order (Ed.3 6.6.1.4); a function block is called through an instance,
not by its type name; := passes an input or in-out, => takes an
output; every name must be one of the callee’s parameters. Every
in-out is given a variable (Ed.3 6.6.1.4 rule 2): at each call of a
function, and in a resource’s connections for a program, which bind it
to a global.
VAR t : TON; END_VAR
TON(IN := x, PT := T#1s); (* E0016: call an instance: t(...) *)
t(IN := x, Q := y); (* E0016: Q is an output: Q => y *)
PROGRAM p WITH fast : counter; (* E0016: counter's VAR_IN_OUT n is not
connected: counter(n := g) *)
A program’s connection names what Ed.3 6.8.2’s grammar lets it (Prog_Data_Source, Data_Sink, Global_Var_Access): an input a constant, an enumerated value, a global variable or one field of one, or an address; an output a global variable, one field of one, or an address. An array’s element, an expression or a field of a field is none of them:
PROGRAM p WITH fast : counter(
n := g, (* fine *)
step := gp.x, (* fine: one field of a global *)
limit := ga[2], (* E0016: an element *)
start := g + 1); (* E0016: an expression *)