12
3 PROGRAM ORGANIZATION UNIT (POU)
3.1 Function (FUN)
3.1 Function (FUN)
Functions are a type of POU used by program blocks, function blocks, or other functions.
The function sends back a value to the call source after execution. The value is called return values.
The function always outputs the same return value as the processing result in response to the same input.
The function can be re-used effectively by defining a simple, independent, and frequently used algorithm.
Input variable and output variable
For a function, input variables and output variables can be defined. Output variable can be created to output data separate
from the return value.
For classes for which input variables or output variables can be set, refer to the following.
Page 23 Class
Variables defined in a function are overwritten every time the function is called.
To retain the variable values at each call, use a function block or design a program so that an output variable
is saved in a different variable.
Case of ladder diagram Case of FBD/LD language
(1) Function name
(2) Input variables
(3) Output variables
FUN
FB or FUNFUN
Function
Function block
or function
Program block
Program block