Digital Logic Notes
Digital Logic Notes
There are seven different logic gates; these are the NOT, AND, OR, NAND,
NOR, XOR and the XNOR.
NOT 1
AND &
NAND &
OR
NOR
XOR
XNOR
Page 1
TRUTH TABLES
The easiest way to represent how each gate behaves is to make use of Truth
Tables.
A Truth Table shows all possible combinations of inputs and outputs to a logic
gate.
In logic circuits a LOW signal is said to be at logic '0' a HIGH signal at logic ' 1'.
The results can be recorded and used in a number of formats, the most
common being shown below.
INPUTS OUTPUTS
INPUTS PROCESS OUTPUTS A B
A LOGIC 0 0 0
B GATE 0 1 1
1 0 1
1 1 0
Page 2
STRUCTURE AND LAYOUT OF TRUTH TABLES
Consider the inputs to a logic gate as two switches.
+Vcc
INPUT A
OUTPUT
INPUT B
It is possible for each switch to be in one of two positions, either, on (1) or off
(0). These positions are known as INPUT STATES.
For two inputs, there are only 4 possible combinations of input states:
A-off & B-off; A-off & B-on; A-on & B-off; A-on & B-on.
Input A Input B
0 0
0 1
1 0
1 1
Page 3
ASSIGNMENT 1
1. How many combinations of input states would there be for a 6 input
system?
2. Write down the 8 possible combinations of input states for a 3 input system.
Use Yenka to determine the truth table for each of the following gates
1. NOT gate
2. AND gate
3. OR gate
Page 4
4. NAND gate
5. NOR gate
6. XOR gate
7. XNOR gate
Page 5
ASSIGNMENT 2
5. The truth table below shows the output conditions for the various
combinations of input conditions for AND, NAND, OR and NOR gates.
0 0 0 1 0 1
0 1 0 1 1 0
1 0 0 1 1 0
1 1 1 0 1 0
How does the output of the NAND gate compare with the output of the AND
(and the output of the NOR compare with the OR)
6. The paper can be fed through a computer printer either by pressing the
button on the printer (line feed) or by sending a signal from the computer.
COMPUTER
SIGNAL
PAPER
FEED
PRINTER
BUTTON
Page 6
7. The motor in a washing machine should not operate until a high signal is
sent from the control program and the water level in the drum is high
enough.
WATER
LEVEL
SENSOR
MOTOR
CONTROL
PROGRAM
LIGHTLEVEL
SENSOR
WARNING
INDICATOR
HEADLAMPS
SWITCH
TEMPERATURE
SENSOR
WARNING
ALARM
PULSERATE
SENSOR
Page 7
COMBINATIONAL LOGIC SYSTEMS
ASSIGNMENT 3
Complete a truth table for each of the combinations of gates shown below.
1.
2.
3.
4.
Page 8
5.
Page 9
METHODS OF MAKING SPECIFIC GATES FROM NANDS
Use Yenka to determine the truth table for each of the following network of
NAND gates.
Compare the truth table you obtain with truth tables for the individual gates
and decide which gate is the equivalent to the NAND network.
In some of the networks the two inputs of the NAND gate have been
connected together to make a single input.
1.
2.
3.
4.
Page 10
SIMPLIFICATION OF COMBINATIONAL LOGIC CIRCUITS
As has previously been stated it is possible to make all logic circuits from
NAND gates only.
This section will examine a method for converting circuits that contain a
number of different types of gates into one that uses NAND gates only.
C
B Z
D
The system is made from an AND gate an OR gate and a NOT gate.
The problem is to design a system with the same Truth Table, but made from
NAND gates only.
STEP 1
Redraw the circuit, replacing each gate with its NAND gate equivalent.
AND
A C OR
1 2
6 Z
B 4
D
5
NOT
Page 11
STEP 2
Examine the new arrangement and look for adjacent pairs of NOT gates.
In this circuit there are two such pairs. (2 & 3 and 4 & 5 are adjacent pairs)
If you consider what happens when you feed a signal to a NOT gate then
pass the signal on to another NOT gate you will find that the signal has been
'DOUBLE INVERTED' this in fact means that whenever you feed a signal to a
pair of NOT gates you will get the same signal out.
Therefore pairs of NOT gates in series can be removed from the system
without any effect.
STEP 3
Redraw the circuit with the NOT gates removed.
The final circuit has only two gates whereas the original circuit started with
three gates, each of a different type. There are obvious implications in terms
of cost for manufacturers if they are able to reduce logic circuits to situations
where there are fewer gates as well as enabling them to use one type of
gate. The original circuit would have required three IC's and the final circuit
would only require one IC.
This method may not reduce the number of gates used on every occasion
but it should reduce the number of IC's used.
Page 12
This method is not very elegant and can be very demanding in terms of
paper use and does not always lead to a very efficient use of NAND gates.
The next section on Boolean algebra should allow us to design circuits more
effectively and use fewer gates.
ASSIGNMENT 4
The following logic diagrams are constructed from basic gates. Using the method
shown, construct equivalent circuits using NAND gates only.
1.
2.
3.
Page 13
4. a) Construct a truth table for the logic circuit shown.
BOOLEAN ALGEBRA
Boolean algebra is a special form of algebra that has been developed for
binary systems. It was developed by George Boolean in 1854 and can be
very useful for simplifying and designing logic circuits.
VARIABLES:
The most commonly used variables in logic circuit design are capital letters;
such as A, B, C, Z and so on and are used to annotate inputs and outputs to
systems.
In digital electronics we consider situations where the variables can only have
one of two possible values, i.e. 'Logical 0' or 'Logical 1'.
The statement A = 1 means that the variable A has the value of Logic 1.
Similarly, if B = 0 it means that variable B has the value of logic 0.
Page 14
AND OPERATOR
A B = Z
OR OPERATOR
A+B = Z
INVERSION OPERATOR
The variable is read as A bar and usually means NOT A. The bar over the top
of the variable changes its value, or inverts it. This is known as the NOT
operation.
NOT
A Z
A=Z NOT A EQUALS Z 0 1
1 0
AND A B Z
0 0 0
A.B = Z A AND B EQUALS Z 0 1 0
1 0 0
1 1 1
OR A B Z
0 0 0
A+B = Z A OR B EQUALS Z 0 1 1
1 0 1
1 1 1
Page 15
NAND GATE
A C
Z
B
The signal at point C would be A B. This signal is then inverted by the NOT
gate to give
A B Z
NOR GATE
A C
Z
B
The signal at point C would be A+B. This signal is then inverted by the NOT
gate to give
A B Z
Page 16
ASSIGNMENT 5
Write down the Boolean expression for each of the following logic gates.
a) b) c)
A A A
Z Z Z
B B B
d) e) f)
A A
Z A Z B Z
B C
g) h) i)
A A A
B B
B Z Z Z
C C
C D D
Page 17
The Boolean expression for the circuit can be derived as follows:
STEP 1
Label the inputs on the left-hand side of the diagram.
A
B
STEP 2
Consider each gate in turn. Use the Boolean notation to give the output of
each gate in terms of its input. Write on the appropriate expression after
each gate.
A.B
A
B
STEP 3
When outputs from other gates are inputs to a further gate, treat the
expressions as you would any other equation and make use of brackets.
Then write on the appropriate expression after the next gate and so on until
you reach the final output.
A.B
(A.B) + B
B
STEP 4
Write down the final Boolean expression for the network.
( A B) B Z
Page 18
ASSIGNMENT 6 A
1. Derive the Boolean expression for each of the following circuits:
a) b)
c) d)
A
B
C
D
e) f)
A A
C B
Page 19
4. Derive the Boolean equation and the truth table the following
arrangements:
a) b)
A A
B B
C
C
a)
A A
B
B
A
b)
B
A
AB A B
A
B B B
B
B B
Page 20
c)
A A
B
B
C
C
A B Z
0 0 1
0 1 0
1 0 1
1 1 1
STEP 1
Note each combination that will give you a '1' at the output and write the
Boolean expression for this line at the side of the Truth Table, next to the line
that it applies to.
A B Z
0 0 1 AB
0 1 0
1 0 1 A B
1 1 1 A B
Page 21
STEP 2
Join the equations by putting an OR sign between each to give the final
Boolean expression.
( A B ) ( A B ) A B Z
ASSIGNMENT 6 b
1. Write the Boolean equation for the following truth tables
a)
A B Z
0 0 0
0 1 1
1 0 1
1 1 0
b)
A B C Z
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
Page 22
2. Develop a Boolean equation and draw a logic circuit diagram containing
AND, OR and NOT gates to yield the truth table shown.
A B C Z
0 0 0 0
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 0
1 1 1 0
( A B ) ( A B ) A B Z
STEP 1
Draw inputs A and B on the left-hand side of the page.
Page 23
STEP 2
Start by considering the first term
AB
It can be seen from the equation that both inputs require to be inverted. This
is achieved by passing signals from A and B through NOT gates. The outputs
from these signals are then used as inputs to an AND.
A
A
A.B
B
B
STEP 3
Consider the next term
A B
It can be seen from this term that input A does not require to be inverted but
input B does. Since we already have both input A and B bar available we
can amend the circuit diagram accordingly by feeding these inputs to a
second AND gate.
A
A
A.B
B
B
A.B
A
Page 24
STEP 4
Consider the final term
A B
Again both inputs are available to us. Neither of the inputs is inverted so the
signals are taken from the original inputs and are fed to a third AND gate.
A A
A.B
B
B
A.B
A
A.B
Page 25
STEP 5
Finally we use the outputs from the three AND gates as inputs to a three input
OR gate to arrive at the final solution.
A A
A.B
B
B
A.B
A.B + A.B + A.B
A
A.B
ASSIGNMENT 7
1. For the following Boolean equations, draw the correct logic circuit
arrangement.
a) A A B Z
b) A B C Z
c) A B A C Z
d) A B A C B C Z
e) A B C D E F G Z
Page 26
COMBINATIONAL LOGIC CIRCUIT DESIGN
As problems become more and more difficult it is not always possible to go
from the question to the answer in one or two steps, when that is the case the
following set of rules should be followed.
When designing a system to suit a need you should proceed in the following
order.
5. Draw a logic circuit diagram for the system using AND, OR and NOT
gates.
It is entirely possible that not every problem will require all of these steps to be
followed; however this will be a useful guide for most.
Page 27
WORKED EXAMPLE:
The temperature in a manufacturing process is critical.
The signals are detected on a control panel. On the control panel, under
normal conditions, a green light is on. If the temperature gets too high the
green light goes off and a red light comes on and a warning bell sounds.
The engineer has a switch to cut out the bell, but leaving the red light on. The
switch is used when the engineer has noticed the fault on the panel.
This system has two inputs (4 possible combinations) and three outputs (green
light, red light and bell).
Let the temperature sensor be input A and the fault acknowledge switch as
input B.
OR A is 0 AND B is 1
OR A is 1 AND B is 1
Page 28
2. Write out a Truth Table for the system.
0 0 1 0 0
0 1 1 0 0
1 0 0 1 1
1 1 0 1 0
0 0 1 AB 0 0
0 1 1 AB 0 0
1 0 0 1 A B 1 A B
1 1 0 1 A B 0
Page 29
4. Simplify the expressions if possible.
green light - ( A B ) + ( A B) Z
It can be seen that the output does not depend on the state of B since the
output is HIGH when B is either HIGH or NOT HIGH i.e. the state of the green
light depends only on the state of A, hence the expression can be simplified
to
green light - A Z
red light - ( A B ) ( A B) Z
Similarly it can be seen that the red light is ON irrespective of the state of B -
the output only depends on the state of A hence this can be simplified to
red light - A Z
5. Draw a logic circuit diagram for the system using AND, OR and NOT gates.
Start with the expression that has fewest terms/gates (in this case A=Z, no
gates!)
A
A RED LIGHT
A
GREEN LIGHT
A.B
ALARM
B
B
Page 30
6. Convert the circuit to NAND gates only.
A RED
GREEN
ALARM
B
ASSIGNMENT 8
1. An electric guillotine must be adequately guarded. In order to safeguard
the operator the machine has two switches, A and B, set about one metre
apart, both of which need to be pressed before the machine will operate.
Design a logic circuit that will give a green light if, both switches are not
pressed and both switches are pressed. If only one switch is pressed a red
light should come on.
Assume that the switches return a 0 when not pressed and a 1 when
pressed.
Page 31
when the key switch, C, in the garage door is operated.
4. A domestic burglar alarm system is designed such that a bell will operate
when the power switch is closed and a pressure switch under a carpet is
closed or a switch is opened as a window is lifted.
5. The diagram below shows part of an industrial control system having three
inputs A, B and C with an output G.
D
A F
B G
E
C
Page 32