You are on page 1of 1

Functions (FCs)

Functions (FCs)

Definition
Functions (A function (FC) is a code block without memory according to IEC 1131-3. A
function gives you the option to transfer parameters in the user program. Functions are
therefore particularly suitable for frequently recurring complex constructs, such as calcula-
tions. ) (FCs) are code blocks without memory. You have no data memory in which values
of block parameters can be stored. Therefore, when a function is called, all formal parame-
ters must be assigned actual parameters.
Functions can use global data blocks (A data block is used to store user data. There are
global data blocks that can be accessed by all code blocks and instance data blocks that
are assigned to a specific FB call.) to store data permanently.

Application
A function contains a program that is executed when the function is called by another code
block. Functions can be used, for example, for the following purposes:
• To return function values to the calling block, e.g. for mathematical functions
• To execute technological functions, e.g. individual controls using bit logic operations
A function can also be called several times at different points in a program. As a result,
they simplify programming of frequently recurring functions.

Note
Parameter transfer when calling functions
To avoid errors when working with functions, observe the information in chapter "Param-
eter transfer at block call".

See also
Creating functions and function blocks

-1-

You might also like