271
Chapter 7
Basic Programming
Principles of PLCs
7.1 Introduction to Programming of PLCs
Since a PLC is basically a digital device that monitors, processes, and generates data from an
industrial process, it requires a software program with instructions to perform the desired func-
tions. This program has two separate parts with two different objectives. The first part is the oper-
ating system that has been described in Chapter 6, which is responsible for all internal functions
of the PLC, and is developed by the manufacturer of the PLC and cannot be modified in any way
by the user. The second part of the PLC’s program is related to the logical and other functions
that the user desires to execute and needs to be written in a language that the PLC understands.
This second type of programming will be the focus of Chapter 7 and will include the existing pro-
gramming languages, basic issues on the standardization of languages and programming norms,
individual language instructions, and corresponding applications.
The programming of PLCs has evolved through various stages in parallel to the technological
(hardware) evolution of these devices. Initially, PLC programming included only digital input and
output instructions that performed only logical functions corresponding to the case of conven-
tional electromechanical relays. The corresponding language, known as relay ladder logic (RLL),
was a mixed form language that combined graphic symbols and short-syntax alphanumeric strings.
The name “ladder” was derived from the fact that a vertical line expressing the “beginning of the
logic” (or, metaphorically, the high voltage potential) is placed on the left, and the line with the
“end of the logic” (or, metaphorically, the low voltage potential) is placed on the right. Between
these two vertical lines, simple logical elements (or combinations of them) form a branch, and
are called “logical contacts” or “relay logic” as a whole, as shown in Figure 7.1. Between the two
vertical lines, there is a number of such branches in the form of a ladder. Subsequently, the evolu-
tion in the field of PLCs was massive. Within a few years, PLCs included functions and opera-
tions of timers and counters by introducing corresponding instructions in the ladder language.
They also introduced the ability to carry out four basic mathematical operations, while nowadays
PLCs have reached a point that their programs support all mathematical functions, from abso-
lute variable value up to the exponential, logarithmic, and trigonometric functions, for example.
272
◾
Introduction to Industrial Automation
However, this evolution of timers, counters, and basic arithmetic operations was not enough. The
world of mechanical automation systems demanded more and more computing power, memory,
and specific functionalities. It was also looking for the possibility of introducing and using sub-
routines, so that the program had a structure in harmony with the distributed nature of large
automation systems. With these conditions, PLC manufacturers introduced other programming
languages in a graphical or text form and at a higher level of programming, while retaining the
ladder language up to now, mainly because of some key advantages, namely:
◾
It is a symbolic or graphical language with a very simple way of representation that closely
resembles the structure of classic automation circuits, and this is why it is not only familiar
to all engineers dealing with industrial automation, but to technical electricians as well.
◾
It has very short execution times for instructions, as well as short execution time of a pro-
gram branch, so that all branches are considered running almost in parallel mode, just like
in conventional automation circuits.
◾
It provides the ability for online programming (thus allowing the user to make changes to
the program while the system is running) and the program can be compiled in real time.
At this point it should also be highlighted that ladder language is not suitable for all kinds and
sizes of industrial applications. If an engineer had to design a large automation system and write
the required automation program starting from an empty page, then the ladder language would
not be selected. For this case, the utilization of a flow chart and high-level programming language
will be needed, such as the sequential function chart (SFC) language and the function block dia-
gram (FBD) that will be described subsequently.
Until about 1990, PLC manufacturers were developing their proprietary programming lan-
guages with complete incompatibility between them. As an example, ladder languages from two
different manufacturers may have had a similar form, but under no circumstances were they
compatible. Furthermore, there were cases where two different PLCs of the same company
were manufactured to use ladder language but with a different notation that did not allow the
exchange of programs or the direct transfer of a program from one PLC to the other. Under these
Check for ON
Check for OFF
Start of logic
End of logic
Alphanumeric type
Symbol
Ι = Input
Ο = Output
Logic branch
Energize output if
the IF-THEN rule
is valid
I1
I2
O1
Do'stlaringiz bilan baham: |