Module + Activity - Logic Gates
Module + Activity - Logic Gates
LOGIC CIRCUITS
AND DESIGN
(CpE 301)
LOGIC GATES
Module Contents:
2
2.1 INTRODUCTION
Logic gates are the building blocks of any digital circuit which is the building
block of modern digital systems. Therefore it is important to study the logical
operation, application, and troubleshooting of logic gates.
A Logic gate has one or more inputs and only one output; it is defined as an
electronic circuit or device which makes logical decisions. The output logical
decision is a fundamental property of a logic gate and it is a result of certain
input combinations.
The logic gates AND, OR, and NOT are referred to as Basic Logic Gates. The
basic gates combine to form more complex logic circuits called Combinational
Logic Gates. The available combinational logic gates are: NAND, NOR, XOR,
and XNOR.
In digital systems there are only two possible states represented by two
voltage levels. The two states or voltage-levels are:
HIGH and it represents Closed switches, Lights ON, or Logic-1
LOW and it represents Open switches, Lights OFF, or Logic-0
3
Basic Logic Gates
The three basic logic gates are:
1) AND
2) OR
3) NOT
INPUTS OUTPUT
The logical operation of a series switching circuit S1 S2 L
of Figure 2 is illustrated in Table 1 as follows: Open Open OFF
When both S1 and S2 are open L is OFF. Open Closed OFF
4
2.2.2 AND Logic Gate
The digital circuit which can act exactly like an AND switching circuit is
known as AND logic gate. Therefore the AND gate can be defined as a
logic device that has two or more inputs and a single output such that its
output is High only if all of its inputs are High.
Logic Symbol
The logical operation of the AND Gate is such that INPUTS OUTPUT
the output is HIGH only when all of the inputs are A B X
HIGH. When any one of the inputs is LOW, the
0 0 0
output is LOW.
0 1 0
We generally express the logical operation of a gate
1 0 0
with a table. The table that lists all input
1 1 1
combinations and the corresponding outputs is
Table 2: Truth table
called the truth table and is illustrated in Table 2.
for 2-input AND gate
Boolean Expression
5
2.2.3 Number of Input Combinations
Exercise-1:
6
c) Write the Boolean expression for a 3-input AND gate.
7
2.2.4 Parallel Switching Circuit
INPUTS OUTPUT
The logical operation of a Parallel switching
S1 S2 L
circuit of Figure 4 is illustrated in Table 4 and can
Open Open OFF
be explained as follows:
Open Closed ON
When both S1 and S2 are open L is OFF.
Closed Open ON
When S1 is open and S2 is closed L is ON.
Closed Closed ON
When S1 is closed and S2 is open L is ON.
Table 4: The logical
When both A and B are closed L is ON. operation of a parallel
switching circuit
The digital circuit which can act exactly like an OR switching circuit is known
as OR logic gate. Therefore the OR gate can be defined as a logic device
that has two or more inputs and a single output such that its output is High
if any one of its inputs is High.
8
Logic Symbol
INPUTS OUTPUT
The logic operation of the OR Gate is such that the
output is HIGH when any one of the inputs is A B X
LOW. 0 1 1
OR Boolean Expression
9
Exercise-2:
10
2.2.6 Inverter Switching Circuit
INPUTS OUTPUT
The logical operation of an inverter circuit of S L
Figure 6 is illustrated in Table 7 as follows: Open ON
When S is open L is ON. Closed OFF
When S is closed L is OFF. Table 7: The logical
operation of an inverter
circuit
The digital circuit which can act exactly like a NOT switching circuit is known
as NOT logic gate. Therefore, the NOT gate can be defined as a logic
device that has one input and a single output such that its output is HIGH if
its input is LOW.
11
Logic Symbol
Boolean Expression
Timing Diagram
1
Input (A)
0
1
(X) Output
0
12
2.3 Universal Logic Gates
2.3.1 The NAND Gate
The NAND gate is a very popular logic gate and is called a universal gate;
because it can be used to construct all basic gates or any combination of
these gates.
Logic Symbol
The term NAND is a short form of NOT-AND and means an AND function
with inverted output. A standard logic symbol for a two-input NAND gate
and its equivalent to an AND gate followed by a NOT gate (inverter), are
shown in Figures 9 and 10, with the inputs labeled A and B and the output
labeled X. The bubble indicate an inverted output.
A A
Q NAND X
AND NOT X B
B
Figure 10: NAND Logic
Figure 9: NAND Equivalent Logic Circuit
Symbol
AND NOT
The logical operation of the NAND gate is such
A B Q X= Q
that a LOW output occurs only when all inputs are
0 0 0 1
HIGH. When any of the inputs are LOW, the output
0 1 0 1
will be HIGH. The truth table illustrating the logical
1 0 0 1
operation of a two inputs NAND gate for all input 1 1 1 0
combinations is shown in Table 8. Table 8: Truth table
for NAND gate
13
Boolean Expression
The NOR gate, like the NAND gate, is a very useful logic gate because of its
universal properties which can be used to construct all basic gates or any
combination of these gates.
Logic Symbol
A Q A
OR NOT X
B NOR X
B
Figure 11: NOR Equivalent Logic
Figure 12: NOR Logic Symbol
Circuit
OR NOT
The logical operation of the NOR gate is such that
A B Q X= Q
a LOW output occurs when any of its inputs are
0 0 0 1
HIGH. Only when all inputs are LOW, the output
0 1 1 0
will be HIGH. The truth table illustrating the logical
1 0 1 0
operation of a two input NOR gate for all input 1 1 1 0
combinations is shown in Table 9. Table 9: Truth table
for NOR gate
Boolean Expression
The IEEE standard provides two different types of symbols for logic gates.
a) Distinctive-shape symbols: These are the symbols used in this module
since they represent the most commonly used symbols.
b) Rectangular-shape symbols: Where all the gates use the same shape,
along with an internal label to identify the type of gate.
Complete the table below based on what you have learned in this
module. Use the internet to search for rectangular-shape symbols for
the different logic gates.
AND
OR
NOT
NAND
NOR
16
2.5 Lab Activity 1:
OBJECTIVES: EQUIPMENT
To verify the truth table of the AND Logic Tutor LT345 Mk2
gate. Power Supply 5V
PROCEDURE
a) Make the connections as shown in the patching diagram of Figure 13.
To clearly understand these connections shown, the circuit is redrawn in
Figure 14.
b) Switch the dip switches A and B (ON/OFF) to form the combination
given in Table 10.
+5VDC 0VDC
ON OFF LP1
A
X
AND
ON OFF B
17
OBSERVATIONS
For each switching combination of A and B note Switches Output
the corresponding output state of (LP1) in Table A B LP1
10. OFF OFF
OFF ON
ON OFF
ON ON
Table 10: LP1 State
RESULT
Switches Output
Rewrite your observation in Table 11 using 1’s
A B X (LP1)
and 0’s format.
Note that (OFF 0) while (ON 1).
18
2.6 Lab Activity 2:
OBJECTIVES: EQUIPMENT
To verify the truth table of the OR Logic Tutor LT345 Mk2
gate. Power Supply 5V
PROCEDURE
a) Make the connections as shown in the patching diagram of Figure 15.
To clearly understand these connections, the circuit is redrawn in Figure
16.
b) Switch the dip switches A and B (ON/OFF) to form the combination
given in Table 12.
+5VDC 0VDC
ON OFF A LP1
X
OR
ON OFF B
19
OBSERVATIONS
For each switching combination of A and B note Switches Output
the corresponding output state of (LP1) in Table A B LP1
12. OFF OFF
OFF ON
ON OFF
ON ON
Table 12: LP1 State
RESULT
Switches Output
Rewrite your observation in Table 13 using 1’s
A B X (LP1)
and 0’s format.
Note that (OFF 0) while (ON 1).
20
2.7 Lab Activity 3:
OBJECTIVES: EQUIPMENT
Logic Tutor LT345 Mk2
To verify the truth table of NAND gate.
Power Supply 5V
PROCEDURE
a) Make the connections as shown in the patching diagram of Figure 17.
To clearly understand these connections, the circuit is redrawn in Figure
18.
b) Switch the dip switches A and B (ON/OFF) to form the combination
given in Table 14.
PATCHING DIAGRAM
ON OFF A LP1
ON OFF B
X
ON OFF NAND
C
ON OFF D
21
OBSERVATIONS
A B C LP1
For each switching combination of A and
OFF OFF OFF
B note the corresponding output state of OFF OFF ON
(LP1) in Table 14. OFF ON OFF
OFF ON ON
ON OFF OFF
ON OFF ON
ON ON OFF
ON ON ON
OFF OFF OFF
OFF OFF ON
OFF ON OFF
OFF ON ON
ON OFF OFF
ON OFF ON
ON ON OFF
ON ON ON
Table 14: LP1 State
22
RESULT
A B C X (LP1)
Rewrite your observation in Table
15 using 1’s and 0’s format.
Note that (OFF 0) while (ON 1).
23
2.8 Lab Activity 4:
OBJECTIVES: EQUIPMENT
To verify the truth table of the NOR- Logic Tutor LT345 Mk2
gate. Power Supply 5V
PROCEDURE
a) Make the connections as shown in the patching diagram of Figure 19.
To clearly understand these connections, the circuit is redrawn in Figure
20.
b) Switch the dip switches A and B (ON/OFF) to form the combination
given in Table 16.
PATCHING DIAGRAM
24
+5VDC 0VDC
ON OFF A
LP1
ON OFF B
X
ON OFF C NOR
ON OFF D
OBSERVATIONS
A B C LP1
For each switching combination of A and
OFF OFF OFF
B note the corresponding output state of OFF OFF ON
(LP1) in Table 16. OFF ON OFF
OFF ON ON
ON OFF OFF
ON OFF ON
ON ON OFF
ON ON ON
OFF OFF OFF
OFF OFF ON
OFF ON OFF
OFF ON ON
ON OFF OFF
ON OFF ON
ON ON OFF
ON ON ON
Table 16: LP1 State
25
RESULT
A B C X (LP1)
Rewrite your observation in Table
17 using 1’s and 0’s format.
Note that (OFF 0) while (ON 1).
26
2.9 Review Exercises
1) Complete the AND logic table and symbol seen below.
27
6) How does the NAND gate differ from an AND gate?
…………………………………………………………………………………………………………………………
…………………………………………………………………………………………………………………………
9) From the Truth Tables of all gates we note that for n inputs, there are 2n
combinations of inputs. Fill in the missing answers below:
if we have 1 input, there are 21 combinations, ____ combinations.
if we have 2 inputs, there are ___ combinations, 4 combinations.
if we have ___ inputs, there are 24 combinations, ____ combinations.
28
10) From the following three circuits, draw the truth tables and explain what
happens when you change the state of the input.
29
11) A car manufacturing firm wants to introduce a Seat Belt Alarm. When the
engine is on and the Seat belt is not properly in place, an alarm is
sounded. Produce a logic circuit to represent this situation.
12) For the circuit shown below write the input states and the Boolean
expression.
A B
Inputs Inputs
Boolean Boolean
Expression Expression
30
13) A student is given a merit certificate if he gets a pass in all subjects or
obtains an overall average of 60 in his annual exam.
a) Draw a logic circuit that would allow a computer to decide which student
should get a merit certificate.
b) Produce the truth table for this circuit.
a) b)
14) Determine the outputs of the following example logic circuits using their
truth table and function.
a) …………………………………………… b) ……………………………………………
31
15) Determine the output when the LDR is in darkness, and then when exposed to
light.
…………………………………………………………………………………………………………………………
16) For the 4-input gate shown in the figure below, determine the output.
…………………………………………………………………………………………………………………………
32