Lecture 04-Digital logic gates
Lecture 04-Digital logic gates
Lecture 04-Digital logic gates
Logic gates
Computer and other digital devices are sometimes
looked upon by the general public as magical.
Actually digital electronic devices are extremely
logical in their operations.
The basic building block of any digital circuit is a
logic gate.
A logic gate is an electronic circuit which makes
logical decision.
It has one or more inputs and only one output. The
output signal appears only for certain
combinations of the input signals.
Logic gate
In computer, logic gates are the
building blocks.
Most of the functions in a
computer, with the exception of
certain types of memory, are
implemented with logic gates used
on a very large scale.
For example a microprocessor,
which is made up of hundreds of
Logic gates
Logic gates can be constructed by using
simple switches, relays, vacuum tubes,
transistors and diodes or ICs
Because of their availability , wide use and
low cost.
ICs will be used to construct digital circuits.
A variety of logic gates are available in all
logic families including Transistor–
transistor logic (TTL) and CMOS.
Positive and Negative logic
gate
In computing systems, the binary digits “0 and 1”
represent two possible states of a circuit or
device.
It makes difference if these two states are
referred to “Off and On” or “Closed and Open”
or “Low and High” or “Minus and Plus” or
“False and True” depending on the
circumstances.
Positive and Negative
logic gate
o Positive and Negative Logic
o Positive and Negative Logic
Consequently, 0
In positive logic, 1 represents:
represents:
1. An ON circuit
1. An OFF circuit
2. A CLOSED switch
2. A OPEN switch
3. A HIGH voltage
3. A LOW voltage
4. A PLUS sign
4. A MINUS sign
5. A TRUE statement
5. A FALSE statement
Example
o Suppose, a digital system has two voltage levels of “0V and 5V”.
1. If we say that digit 1 stands for 5V and digit 0 stands for 0V,
then we have positive logic system.
1. AND gate
2. OR gate
3. NOT gate
4. NAND gate
5. NOR gate
6. XOR gate
7. XNOR gate
A X
The Inverter
Input Output
A X
LOW (0) HIGH (1)
HIGH (1) LOW(0)
Example waveforms:
0 1 1 1 0 0
1 0 1’s complement
A A
The AND Gate X & X
B B
The AND gate produces a HIGH output when all inputs are
HIGH; otherwise, the output is LOW. For a 2-input gate, the
truth table is
Inputs Output
A B X
0 0 0
0 1 0
1 0 0
1 1 1
The AND operation is usually shown with a dot between the
variables but it may be implied (no dot). Thus, the AND
operation is written as X = A .B or X = AB.
A A
The AND Gate X & X
B B
Example waveforms:
Inputs Output
A B X
0 0 1
0 1 0
1 0 0
1 1 0
The NOR operation is shown with a plus sign (+) between the
variables and an overbar covering them. Thus, the NOR
operation is written as X = A + B.
The NOR Gate A X A ≥1 X
B B
Example waveforms:
Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 0
The XOR operation is written as X = AB + AB. Alternatively,
it can be written with a circled plus sign between the
variables as X = A + B.
The XOR Gate
X
The XOR Gate A X A =1 X
B B
Example waveforms:
Notice that the XOR gate will produce a HIGH only when
exactly one input is HIGH.
If the A and B waveforms are both inverted for
the above waveforms, how is the output
affected?
There is no change in the
output.
The XNOR Gate A X A =1 X
B B
The XNOR gate produces a HIGH output only when both inputs
are at the same logic level. The truth table is
Inputs Output
A B X
0 0 1
0 1 0
1 0 0
1 1 1
The XNOR operation shown as X = AB + AB. Alternatively, the
XNOR operation can be shown with a circled dot between the
variables. Thus, it can be shown as X = A . B.
The XNOR Gate A X A =1 X
B B
Example waveforms:
Notice that the XNOR gate will produce a HIGH when both
inputs are the same. This makes it useful for comparison
functions.
If the A waveform is inverted but B remains the
same, how is the output affected?
OR GATE
B
A point to remember
IC - INTEGRATED CIRCUIT
Quad 2-input AND Gate 7408
Logic gates circuits
Logic gates summary
table
Logic gates
summary
Inverter A logic circuit that inverts or complements its inputs.
Truth table A table showing the inputs and corresponding output(s) of a logic
circuit.
Timing diagram A diagram of waveforms showing the proper time relationship of all
of the waveforms.
A logic gate that produces a HIGH output only when all of its inputs
AND gate are HIGH.
Logic gates
summary
OR gate A logic gate that produces a HIGH output when one or
more inputs are HIGH.
NAND gate A logic gate that produces a LOW output only when all
of its inputs are HIGH.
Exclusive-OR gate
A logic gate that produces a HIGH output only when
its two inputs are at opposite levels.
Exclusive-NOR gate
A logic gate that produces a LOW output only when its
two inputs are at opposite levels.
Applications
Simple application of NAND gate
The application discussed here is that of a door closing
system of an automobile.
A car needs to be so designed that the driver gets a
visual indication if any of the doors of the car is open so
that it helps to avoid accident and injury to the
passengers.
Assuming there are two doors (just for simplicity, it works
for more doors as well) where this system is fitted, the
circuit can be designed using a NAND gate as follows
You can see from the figure that
when any of the switches is open
due to the door position, the NAND
gate energies the lamp inside the
car, hence warning the driver.
x x+y
y (x+y)y
__
Answer: (x+y)y
38
Find the output of the following circuit
x
x xy xy
y
y
___
__
Answer: xy
Give the Boolean expression of the given
circuit
x x+y
y
(x+y)(xy)
xy xy
Answer: (x+y)(xy)
40
Write the circuits for the following
Boolean
__ algebraic expressions
a) x+y
x
x x+y
y
41
Write the circuits for the following
Boolean algebraic expressions
_______
b) (x+y)x
x x+y
x+y (x+y)x
y
42
Exercise
Write a Boolean expression and draw the truth
table to represent this logic circuit diagram.
B
C
Answer
A B C Output (Y)
Y= A.B.C
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 0
1 1 1 1
Table 8
Exercise
Write a boolean expression and draw the truth
table to represent this logic circuit diagram.
Answer
A B C Output
Y= (A.B) + C
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
Table 9
Exercise
Write a Boolean expression and draw the truth
table to represent this logic circuit diagram.
A
B Y
C
Answer
A B C Output (Y)
Y= (A+B)C
0 0 0 0
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
Table 9
Simple Logic
Circuit
Draw a logic circuit for (A+
B)C.
Simple Logic
Circuit
Draw a logic circuit for A + BC + .
Exercise
A ≥1
4. The symbol X is for a(n)
B
a. OR gate
b. AND gate
c. NOR gate
d. XOR gate
Exercise
A
5. The symbol X is for
a(n) B
a. OR gate
b. AND gate
c. NOR gate
d. XOR gate
Exercise
a. OR gate
b. AND gate
c. NOR gate
d. NAND gate
Exercise
a. OR gate
b. AND gate
c. NOR gate
d. NAND gate
X
Exercise
a. OR gate
b. AND gate
c. NOR gate
d. XNOR gate
Exercise
Answers:
1. c
6. b
2. b
7. c
3. a
8. d
4. a
9. d
5. d