Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 36

L3

Logic Gates

1
An introduction to logic
gates and their uses
Opening and closing gates
A gate is a simple electronic circuit that has a
single output voltage that corresponds to one of
the two binary values. These gates are often
referred to as ‘logic gates’ and the output voltages
as ‘logic 0’ or ‘logic
1’ instead of binary 0 and 1
Binary zero is a voltage close to 0 V and binary
one by a voltage close to +5 V
An introduction to logic
gates and their uses
What decides the output voltage?
We connect one or more voltages to the input of the
gate.These input voltages are either logic 0 or logic
1 levels. The logic gate looks at the input voltages
‘decides’, the output depending on its design, what
voltage to produce at the output of the circuit.
There are only four basic designs of gate. They are
called the NOT gate, the AND gate, the OR gate and
the XOR gate.
An introduction to logic
gates and their uses
The NOT gate
• It has only one input and performs a very simple
function. It simply reverses the binary value. If we
put a logic 1 into it, we get a logic 0 at the output.
An introduction to logic
gates and their uses

• The NOT gate has only one input so, if a


microprocessor has to handle an 8-bit binary
word, we will need eight NOT gates.
An introduction to logic
gates and their uses
• We can show an inversion by drawing a line
over the top. the input was given the letter A
and the output was shown as X. We
• could say: X = A.
An introduction to logic
gates and their uses
AND gate
• Unlike the NOT gate, an AND gate has more
than one input. In microprocessors only two
inputs are used.
• An AND gate is any circuit that gives a logic (or
binary) 1 if (and only if) every input to the
circuit is at logic 1.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
What is the point of an AND gate?
• We often meet an AND gate without realizing
it. When we climb into an elevator the door
must be closed AND the floor button pressed
before the motor will start. This is an AND
gate in action.
• In a microprocessor, groups of AND gates are
used to handle pairs of inputs
An introduction to logic
gates and their uses
• In data books and manuals, the AND function
is abbreviated to a dot
• like a period (full-stop). So, if an AND gate had
two inputs called A and B and an output
called X, then we could write X = A.B
• Sometimes it is further simplified to X = AB
An introduction to logic
gates and their uses
The NAND gate
• The word NAND is just a fancy contraction of
NOT and AND. The NAND gate is just an AND
gate followed by a NOT gate so all the
• outputs shown in the AND truth table are just
inverted by the NOT gate.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
• The symbol has a line over the top to indicate
the added NOT function. A two input NAND
could be written as Y’ = A.B and Y = AB.
An introduction to logic
gates and their uses
The OR gate
• This follows on nicely from the AND gate. The
OR gate gives a logic one at its output if either
(or both) of the inputs is at a logic one. Just
like the AND gate, the OR gate can have as
many inputs as we wish but in a
microprocessor, we only use two input
versions.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
Another extra bit
• The OR function can be written as + . So, if an
OR gate had two inputs called A and B and an
output called X, then we could write X = A + B
or X = A B. Don’t mistake this + sign as ‘plus’
as in
• addition 3 + 4 = 7.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses (exclusive OR) gate
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
• The symbol has a line over the top to indicate
the added NOT function. A two input NAND
could be written as X = A.B or X = AB.
An introduction to logic
gates and their uses
The OR gate
• This follows on nicely from the AND gate. The
OR gate gives a logic one at its output if either
(or both) of the inputs is at a logic one. Just
like the AND gate, the OR gate can have as
many inputs as we wish but in a
microprocessor, we only use two input
versions.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
The XOR gate
his is called the Exclusive-OR gate, which is
abbreviated to XOR or EOR. Here are two
examples of everyday English, both using the
word ‘or’.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
The XNOR (or ENOR) gate
• This is the inverted version of the XOR gate.
These result in the output being at logic 1 only
when the two inputs have the same value or
are equivalent.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
The tri-state buffer
• A Tri-state Buffer can be thought of as an input
controlled switch with an output that can be
electronically turned “ON” or “OFF” by means of an
external “Control” .‘enable’. The purpose of the
enable line is to switch the buffer on or off. When
the buffer is switched on, any signal applied to the
input appears at the output and when it is switched
off, the buffer is disconnected so that there is no
output signal present.
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
An introduction to logic
gates and their uses
So, why not just use a switch?
• The problem with a switch is that, once
closed, the input and output are physically
joined so that input and output circuits are
connected together. The buffer is a one-way
device for signals so that the output is isolated
from the input to prevent any changes in the
next circuit from interfering with the input
circuits.
Tri-state Logic Outputs
When one has several devices that could place their information
on the bus (“drive the bus”)
• Since we can have multiple masters on a bus, we
need Tri-state logic for attachment to a bus so
that each device can choose to drive or not drive
the bus depending on whether it is the bus
master for a given bus cycle
• Tri-state logic prevents a bus conflict where one
device is driving a signal to 1 and another device
is driving it to 0 at the same time - generates
high current through wires (and smoke?)
32
Tri-State Logic
• The problem with connecting multiple “normal”
outputs together on a bus is that each has to be in
one logic state (0) or the other (1) - driving voltage
on each bus signal high or low
• This represents a conflict over the state of the signal
• We resolve this conflict with tri-state logic
Logically Electrically Truth Table

A A +5v enable A Output


0 0 (Z)
output 0 1 (Z)
enable
1 0 1
1 1 0
0v
33
Tri-State Logic and Buses
• The logical element has output enable pin to go from a
floating output to drive the output from the circuit
• Inverters and buffers are used as bus drivers or buffers
– Two such drivers or buffers in opposite directions are used to
make the connection bi-directional
– The gates also provide more “drive” onto the bus so that the
bus signals are stronger and the bus can be longer

enablein

Device Bus

enableout

34
Same idea as the tri-state buffer
• This circuit has the essential ingredients to make a
tri-state buffer.
• Recall that tri-state buffers are used in conjunction
with buses.
• When one has several devices that could place their
information on the bus (“drive the bus”) only one of
them should.
– If two devices attempt to drive the bus to opposite voltage
levels, there will be a short.

PHY 201 (Blum) 35


Three State Logic

A E Output
0 0 Z (High impedance)
0 1 0
1 0 Z (High impedance)
1 1 1

PHY 201 (Blum) 36

You might also like