The IEC 61131-3 standard, in addition to the programming languages that have been presented,
defines the concepts and components of structural programming further, which replaces the unus-
able and simple listing of instructions within a single unified program. The term structural pro-
gramming means that the automation program is characterized by components that are different
from each other and with a different task, defined as program modules. In this way, the IEC
61131-3 introduces a complete software model for the PLC. These structural components are
referred to in this standard as program organization units (POUs), while the standard defines
The section with the characteristics of the POU (e.g., the name, date, issue number, etc.)
sented with the corresponding data transfer in the Siemens STEP-7 programming environment.
The POUs can be defined either by the user or by the manufacturer and cannot be iterative. This
means that a POU cannot call itself. The three POUs are defined in the standard as follows:
a single output. For a FUNCTION to be executed, all the inputs should have a numeric
value, while a FUNCTION cannot store any information about its current or previous sta-
tus. This means that the execution of a FUNCTION with the same input values, as many
times as it is called, will always provide the same value to the output. The IEC 61131-3 has
set the standard FUNCTIONS that are supplied by the manufacturer of the PLC and the
Basic Programming Principles of PLCs
◾
279
user-defined FUNCTIONS. For example, typical FUNCTIONS are AND, OR, ADD,
ABS, SQRT, SIN, etc., some of which are extensible, which means that the user can decide
on the number of the FUNCTION’s inputs. The user-defined FUNCTIONS, once defined,
can be called as many times in the program, while they can be programmed by the user in
any of the standard languages.
◾
FUNCTION BLOCKS (FB). A FUNCTION BLOCK is a program block that has one or
more inputs and one or more outputs. In addition, FB can store information about its status
in contrast to the FUNCTION. This means that the output values depend not only on the
input values but also on the stored information. To achieve this, each FB is directly linked
to a data block (DB) where the values are stored, while to execute an FB, all inputs should
have a numeric value.
FBs have an operation that is related more to the integrated circuits (ICs) that implement
a specific function. FBs contain data, as well an algorithm, and therefore can have a memory.
Also, they have a well-defined interface and an invisible content, such as an IC has, which
allows for the introduction of programming levels of different priorities. A temperature con-
trol law or a PID controller is a representative example of a user-defined FB. Once defined,
it can be used as many times as needed in either the same program, different programs, or
even in different projects, which is a feature that makes FBs absolutely reusable.
FBs, as in the case of FUNCTIONS, may be standard FBs developed by the manufac-
turer of the PLC or by the user. Counters, timers, and flip-flops are key examples of standard
FBs. FBs can be programmed in any language from the IEC standard and, in many cases,
in C language also.
◾
PROGRAMS. PROGRAMS are program blocks that are constructed by POUs, such as
FBs and FCs, as well as by simple instructions. They do not have inputs and outputs, all the
utilized variables should be universal, and are programmed in all the standard languages.
PROGRAMS can only exist within the PLC and not within an FB or an FC.
FB10
with DB10
Variable declaration
Variable declaration
STAT
Speed
INT
CALL FC100
in_par1 := #Speed
in_par2 := MW100
in_par3 := DB10,DB40
FC100
Variable declaration
IN
IN
IN
in_par1
in_par2
in_par3
ANY
ANY
ANY
FB11
mit DB20
TEMP
Thermo
ARRAY [1..3]
REAL
#Thermo
M 1.3
T 2
FC100
in_par1
in_par2
in_par3
Do'stlaringiz bilan baham: