
2.2 The Program Organisation Unit (POU) 31
POU type keyword meaning
Program
PROGRAM Main program including assignment to I/O,
global variables and access paths
Function
block
FUNCTION_BLOCK Block with input and output variables; this is the
most frequently used POU type
Function
FUNCTION Block with function value for extension of the
basic PLC operation set
Table 2.1. The three POU types of IEC 61131-3 with their meanings
These three POU types differ from each other in certain features:
- Function (FUN). POU that can be assigned parameters, but has no static
variables (without memory), which, when invoked with the same input
parameters, always yields the same result as its function value (output).
- Function block (FB). POU that can be assigned parameters and has static
variables (with memory). An FB (for example a counter or timer block), when
invoked with the same input parameters, will yield values which also depend
on the state of its internal (VAR) and external (VAR_EXTERNAL) variables,
which are retained from one execution of the function block to the next.
- Program (PROG). This type of POU represents the “main program”. All
variables of the whole program, that are assigned to physical addresses (for
example PLC inputs and outputs) must be declared in this POU or above it
(Resource, Configuration). In all other respects it behaves like an FB.
PROG and FB can have both input and output parameters. Functions, on the other
hand, have input parameters and a function value as return value. These properties
were previously confined to “function blocks”.
The IEC 61131-3 FUNCTION_BLOCK with input and output parameters
roughly corresponds to the conventional function block. The POU types
PROGRAM and FUNCTION do not have direct counterparts in blocks as defined
in previous standards, e.g. DIN 19239.
A POU is an encapsulated unit, which can be compiled independently of other
program parts. However, the compiler needs information about the calling
interfaces of the other POUs that are called in the POU (“prototypes”). Compiled
POUs can be linked together later in order to create a complete program.
The name of a POU is known throughout the whole project and may therefore only
be used once. Local subroutines as in some other (high-level) languages are not
permitted in IEC 61131-3. Thus, after programming a POU (declaration), its name
and its calling interface will be known to all other POUs in the project, i.e. the
POU name is always global.