Sei sulla pagina 1di 29

Industrial Electronics

LAB REPORT NO.2

Logic gates and logic functions implementations

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

Truth table and circuit

1
Industrial Electronics

Ladder diagram and time analysis

• 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

Alarm = (Switch1) • (Switch2)

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

Truth table and circuit diagram

Ladder and time diagram

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

Alarm= (Switch1) + (Switch2)

5V PB1

OR Buzzer
5V
PB2

Un-pressed: 0 Pressed: 1

Switch1 Switch2 State

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:

Circuit diagram Time diagram

Example: when there is no light to a light sensor so there is an output.

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.

Truth table and derivation symbolically

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

Truth table and ladder, time diagram

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.

Truth table and making XOR

10
Industrial Electronics

Ladder and timing diagram

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:

Here one variable and its


Complement will be eliminated. As shown.

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:

Rolling the map:

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:

Truth table for AND gate is verified.

Motor will turn ON only when both switches are turn ON.

Task 2:

OR Gate Implementation:

SIMULATION :

Conclusion:

 Truth table for OR gate is verified.


 Alarm will turn off only when both switches are un-pressed.

Task3
Nor gate implementation

17
Industrial Electronics

Task 4:

 A warehouse is used to store industrial chemicals. Toxic fumes produced by the


chemicals are removed from the warehouse and dispersed in the atmosphere through
three exhaust fans. The three exhaust fans should be continuously working to remove the
dangerous toxic fumes.

 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.

• If anyone sensor becomes ON so the main switch will become OFF.

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

Ladder diagram and simulation

22
Industrial Electronics

Task1

 A warehouse is used to store industrial chemicals. Toxic fumes produced by the


chemicals are removed from the warehouse and dispersed in the atmosphere through
three exhaust fans. The three exhaust fans should be continuously working to remove the
dangerous toxic fumes.

 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.

Post LAB TASKS

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:

The simplified Boolean equation will be:

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:

Open new file and form the ladder logic as:


 The switch-B, C and D are NC contacts while A, E and F is NO contacts.
 The switch-B and D are connected in series and are in parallel with switch-C.
 All are connected directly to motor/output.
 Addressing the components :shown in the ladder diagram

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:

 Desired function is achieved.


 Above simulation & ladder diagram show that the motor will run only when the correct
code is given
 If wrong password is entered, the motor will not run.

29

Potrebbero piacerti anche