Basic Programming Principles of PLCs
◾
291
CPU. For example, if we have a light electronic display for listing the current counting of the
passed bottles, the required display information will be obtained from the CV output. Finally,
the counter has a digital “0” or “1” output. This output is at logic “1” if the content of C
xx
≠ 0.
When the content is reset, the Q output of C
xx
becomes a logic “0”. It is possible to encounter
the opposite logic where for C
xx
≠ 0, Q = “0”. This output can be used as a contact-based logic
instruction anywhere in the LAD program with the form
C
xx
. This instruction will pro-
vide RLO = “1” when C
xx
≠ 0 according to the first definition. The same is valid for the corre-
sponding instruction A Cxx in Boolean language, while a similar graphic symbol and features
can also be found in FBD language.
Comparison instructions. It is possible, via comparison instructions, to compare two numbers
in all their basic formats, such as integers, real, etc. The comparison of any kind (≤, ≥, >, <, =, etc.)
is always performed between the two contents existing in the first two accumulators always in
the same order, e.g., content of register 1 > content of register 2. The comparison instructions are
always used in conjunction with the load instruction. With two consecutive loading instructions,
L N1 and L N2 (Boolean language), the two numbers are entered into the two registers and can
be compared if a comparison instruction is followed. When the comparison is satisfied, the CPU
generates an RLO = “1”. In Figure 7.12, the graphical symbol for the comparison of two integer
numbers in the LAD language (Step7—Siemens) is presented.
The input of the comparator is a discrete variable (“0” or “1”) and enables the comparison when
it is at logical “1”. The output of the comparator generates a logical “1” when the comparison is
satisfied, provided that the input is enabled. At the inputs IN1 and IN2 of the comparator, the two
numbers to be compared are declared, which can be either variables (e.g., T, C, or Q) or constant
values. In FBD language, a similar graphic symbol is utilized.
Program flow control instructions. These instructions, as their name suggests, help to change
the execution flow of the instructions within the same program with or without a condition.
With the JU label instruction (in Boolean language), the program flow switches to the instruction
characterized by this label tag, bypassing the intermediate instructions, unconditionally and inde-
pendently of the RLO. Conversely, with the instruction JC label, the transition occurs only when
a condition is satisfied and thus RLO = “1”. In LAD language, the jump instruction
JMP
Label
is always executed, while the instruction
(
JMP
)
Label
I3.3
is executed only when the digital input
I3.3 is energized. Similar graphical symbols for the two above instructions are also found in FBD
language.
When the CALL instruction (in Boolean language) is called at the point of program where the
instruction is executed, another program block or POU according to the IEC 61131-3 standard
terminology is in order to be executed. The POU can be an FB or an FC, in which it is possible to
program a separate automation function that can either be repeated several times (subroutine) or
CMP
≥ I
IN1
IN2
Input
Output
CMP
≥ I
IN1
IN2
Do'stlaringiz bilan baham: