6 Functions and Function Blocks
Below is a table illustrating the comparison between ‘Functions’ and ‘Function Blocks’:
쎲
Functions are part of the instruction set.
쎲
Functions are included in the standard and manufacturers libraries. i.e. TIMER_M is a
function, as is MOV_M, PLUS_M etc.from the Mitsubishi Instruction Set in the Manufactur
-
ers Library.
쎲
User defined functions can easily be created out of tested program parts.
This means that functions can be created i.e. for system/process calculations, and can be
stored in libraries and reused many times, with different variable declarations. This would
be in the same way that i.e. a MOV instruction would be used but with the advantage of be-
ing user specific.
6.1 Functions
Most control programs have some form of maths within them, i.e. for analogue signal condition-
ing, displaying engineering units etc. These are frequently reused within the program structure.
By using user defined functions, program design time can be dramatically reduced.
6.1.1 Example: Creating a Function
Objective:
Build a Function to change Fahrenheit to Centigrade.
Formula is:
()
Centigrade
Fahrenheit
=
-´32 5
9
The Function will be named “Centigrade” and the input variable will be named “Fahrenheit”.
Functions and Function Blocks Functions
Training Manual GX IEC Developer 6 - 1
Item Function Block Function
Internal variable storage Storage No storage
Instancing Required Not required
Outputs
앥
No output
앥
One output
앥
Multiple outputs
One output
Repeated execution with same input
values
Does not always deliver the same
output value.
Always delivers the same output
value.