DECPLCopen motion icon

FunctionClosedA function calculates a result according to the current value of its inputs. A function has no internal data and is not linked to declared instances. - Decrease a numerical variable

Inputs

IN : ANY  Numerical variable (increased after call). Data In/Out

Outputs

Q : ANY   Decreased value

Remarks

When the function is called, the variable connected to the "IN" input is decreased and copied to Q. All data types are supported except BOOL and STRING: for these types, the output is the copy of IN.

For real values, variable is decreased by "1.0". For time values, variable is decreased by 1 ms.

The IN input must be directly connected to a variable, and cannot be a constant or complex expression.

This function is particularly designed for STClosed"Structured text" A high-level language that is block structured and syntactically resembles Pascal language. It allows simplified writing as assigning the result of the function is not mandatory.

ST Language

IN := 2;
Q := DEC (IN);
(* now: IN = 1 ; Q = 1 *)
DEC (IN); (* simplified call *)

FBD Language

FFLD Language

IL Language

not available