Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Lecture 04-Digital logic gates

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 59

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.

2. If, on other hand, we decide that 1 should stand for 0V and 0


stands for 5V, then we will have a negative logic system.

o Note: It is not necessary that a 0 has to be represented by 0V, it can be


any voltage level.
o The main concept is that, in positive logic, the more positive of the two
quantities represents the 1 and in negative logic, the more negative
voltage represents 0.
Types of logic Gates
o There are seven types logic gates whose function is to perform logical operations.
These are (note the use of capital letters to name the gates):

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

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.

Input Output
A X
LOW (0) HIGH (1)
HIGH (1) LOW(0)

The NOT operation (complement) is shown with an overbar.


Thus, the Boolean expression for an inverter is X = A.
A X
The Inverter

Example waveforms:

A group of inverters can be used to form the 1’s complement of


a binary number:
Binary number
1 0 0 0 1 1
0 1

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:

The AND operation is used in computer programming as a


selective mask. If you want to retain certain bits of a binary
number but reset the other bits to 0, you could set a mask with
1’s in the position of the retained bits.

If the binary number 10100011 is ANDed with the


mask 00001111, what is the result? 00000011
The OR Gate A X A ≥1 X
B B
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 B X
0 0 0
0 1 1
1 0 1
1 1 1

The OR operation is shown with a plus sign (+) between the


variables. Thus, the OR operation is written as X = A + B.
The OR Gate A X A ≥1 X
B B
Example waveforms:

The OR operation can be used in computer programming


to set certain bits of a binary number to 1.
ASCII letters have a 1 in the bit 5 position for lower
case letters and a 0 in this position for capitals. (Bit
positions are numbered from right to left starting
with 0.) What will be the result if you OR an ASCII
letter with the 8-bit mask 00100000?
The resulting letter will be lower case.
A X A & X
The NAND Gate
B B
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
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.)
A X A & X
The NAND Gate
B B
Example waveforms:

The NAND gate is particularly useful because it is a “universal”


gate – all other basic gates can be constructed from NAND gates.

How would you connect a 2-input NAND gate to


form a basic inverter?
The NOR Gate A X A ≥1 X
B B
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 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:

The NOR operation will produce a LOW if any input is HIGH.


+5.0 V

When is the LED is ON for the circuit 330 W


shown?
A
The LED will be on when B X
C
any of the four inputs are D
HIGH.
The XOR Gate A X A =1 X
B B
The XOR gate produces a HIGH output only when both inputs
are at opposite logic levels. The truth table is

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?

The output will be


inverted.
UNIVERSAL GATE
NAND gate is universal gate
It can make another gate
AND GATE
NOT GATE

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.

The mathematics of logic circuits.


Boolean algebra

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.

A logic gate that produces a LOW output when one or


NOR gate more 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.

A Car Door Open Warning


System using a NAND Gate
This truth table gives us the
behaviour of lamp inside the car
when any one the doors are opened
(2) Fire Alarm system ( OR gate )
(3) Fire Control system AND gate & OR gate
Some more examples

Below is the logic gate for a


simple house alarm. The alarm
protects the front and back doors
and six windows.
Once the alarm is set if any of
the doors or windows are opened
the alarm will sound.
Find the output of the following circuit

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

1. The truth table for a 2-input AND gate is

Inputs Output Inputs Output


A B X A B X
a. 0 0 0 b. 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

Inputs Output Inputs Output


A B X A B X
0 0 0 0 0 0
c. 0 1 0 d. 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
Exercise

2. The truth table for a 2-input NOR gate is

Inputs Output Inputs Output


A B X A B X
a. 0 0 0 b. 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

Inputs Output Inputs Output


A B X A B X
0 0 0 0 0 0
c. 0 1 0 d. 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
Exercise

3. The truth table for a 2-input XOR gate is

Inputs Output Inputs Output


A B X A B X
a. 0 0 0 b. 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

Inputs Output Inputs Output


A B X A B X
0 0 0 0 0 0
c. 0 1 0 d. 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
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

6. A logic gate that produces a HIGH output only when all of


its inputs are HIGH is a(n)

a. OR gate
b. AND gate
c. NOR gate
d. NAND gate
Exercise

8. A 2-input gate produces the output shown. (X represents the


output.) This is a(n)

a. OR gate
b. AND gate
c. NOR gate
d. NAND gate

X
Exercise

9. A 2-input gate produces a HIGH output only when the inputs


agree. This type of gate is a(n)

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

You might also like