Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
1- Objectives
Upon completion of this lab, one will be able to understand.
Logic gates in ladder logic programs i.e.
AND gate, OR gate, NOT gate,
NAND gate, NOR gate, XOR, XNOR.
Industrial applications of them.
Understands the Boolean algebra of simplifying complex functions in ladder logic
programs.
Karnaugh mapping.
Design examples in Online PLC Simulator to provide a study of the fundamentals of
developing, drawing and understanding event driven devices.
2- Pre task
AND Gate:
An AND Gate can be implemented neither using a combination of three NOR gates. The
Implementation is based on the alternate symbolic representation of the AND gate. The AND
Gate is represented as an OR gate with bubbles at the inputs and outputs. The
two bubbles at the input can be replaced by two NOT gates & implemented using two
NOR gates. If the two bubbles are removed from the two inputs, the OR gate with the bubble
at the output represents a NOR gate.
Symbol
1
Industrial Electronics
• Example: control system for machine control in safety i.e. machine will operate only if
safety guard is in position and power is ON.
2
Industrial Electronics
5V PB1
AND Buzzer
5V
PB2
Relay logic allows this function to be represented this way. Figure shows the actual wiring
connection for two switches, an alarm and a battery in an AND configuration. The alarm will
horn only when SWITCH1 AND SWITCH2 are ON. The Boolean expression for this is
OR Gate making:
A NOR Gate performs the OR-NOT function. Removing the NOT gate at the output of
the NOR gate results in an
OR gate. The effect of the NOT gate at the output of the NOR gatecan be cancelled by connectin
g a NOT gate at the output of the NOR Gate. The two NOTgates cancel each other out. A NOT
Gate implemented using a NOR gate is connected to the output of a NOR gate.
3
Industrial Electronics
4
Industrial Electronics
Example: double door motor car door opening i.e. when any door is open so alarm becomes
ON.
TASK 2:
Show the logic gate, truth table and circuit representation for an alarm – horn that will sound if
its two inputs switch1 or PB1 and PB2 or Switch2, both are on at same time or any of switches is
in ON state.
Logic Function:
For an alarm horn, when either of switch PB1 and switch PB2 is pressed indicates circuit is
operating on a parallel logic i.e. OR logic
The same approach is taken for the OR function. The circuit shown in Fig.6 illustrates two
switches wired as an OR function controlling an alarm. As can be seen from the circuit, the
alarm will turn on if SWITCH 1 OR SWITCH 2 is closed; that is, depressing either of the
switches will cause the alarm to horn. The Boolean expression for this circuit is
5V PB1
OR Buzzer
5V
PB2
Un-pressed: 0 Pressed: 1
0 0 0 (Buzzer off)
0 1 1 (Buzzer on)
1 0 1 (Buzzer on)
1 1 1 (Buzzer on)
5
Industrial Electronics
3- NOT Gate:
Not gate gives logic zero for high input and vice versa.
Truth table:
6
Industrial Electronics
NAND Gate
The AND gate implementation using three NOR gates is shown in figure. A NAND
Gate implementation requires addition of an inverter (NOT) gate at the output. The NOT gate is
Implemented using a NOR gate. Figure. NOR gates 1, 2 and 3 implement the AND gate.
NOR gate 4 implements the NOT gate connected at the output of the NAND gate.
7
Industrial Electronics
4- NOR Gate
The OR gate implementation using three AND gates is shown in figure. A NOR
gate implementation requires addition of an inverter (NOT) gate at the output. The NOT gate is
implemented using a NAND gate. Figure. NAND gates 1, 2 and 3 implement the OR gate.
NAND gate 4 implements the NOT gate connected at the output of the NOR gate.
8
Industrial Electronics
5- XOR Gate
The Exclusive-OR Gate or XOR Gate performs a function that is equivalent to the
combination of NOT, AND and OR gates. XOR gates are extensively used in digital
applications; therefore XOR gates are available as basic components. Most commonly used
9
Industrial Electronics
XOR Gates have two inputs. The XOR gate is represented by symbol shown in figure.
10
Industrial Electronics
6- XNOR Gate
Exclusive NOR gate: it has output logic one if all inputs are true or if all inputs are false, and has
logic zero output otherwise.
Truth table
11
Industrial Electronics
7- Boolean Algebra
Ladder program can be derived from Boolean expressions since we are concerned with a
mathematical system of logic. So
A.B=Q
Q=1 only when A=1 and B=1, Q=0 other wise
A+B=Q
Q=1 only when A=1 or B=1
Implementing the functions:
1. A+B.C=Q
2. Logic diagram with many inputs as
A signal lamp is required to be switched on if a pump is running and the pressure is
satisfactory, or if the lamp test switch is closed. For the inputs from the pump and the
pressure sensors we have an AND logic situation since both are required if there is to be an
output from the lamp. We, however, have an OR logic situation with the test switch in
that it is required to give an output of lamp on regardless of whether there is a signal from
the AND system
8- Karnaugh map
The Karnaugh map is a graphical method of Boolean logic expression reduction. A Boolean
expression can be reduced to its simplest form by grouping together expressions with
common factors and therefore eliminating unwanted variables. With the Karnaugh map
Boolean expressions having up to four and even six variables can be simplified.
12
Industrial Electronics
It is actually is a grid-like representation of a truth table, but the mode of presentation gives
more insight. A Karnaugh map has zero and one entries at different positions. Each
position in a grid corresponds to a truth table entry. Populate the entries. Group the adjacent
1’s. Analyze the groups and list the reduced Boolean expression.
Pairs:
Quad:
Here two variables and their complements will be eliminated. Where change occurs so will
be eliminated.
13
Industrial Electronics
Octet:
Three variables and their complements will be eliminated.
14
Industrial Electronics
Overlapping groups:
15
Industrial Electronics
Redundant groups:
Lab tasks:
Task 1:
Consider a motor is connected is an output of AND gate, draw the LD diagram and
simulate it.
16
Industrial Electronics
From the truth table we have known that when both inputs S 1 and S 2 are closed then the motor will
run, otherwise it will not run.
Conclusion:
Motor will turn ON only when both switches are turn ON.
Task 2:
OR Gate Implementation:
SIMULATION :
Conclusion:
Task3
Nor gate implementation
17
Industrial Electronics
Task 4:
If any one or more fans fail, an alarm should be activated to signal the failure of one or
more exhaust fans.
18
Industrial Electronics
Ladder diagram
Simulation
19
Industrial Electronics
Task5
• A Washing Machine has three sensors to check for washing machine lid open, washing
tub filled to minimum level and weight of cloths and water in the tub. If the lid of the Wa
sh
machine is open or the water is below the minimum level or the washing machine has bee
n overloaded the appropriate sensor generates an output of1.
• During the normal operation of the Washing Machine all the sensors output a 0.
Ladder diagram
20
Industrial Electronics
Simulation
Task 6
21
Industrial Electronics
Heat exchanger i.e. when levels change so alarm will are alert. That is, when the water level
exceeds the upper limit or the if the water level comes to the lowest level so at that level the
heater may be damaged that why an alarm has to turned ON to alert. As shown
22
Industrial Electronics
Task1
If any one or more fans fail, an alarm should be activated to signal the failure of one or
more exhaust fans.
Task 2
Washing Machine has three sensors to check for washing machine lid open, washing
tub filled to minimum level and weight of cloths and water in the tub. If the lid of the Washing
machine is open or the water is below the minimum level or the washing machine has been
overloaded the appropriate sensor generates an output of 1. The outputs of the three sensors
are connected to the inputs of a 3-input NOR gate. During the normal operation of the
Washing Machine all the sensors output a 0. The corresponding output of the NOR gate is a 1.
23
Industrial Electronics
If an erroneous condition is detected by any one or more sensors, the corresponding sensor
output(s) is set to 1, setting the NOR gate output to a 0. The NOR gate output is connected to
the main switch which switches off the washing machine.
Task 1
Consider a light bulb hooked to two 3-way switches. You sometimes see these near stair cases.
(Wiring a 3-Way Switch ) The light goes on if only one switch is in the "up" position and the
other switch is in the "down" position. If both are in the "up" position or both are in the "down"
position, the light is off. The light's state (on or off) is the XOR of the state of the two switches.
Ladder diagram:
24
Industrial Electronics
Task 2
1. Make ladder diagram program for NAND gate
2. Make ladder diagram program for NOR gat
3. Make ladder program for XOR gate
4. Implement the following code
101011
100011
110111
Hint: simplifying by karnaugh map. i.e.
A B C D E F Output
1 0 1 0 1 1 1
1 1 0 1 1 1 1
1 0 0 0 1 1 1
- - - - - - 0
Logic:
To design a simplified diagram that use minimum number of switches, simplify the truth table
using ‘Karnaugh’ map. To draw Karnaugh map, we need to know the truth table.
Truth Table:
The only 3 combinations that result in opening of the door at entrance are set to 1 and are shown
in figure:
25
Industrial Electronics
A B C D E F Output
1 0 1 0 1 1 1
1 1 0 1 1 1 1
1 0 0 0 1 1 1
- - - - - - 0
Karnaugh Map:
Explanation:
To implement simplified Boolean Function using ladder logic, we needed NO and NC contacts,
timer on-delay instruction TOFF and output.
26
Industrial Electronics
Circuit representation
Ladder logic allows this function to be represented this way. Figure shows the actual wiring
connection for switches, and supply
Simulation:
27
Industrial Electronics
Ladder diagram
To start the simulation, click on RUN. As program starts running, verify the truth table:
Simulation:
When first enters ‘101011’ ,the motor will run immediately.
28
Industrial Electronics
Now stopping the whole process by pressing the Ok button which will refresh the
function.
Now implementing the other codes so we will get the desired output.
When someone enters the wrong password say ‘010001, the door will not open.
Conclusion:
29