Functions (Fun) - Mitsubishi Electric MELSEC iQ-R Series Programming Manual

Hide thumbs Also See for MELSEC iQ-R Series:
Table of Contents

Advertisement

3.2

Functions (FUN)

A function is a POU called and executed by program blocks, function blocks, and other functions.
After the processing completes, a function passes a value to the calling source. This value is called a return value.
A function always outputs the same return value, as the processing result, for the same input.
By defining simple, independent algorithms that are frequently used, functions can be reused efficiently.
Function
Function block
or
function
Input variables and output variables
Input and output variables can be defined in functions. Output data which is different from the return value can be assigned to
the output variable.
Ladder program
For the classes in which input and output variables can be set, refer to the following.
Page 39 Classes
Variables defined in the function are overwritten every time the function is called.
To hold the data in the variables, create a program by using function blocks or so that the data in the output
variable is saved in another variable.
FUN
FBD/LD program
(1)
(2)
(3)
The return value of the function is not displayed.
Program
block
FUN
Program
block
FB or FUN
(1) Function name
(1)
(2) Input variable
(3) Output variable
(2)
(3)
3 PROGRAM ORGANIZATION UNITS
15
3.2 Functions (FUN)
3

Advertisement

Table of Contents
loading

Table of Contents