Professional Documents
Culture Documents
Logic Gates
Dr_hanan mohammed 1
Contents
1. The Inverter
2. The AND Gate
3. The OR Gate
4. The NAND Gate
5. The NOR Gate
6. The Exclusive-OR and Exclusive-NOR Gates
Dr_hanan mohammed 2
Introduction
1. Logic gates are electronic circuits that can be used to implement the
most elementary logic expressions, (Boolean expressions).
2. The logic gate is the most basic building block of combinational logic.
3. There are three basic logic gates; the OR gate, the AND gate, and the
NOT gate.
4. Other logic gates that are derived from these basic gates are the NAND
gate, the NOR gate, the EXCLUSIVE-OR gate, and the EXCLUSIVE-NOR
gate.
Dr_hanan mohammed 3
Positive and Negative Logic
Dr_hanan mohammed 4
Truth Table
1. A truth table lists all possible combinations of input binary variables and the
corresponding outputs of a logic system.
2. The logic system output can be found from the logic expression, often
referred to as the Boolean expression, that relates the output with the
inputs of that very logic system.
3. When the number of input binary variables is only one, there are only two
possible inputs. If the number of inputs is two, there are four possible input
combinations.
Dr_hanan mohammed 5
The Inverter
The inverter performs the Boolean NOT operation. When the input is LOW,
the output is HIGH; when the input is HIGH, the output is LOW.
An Application
Binary number
A group of inverters can be 1 0 0 0 1 1 0 1
Dr_hanan mohammed 7
The AND Gate
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 A B X
A X X
& 0 0 0
B 0 1 0
B
1 0 0
1 1 1
The total number of possible combinations of binary inputs to a gate is
determined by the following formula: N=2𝑛
where N is the number of possible input combinations and n is the number
of input variables. To illustrate, For two input variables: N = 22 = 4
combinations Dr_hanan mohammed 8
The AND Gate
Example waveforms:
A A X
B B
Example2:
Dr_hanan mohammed 10
The AND Gate Application
The AND Gate as Enable/Inhibit Device
A common application of the AND gate is to enable (allow) the passage of
a signal (pulse waveform) from one point to another at certain times and
to inhibit (prevent) the passage at other times as shown
The purpose of this circuit is to measure the frequency of waveform A.
The enable pulse has a width of precisely 1 ms.
Dr_hanan mohammed 12
The OR Gate
The OR gate produces a HIGH output if any input is HIGH; if all inputs are
LOW, the output is LOW. For a 2-input gate, the truth table is
Inputs Output
A X A B X
B 0 0 0
0 1 1
1 0 1
The OR operation is shown with a plus sign (+) between the 1 1 1
variables. Thus, the OR operation is written as X = A + B.
Boolean addition is the same as the OR function.
Notice that Boolean addition differs from binary addition in
the case where two 1s are added. There is no carry in
Boolean addition.
Dr_hanan mohammed 13
The OR Gate
Example 1: waveforms:
A
A X
B B
Dr_hanan mohammed 14
The OR Gate Application
An Intrusion Detection and Alarm System
This system is used for one room with two windows and a door. As
long as the windows and the door are secured, the switches are closed
and all three of the OR gate inputs are LOW.
The NAND gate produces a LOW output when all inputs are HIGH;
otherwise, the output is HIGH. For a 2-input gate, the truth table is
Inputs Output
A B X
0 0 1
0 1 1
1 0 1
1 1 0
Example 2
Dr_hanan mohammed 17
The NAND Gate
The NAND gate is particularly useful because it is a “universal” gate – all
other basic gates can be constructed from NAND gates.
Example: How would you connect a 2-input NAND gate to
form a basic inverter? (using 2-input NAND to get AND ,
NOT GATE
OR)
Logic Expressions for a NAND Gate
The NAND operation is shown with a
dot between the variables and an
overbar covering them. Thus, the
NAND operation is written as X = A .B
(Alternatively, X = AB.)
Dr_hanan mohammed 18
Negative-OR Equivalent Operation Of A NAND Gate
Dr_hanan mohammed 21
The NOR Gate
The term NOR is a contraction of NOT-OR and implies an OR function with an inverted
(complemented) output.
The NOR gate produces a LOW output if any input is HIGH; if all inputs are HIGH, the
output is LOW. For a 2-input gate, the truth table is
Inputs Output
A X A B X
B
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.
Dr_hanan mohammed 22
The NOR Gate
Example waveforms:
A A X
B B
330 W
The LED will be on when any of the four
inputs are HIGH. A
X
B
C
D
Dr_hanan mohammed 23
Negative-AND Equivalent Operation of NOR Gate
A NOR gate can be realized by an AND gate with inverted inputs. This aspect of NOR
operation is referred to as negative-AND.
When a NOR gate is used to detect all LOWs on its inputs rather than one or more
HIGHs, it is performing the negative-AND operation and is represented by the
standard symbol in the above Figure. Remember that the two symbols in Figure
represent the same physical gate and serve only to distinguish between the two
modes of its operation. The following three examples illustrate this.
Dr_hanan mohammed 24
Negative-AND Equivalent Operation of NOR Gate
As part of an aircraft’s functional
monitoring system, a circuit is required
to indicate the status of the landing
gears prior to landing. A green LED
display turns on if all three gears are
properly extended when the “gear
down” switch has been activated in
preparation for landing. A red LED
display turns on if any of the gears fail
to extend properly prior to landing.
When a landing gear is extended, its
sensor produces a LOW voltage. When
a landing gear is retracted, its sensor
produces a HIGH voltage. Implement a
circuit to meet this requirement. Dr_hanan mohammed 25
The XOR Gate
The XOR gate produces a HIGH output only when both inputs are at opposite logic
levels. The truth table is
A X Inputs Output
B A B X
0 0 0
0 1 1
1 0 1
1 1 0
Dr_hanan mohammed 26
The XOR Gate
Example waveforms:
A A X
B B
Notice that the XOR gate will produce a HIGH only when exactly one input is
HIGH.
Example : If the A and B waveforms are both inverted for the above
waveforms, how is the output affected?
Solution :There is no change in the output.
Dr_hanan mohammed 27
The XNOR Gate
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.
Dr_hanan mohammed 28
The XNOR Gate
Example waveforms:
A
A X
B B
Notice that the XNOR gate will produce a HIGH when both inputs are the same. This
makes it useful for comparison functions.
a. OR gate
b. AND gate
c. NOR gate
d. XOR gate
a. OR gate
b. AND gate
c. NOR gate
d. XOR gate
a. OR gate
b. AND gate
c. NOR gate
d. NAND gate
a. A OR B
b. A AND B
c. A XOR B
d. A XNOR B
a. OR gate
b. AND gate
c. NOR gate
d. NAND gate
a. OR gate
b. AND gate
c. NOR gate
d. XNOR gate