MA LAB 8
MA LAB 8
Abstract
In this laboratory session, students delve into the use of comparison commands within
PLC programming, crucial for implementing logic-based controls. The commands
studied include Equal (EQU), Not Equal (NEQ), Less Than (LES), and Greater Than
(GRT), among others. Through exercises, students apply these commands to simulate
complex tasks like traffic light control, enhancing their understanding of logic operations
in automation and the role of comparison commands in simplifying and optimizing
industrial processes.
Page | 2
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Table of Contents
Lab # 08......................................................................................................................................4
Comparison Command...........................................................................................................4
Objective.................................................................................................................................4
Software..................................................................................................................................4
Experiment Setup...................................................................................................................4
Introduction............................................................................................................................4
EQU – Equal......................................................................................................................4
NEQ – Not Equal...............................................................................................................5
LES – Less Than................................................................................................................5
LEQ - Less Than or Equal.................................................................................................5
GRT - Greater Than...........................................................................................................6
GEQ - Greater or Equal......................................................................................................6
Lab Tasks................................................................................................................................6
Exercise No. 1....................................................................................................................6
Exercise No. 2....................................................................................................................8
Exercise No. 3....................................................................................................................9
Exercise No. 4..................................................................................................................11
Conclusions..........................................................................................................................14
Page | 3
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Lab # 08
Comparison Command
Objective
To know about function of comparison command
To simulate tasks in Allen Bradley PLC
Software
LogixPro
RSLogix500
Experiment Setup
1. A PLC (Programmable Logic Controller)
2. A power supply for the PLC
3. Input and output devices (switches, sensors, relays, etc.)
4. A computer with PLC programming software
5. A programming cable to connect the PLC to the computer.
Introduction
In general comparison instruction are used to test a pair of values to energize or de-energize a
rung.
The following is a list of the comparison instructions:
EQU - Equal
NEQ - Not Equal
LES - Less Than
LEQ - Less Than or Equal
GRT - Greater Than
GEQ - Greater or Equal
EQU – Equal
Symbol
Definition
Test whether two values are equal or not.
If source A and Source B are equal, the instruction is logically true. Source A must be
an address. Source B can either be a program constant or an address. Negative
integers are stored in two's complement.
Page | 4
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Definition
Test whether one value is not equal to a second value.
If Source A and Source B are not equal, the instruction is logically true. If the two
values are equal, the instruction Is logically false,
Source A must be an address. Source B can be either a program constant or an
address. Negative integers are stored in two's complement.
LES – Less Than
Symbol
Definition
Test whether one value is less than a second value.
If Source A is less than the value at source B the instruction is logically true. If the
value at source A is greater than or equal to the value at source B, the instruction is
logically false. Source A must be an address. Source B can either be a program
constant or an address.
Negative integers are stored in two's complement.
LEQ - Less Than or Equal
Symbol
Definition
Test whether one value is less than or equal to a second value.
If value at source A is less than or equal to the value at source B, the instruction is
logically true.
If the value at source A is greater than or equal to the value at source B, the
instruction is logically false.
Page | 5
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Definition
Test whether one value is greater than the second value.
If the value at source A is greater than the value at source B, the instruction is
logically true.
If the value at source A is less than or equal to the value at source B, the instruction is
logically false.
Source A must be an address. Source B can either be a program constant or an
address.
Negative integers are stored in two's complement.
GEQ - Greater or Equal
Symbol
Definition
Test whether one value Is greater or equal to a second value.
If the value at source A is greater than or equal the value at source B, the Instruction
is logically true.
If the value at source A is less than to the value at source B, the instruction is logically
false.
Source A must be an address. Source B can either be a program constant or an
address.
Negative integers are stored in two's complement.
Lab Tasks
Exercise No. 1
Perform the Limit and Mask Instructions on Allen Bradley Simulator.
Mask Instruction
Page | 6
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Limit Instruction
Page | 7
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Exercise No. 2
Consider a system in which we have a switch to turn on light and fan. Light goes on when
switch is pressed 5 times and fan when pressed 10 times. Also reset switch.
Page | 8
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Software
Exercise No. 3
From the Simulations Menu at the top of the screen, Select the Traffic Light Simulation
Using your knowledge of timers and comparison instruction, develop a ladder logic program
which will sequence a set of green, amber, and red lights in the following manner:
Sequence of Operation:
1. Light 0:2/00 (Red) - 12 seconds ON
2. Light 0:2/02 (Green) = 8 seconds ON
3. Light 0:2/01 (Amber) — 4 seconds ON
4. The sequence now repeats with Red = ON.
Red Green Amber
12 sec. 8 sec. 4 sec.
Page | 9
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Software
Page | 10
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Exercise No. 4
Modify your program so that the 3 lights which represent the other traffic direction are also
controlled.
Red = O:2/00 Green = O:2/02 Amber = O:2/01
Green = O:2/06 Amber = O:2/05 Red = O:2/04
8 sec. 4 sec. 8 sec. 4 sec.
Software
Page | 11
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Page | 12
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Page | 13
Department of Mechatronics and Biomedical Engineering
Manufacturing Automation Lab (MT 451L)
Conclusions
In this lab, we explored the application of comparison commands and their ability to simplify
complex problems, such as regulating traffic signals. These commands are particularly useful
in managing timer-based tasks due to their straightforward implementation and efficiency. By
delving into the use of comparison commands, we gained valuable insights into their practical
applications, enhancing our problem-solving skills.
We learned how comparison commands can streamline processes that would otherwise be
cumbersome. For instance, in traffic signal regulation, these commands enable precise control
over the timing and sequencing of signals, ensuring smooth traffic flow and enhanced safety.
We practiced configuring these commands to create logical conditions that determine the
state of traffic lights based on various inputs, such as time of day or traffic density.
Additionally, we applied our knowledge to real-world scenarios by setting up traffic signal
Page | 14
Department of Mechatronics and Biomedical Engineering