You are on page 1of 21

Process Control

And
Experimental Design for Engineers
(MIEng 6331)
DATA HANDLING IN PROGRAMMABLE LOGIC
CONTROLLERS
(PLCS)
Objective
 What is Data Handling in Programmable Logic
Controllers (PLCs)
 What are the common Data Handling instruction in PLCs
 Explainthe difference between a move instruction and a
Masked move instruction.
 Determine the data resulting after execution of a masked
move instruction.
 Describe the function of the common comparison
instructions.
Data Handling
 Data handling :- deals with more than bit, like moving or
transferring numbers from one memory location to another,
comparing data values or performs simple arithmetic operations.
 Uses when data needs to be moved, copied, from one data file
source to another.
 Data handling instruction requires two or more words of data
memory for operation.
 The data handling instructions allow the movement, manipulation,
or storage of data in either single- or multiple-word groups from one
data memory area of the PLC to another.
Move instruction (MOV)
 Comes in a block format with both a source and a destination
parameter.
 Simply moves data from the source word and puts it into the
destination word. It does not convert or manipulate the data in any
way.
 The data in a move block’s source parameter can be either a
variable value stored in a word, which changes during program
execution, or a fixed constant value, which is entered during
programming .
 When instruction is true, a copy of the source data will be moved
to the specified destination address.
Move instruction Cont.…
 For the rung shown when there is
For moving data an input to || in the rung, the move
from one location or occurs from the designated source
register to another, Mitsubishi address to the designated
Figure illustrates a destination address.
common practice of  Typical ladder program data-
using one rung of a handling instruction contains
ladder program for  Data-handling instruction
each move Allen-Bradley
 The source (S) address from
operation, showing
the form used by
where the data is to be
three obtained
manufacturers :  The destination (D) address to
Siemens where it is to be moved.
Move instruction Cont.…
Figure shows an example of the
MOV instruction.
 When the rung is true, input
switch A closed, the value
stored at the source address,
N7:30, is copied into the
destination address, N7:20.
 When the rung goes false,
input switch A opened, the
destination address will retain
the value unless it is changed
elsewhere in the program. Block-formatted move instruction
 The source value remains
unchanged and no data
conversion occurs.
Move instruction Cont.…
Figure illustrates how the move (MOV) instruction can be used
to create variable preset timer values. A two-position selector
switch is operated to select one of two preset timer values.
 When the selector switch is in the open 10 s position, rung 2
has logic continuity and rung 3 does not.
 Asa result, the value 10 stored at the source address, N7:1, is
copied into the destination address, T4:1.PRE.
 Therefore,the preset value of timer T4:1 will change from 0
to 10. When pushbutton PB1 is closed, there will be a 10 s
delay period before the pilot light is energized.
 When the selector switch is in the closed 5 s position, rung 3
has logic continuity and rung 2 does not.
 As a result, the value 5 stored at the source address,
N7:2, is copied into the destination address, T4:1. PRE.
 Closingpushbutton PB1 will now result in a 5 s time-delay
period before the pilot light is energized.
Move instruction used to change the preset
time of a timer
Masked Move Instruction(MVM)
 This is an output instruction that moves
a copy of one data file element through
a mask to a specified destination.
 When a true instruction, a copy of the
data specified in the source is moved Operation of a mask word
through a hexadecimal mask to the • The pattern of characters in the mask determines which source
specified destination. bits will be passed through to the destination address.
• The bits in the mask that are set to zero (0) do not pass data.
 A masked move instruction operates
• Only the bits in the mask that are set to one (1) will pass the
like a regular move instruction, except source data through to the destination.
that a masked move filter out data • Bits in the destination are not affected when the corresponding
which do not want to move. bits in the mask are zero.
 Moves data from a source location to a • The MVM instruction is used to copy the desired part of a 16-
selected portion of the destination. bit word by masking the rest of the value.
Masked Move Instruction(MVM)
Figure shows an example of a mask move (MVM)
instruction.
This instruction transfers data through the mask from the
source address, B3:0, to the destination address, B3:4.
 Themask may be entered as an address or in hexadecimal
format, and its value will be displayed in hexadecimal.
 When there is a 1 in the mask, data will pass from
the source to the destination.
 When there is a 0 in the mask, data in the destination will
remain in their last state.
 Statusin bits 4–7 are unchanged due to zeroes in the
mask (remained in their last state).
 Statusin bits 0–3 and 8–15 were copied from the
source to destination when the MVM instruction went
true.
Figure Masked move (MVM) instruction.
 The mask must be the same word size as the source
and destination.
Comparison Instructions

 The data comparison instruction compare two data values in PLC.


 Thusit might be to compare a digital value read from some input device with a
second value contained in a register.
 With ladder programs, for data comparison the typical instruction will contain.
 Data transfer instruction to compare data.
 The source (S) address which data is to be obtained for the comparison.
 The destination (D) address of the data against which it is to
be compared.
Comparison Instruction (Cont.… )
 Type of formats used by three manufacturers using the greater-than form of
comparison.

Mitsubishi Allen-Bradley Siemens


 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.
 Allen-Bradley, uses the source of the data being compared is given as the accumulated value
in timer 4.0 and the data against which it is being compared is the number 400.
 Siemens, 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.
Comparison Instruction (Cont.… )
PLCs generally can make comparisons for:-
 Equal to (= or = = or EQ or EQU)
The equal (EQU) instruction is an input instruction that compares
source A to source B: when source A is equal to source B, the
instruction is logically true; otherwise it is logically false.
When the accumulated value of counter T4:0 stored in source A’s
address equals the value in source B’s address, N7:40, the EQU logic rung.
instruction is true and the output is energized.
 • Source A may be a word address or a floating-point address.
 • Source B may be a word address, a floating-point address, or a Floating-point data file Used to store integers
constant value. and other numerical values that cannot be stored
in an integer file.
 With the equal instruction, the floating-point data is not
recommended because of the exactness required. One of the
other comparison instructions, such as the limit test, is
preferred.
Comparison Instruction (Cont.… )
 Not equal to (≠ or < > or NE or NEQ)
The not equal (NEQ) instruction is an input instruction that
compares source A to source B: when source A is not equal to
source B, the instruction is logically true; otherwise it is
logically false.
When the value stored at source A’s address, N7:5, is not equal
to 25, the output will be true; otherwise, the output will be false.
 The value stored at Source A is 30.
NEQ logic rung.
 The value stored at Source B is 25.
 Since the two values are not the same the output will be true
or on.
 In all input-comparison instructions, Source A must be an
address and Source B can be an address or a constant.
Comparison Instruction (Cont.… )
 Less than (< or LT or LES)
The less than (LES) instruction is an input
instruction that compares source A to source B:
when source A is less than source B, the instruction
is logically true; otherwise it is logically false.
 The instruction is either true or false, depending
on the values being compared.
 When the accumulated value of counter C5:10,
stored at the address of source A, is less than the
constant 350 of source B, the output will be on; LES logic rung
otherwise, it will be off.
Comparison Instruction (Cont.… )

 Less than or equal to ( or <, <= or LE or LEQ)


The less than or equal (LEQ) instruction is an input instruction that
compares source A to source B: when source A is less than or equal to
source B, the instruction is logically true; otherwise it is logically
false.
 When the accumulated count of counter C5:1 is less than or equal
to 457, the pilot light will turn on.
 The accumulated value of the counter is less than 457. Figure 10-26 LEQ logic rung
 Therefore the output will be false or off.
Comparison Instruction (Cont.… )

 Greater than (> or GT or GRT)


The greater than (GRT) instruction is an input
instruction that compares source A to source B:
when source A is greater than source B, the
instruction is logically true; otherwise it is logically
false.
 The instruction is either true or false, depending
on the values being compared.
Figure 10-23 GRT logic rung
 When the accumulated value of timer T4:10,
stored at the address of source A, is greater than
the constant 200 of source B, the output will be
on; otherwise the output will be off.
Comparison Instruction (Cont.… )
 Greater than or equal to (> or >= or GE or GEQ)
The greater than or equal (GEQ) instruction is an input
instruction that compares source A to source B: when
source A is greater than or equal to source B, the instruction
is logically true; otherwise it is logically false.
 When the value stored at the address of source A,
N7:55, is greater than or equal to the value stored at
the address of source B, N7:12, the output will be
true; otherwise, it will be false.
 The value stored at source A is 100.
 The value stored at source B is 23.
 Therefore the output will be true or on
Comparison Instruction (Cont.… )
Figure 10-32 shows the program required to implement the circuit
using only one internal timer
 The momentary stop button is closed.
 When the momentary start button is pressed, SOL A output
energizes immediately to switch on solenoid A.
 SOL A examine-on contact becomes true to seal in output SOL
A and to start on-delay timer T4:1 timing.
 The timer preset time is set to 15 seconds.
 Output SOL D will energize (through the timer done bit
T4:1/DN) after a total time delay of 15 seconds to energize
solenoid D.
 Output SOL B will energize after a total time delay of 5 seconds,
when the accumulated time becomes equal to and then greater
than 5 seconds. This, in turn, will energize solenoid B.
 Output SOL C will energize after a total time delay of 10
seconds, when the accumulated time becomes equal to and then Figure 10-32 Controlling multiple loads using
greater than 10 seconds. This, in turn, will energize solenoid C. one timer and the GEQ instruction.
Comparison Instruction (Cont.… )
Figure 10-33 shows an application of an on-delay timer program
implemented using the EQU instruction .
 When the switch (S1) is closed, timer T4:1 will begin timing.
 Both EQU instructions’ source As are addressed to get the
accumulated value from the timer while it is running.
 The EQU instruction of rung 2 has the value of 5 stored in source
B.
 When the accumulated value of the timer reaches 5, the EQU
instruction of rung 2 will become logic true for 1 second.
 As a result, the latch output will energize to switch the pilot light
PL1 on.
 When the accumulated value of the timer reaches 15, the EQU
instruction of rung 3 will be true for 1 second.
 As a result, the unlatch output will energize to switch the pilot light
PL1 off. Figure 10-33 Timer program implemented
using the EQU instruction
 Therefore, when the switch is closed, the pilot light will come on
after 5 seconds, stay on for 10 seconds, and then turn off.
Reference
 PROGR AMMABLE LOGIC C ONTROLLERS, Fourth Editon, Frank D. Petruzella
 PROGRAMMABLE LOGIC CONTROLLERS , Sixth Edition, W. Bolton
Thank You!!!

You might also like