Output Variables - VAR_OUTPUT

Output variables are output variables of a function block.

VAR_OUTPUT variables are declared in the declaration part of programming objects between the keywords VAR_OUTPUT and END_VAR. TwinCAT returns the values of these variables to the calling function block. There you can query the values and continue to use them.

You can extend output variables with an attribute keyword.

Example:

VAR_OUTPUT
  nOut1 : INT; //1st output variable
END_VAR

Output variables in functions and methods

According to the IEC 61131-3 standard, functions (and methods) can have additional outputs. You have to assign the additional outputs when you call the function, as shown in the following example.

Example:

F_Fun(nIn1 := 1, nIn2 := 2, nOut1 => nLoc1, nOut2 => nLoc2);

See also: