CHAPTER SEVEN
DATA HANDELLING
This chapter is about PLC operations involving blocks of data (words)
representing a value.
1
Data Handling
Data handling consists of operations involving moving or transferring
numeric information stored in one memory word location to another word
in a different location, comparing data values, and carrying out simple
arithmetic operations.
The following are examples of data-handling instructions to be found with
PLCs.
1. Data Movement
The figure shows
the form used by
three manufac-
turers to move data
from one location or
register to another.
When there is an
input to | | in the
rung, the move
occurs from the 2
designated source
address to the designated destination address.
Data transfers might be to move a preset value to a timer or counter, or a
time or counter value to some register for storage, or data from an input to
a register or a register to output.
The figure shows the rung, in the Allen-
Bradley format, that might be used to transfer
a number held at address N7:0 to the preset of
timer T4:6 when the input conditions for that
rung are met.
A data transfer from the accumulated value in a counter to a register would
have a source address of the form C5:[Link] and a destination address of
the form N7:0.
A data transfer from an input to a register might have a source address of
the form I:012 and a destination address of the form N7:0.
A data transfer from a register to an output might have a source address of
the form N7:0 and a destination address of the form O:030.
3
2. Data Comparison
The data comparison instruction gets the PLC to compare two data values.
Thus it might be to compare a digital value read from some input device with
a second value contained in a register. For example, we might want some
action to be initiated when the input from a temperature sensor gives a
digital value that is less than a set value stored in a data register in the PLC.
The figure shows the type of formats
used by three manufacturers using the
greater-than form of comparison.
In figure (a) the format is that used by
Mitsubishi, S indicating the source of
the data value for the comparison and D
the destination or value against which
the comparison is to be made. Thus if
the source value is greater than the
destination value, the output is 1.
In figure (b) the Allen-Bradley
format has been used. Here the
source of the data being compared is 4
given as the accumulated value in
timer 4.0 and the data against
which it is being compared is the number 400.
Figure (c) shows the Siemens format. The values to be compared are at
inputs IN1 and IN2 and the result of the comparison is at the output: 1 if
the comparison is successful, otherwise 0.
PLCs generally can make comparisons for:
• less than (< or LT or LES),
• equal to (= or = = or EQ or EQU),
• less than or equal to (≤ or <= or LE or LEQ),
• greater than (> or GT or GRT),
• greater than or equal to (≥ or >= or GE or GEQ),
• and not equal to (≠ or <> or NE or NEQ).
Example:
Four outputs need to be started in sequence, that is, output 1 starts when
the initial switch is closed, followed sometime later by output 2, sometime
later by output 3, and sometime later by output 4. Though this could be
done using three timers, another possibility is to use one timer with
greater-than or equal elements. The figure shows a possible ladder 5
diagram by Mitsubishi.
When the X401 contacts close, the output
Y430 starts. The timer is also started.
When the timer-accumulated value reaches
5 s, the greater-than or equal-to element
switches on Y431. When the timer accumu-
lated value reaches 15 s, the greater-than
or equal-to element switches on Y432.
When the timer reaches 25 s, its contacts
switch on Y433.
3. Data Selection
There are a number of selection function
blocks available with PLCs. The figure
shows the standard IEC symbols.
6
4. Data Conversion
Most PLCs provide BCD-to-
binary or integer and integer or
binary-to-BCD conversions.
5. Arithmetic Operations
Some PLCs are equipped to
carry out just the arithmetic
operations of addition and
subtraction, others the four Conversion BCD-to-integer and integer-to-BCD:
(a ) Siemens, (b) Allen-Bradley format.
basic arithmetic operations
of addition, subtraction,
multiplication, and division.
Figure (a) shows the Allen-
Bradley format for ADD;
the other arithmetic func-
tions have a similar format.
The data in source A, which
is at N7.1, is added to that in
source B, which is at N7.3, 7
and the result is put at the
destination N7.5.
Closed Loop Control
Closed loop control of some variable, such as the control of the temperature
in a room, is achieved by comparing the actual value for the variable
with the desired set value and a signal is obtained representing the
difference or error. A controller then takes this difference signal
and gives an output signal to an actuator to reduce the difference.
Since the actuator and the measured values are analog and thus require
conversion to digital; analog-to-digital and digital-to-analog units have thus
been used. 8
Modes of Control
There are a number of methods by which the controller can react to an
error signal:
9
Control with a PLC
The figure shows a PLC ladder rung that
can be used to exercise on-off control.
The output is turned on when source A,
the actual temperature, is less than
source B, the required temperature, that
is, the set value.
Many PLCs provide the PID
calculation to determine the
controller output as a standard
function block. It is then
necessary to pass the desired
parameters, KP, TR, TD, and
input/output locations to the
routine via the PLC program.
The figure shows the IEC 1131-
3 standard symbol for the PID
control function.
10