Chapter 4
Chapter 4
KARNAUGH MAPS
Objectives
One of the easiest ways to simplify logic circuits is to use Karnaugh Map
method. Karnaugh map is a graphical representation of the output for a given
logic expression. It contains the same information as a truth table.
Although a K-Map can be used for problems involving any number of input
variables, its practical usefulness is limited to 6 variables. In this chapter, we
will limit our discussion to problems up to 4 variables only.
The K-Map contains a cell for each input combination. A logic expression or
2
truth table with n input variables has 2 cells on the K-Map. A 2 variable
2
K-Map has 2 = 4 cells. AB=00 corresponds to cell 𝐴 ⋅ 𝐵 or cell 0. AB=01
corresponds to cell 𝐴 ⋅ 𝐵 or cell 1. AB=10 corresponds to cell 𝐴 ⋅ 𝐵 or cell 2.
AB=11 corresponds to cell 𝐴. 𝐵 or cell 3.
The K-Map cells are labeled so that horizontally adjacent cells differ only in
one variable. For example, cell 𝐴 ⋅ 𝐵 (0) and cell 𝐴 ⋅ 𝐵 (2): differ only in one
variable, A. Similarly, vertically adjacent cells differ only in one variable. For
example, cell 𝐴 ⋅ 𝐵 (0) and cell 𝐴 ⋅ 𝐵 (1): differ only in one variable, B.
3
A logic expression or truth table with 3 variables has 2 = 8 cells on the K-Map.
33 Karnaugh Maps
The labeling of a 3 variable K-Map is not in counting order. They are labeled in
the order shown above: (0 1), (2 3), (6 7) and (4 5), so that horizontally and
vertically adjacent cells differ only in one variable.
2. Plot a 1 on the K-Map for each product term, or plot a 1 on the K-Map for
each output Y = 1
3. Draw loops around adjacent cells containing two 1’s on the K-Map. The
loops may overlap.
34 Karnaugh Maps
4. Repeat step 2 to 3.
5. Each loop produces a simplified product term. The minimum product term
for 2 variable map is as follows:
Example 1:
Shown below is an OR gate truth table. The logic expression in the form of
sum of product is = 𝐴. 𝐵 + 𝐴. 𝐵 + 𝐴. 𝐵 , which can also be written as 𝑌 =
∑(1,2,3).
2. Loop the adjacent cells. There are 2 pairs of 1’s that can be loop: cell (1 3)
and cell (2 3). Each loop contains two 1’s.
3. Each loop produces a simplified product term. The loop for cell (1 3)
produces a product term B. This can easily be proven using Boolean
algebra: 𝐴. 𝐵 + 𝐴. 𝐵 = 𝐵(𝐴 + 𝐴) = 𝐵.
4. The loop for cell (2 3) produces a product term A, that can proven using
Boolean algebra: 𝐴. 𝐵 + 𝐴. 𝐵 = 𝐴(𝐵 + 𝐵) = 𝐴.
Example 2.
Shown below is an AND gate truth table. The loop for cell (0 1) produces 𝐴 .
The loop for cell (0 2) produces 𝐵. The simplified expression is 𝑌 = 𝐴 + 𝐵
which is equivalent to 𝐴. 𝐵.
Example 3.
Shown below is an XOR gate truth table. Cell 1 is not considered adjacent to
cell 2, because both variables are different. Therefore it is not possible to form
a loop. We cannot simplify the expression. So the expression is left as it is,
𝑌 = 𝐴. 𝐵 + 𝐴. 𝐵 which is equivalent to 𝑌 = 𝐴 ⊕ 𝐵.
A 3 variable K-Map allows loop containing two, four and eight 1’s. For
example, a loop containing two 1’s are: (01), (02) and (04). A loop containing
four 1’s are: (0 1 2 3), (2 3 6 7), (6 7 4 5), (0 1 4 5), (0 2 6 4) and (1 3 7 5).
1. First, draw loop around adjacent cells containing four 1s. A loop
containing many 1’s will produce a simpler product term. So, find out if
there are other possible loops containing four 1’s. The loops may overlap.
2. After finishing loops containing four 1’s, draw loops containing two 1’s.
3. Each loop produces a simplified product term. The minimum product term
for 3 variable map is as follows:
Example 1.
Write the simplified expression from the truth table shown below.
Example 2.
Write the simplified expression from the truth table shown below. We start
with a loop containing four 1’s: cell (0 1 2 3). Next a loop containing two
1’s: cell (2 6).
Example 3.
Write the simplified expression from the truth table shown below. In this
example, there are two loops containing four 1’s.
38 Karnaugh Maps
Loop (0 2 6 4) produces 𝐶.
Loop (6 7 4 5) produces 𝐴.
Why don’t we form 3 loops containing two 1’s as shown below? A loop
containing two 1’s as shown below will produce an unsimplified expression:
𝑌 = 𝐴. 𝐶 + 𝐴. 𝐶 + 𝐴. 𝐶. This expression can be further simplified as follows:
Example 4.
The cells (0 1) and cell (1 4) form a loop containing four 1’s produces the term
𝑌 = 𝐵.
39 Karnaugh Maps
A 4 variable K-Map allows loop containing two, four, eight and sixteen 1’s. For
example, loops containing two 1’s are: (01), (04), (02) and (08). Loops
containing four 1’s are: (0 4 12 8), (0 1 3 2), (0 1 8 9) and (0 2 8 10). A loop
containing eight1’s are: (0 1 3 2 4 5 7 6) and (0 1 3 2 8 9 11 1 0).
1. First, draw loop around adjacent cells containing eight 1s. A loop
containing many 1’s will produce a simpler product term. So, find out if
there are other possible loops containing eight 1’s. The loops may
overlap.
2. After finishing loops containing four 1’s, draw loops containing four 1’s.
Next draw loops containing two 1’s.
3. Each loop produces a simplified product term. The minimum product term
for 4 variable map is as follows:
Example 1.
Write the simplified expression from the truth table shown below.
Loop (4 5 7 6) produces 𝐴. 𝐵.
Loop (3 7) produces 𝐴. 𝐶. 𝐷.
Example 2.
Example 3.
Connecting cell 1 and cell 9 forming a loop containing two 1’s produces the
term 𝐵. 𝐶. 𝐷.
42 Karnaugh Maps
Connecting cell (4 12) and cell (6 14) forming a loop containing four 1’s
produces the term 𝐵. 𝐷.
Connecting cells at the four edges forming a loop containing four 1’s (0 2 8 10)
produces the term 𝐵. 𝐷.
Example 1.
Now the K-Map can be looped for simplification. The simplified expression is
𝑌 = 𝐵 + 𝐶.
Example 2:
Example:
The diagram shown below is a system to control three valves: Pwater, Px and
Py that will control the flow of water, liquid X and liquid Y into a tank. During
the initial state, the tank is empty. When the system starts, valve Pwater is
open to allow the flow of water. As the water level reaches level A, the next
valve Px is open to allow the flow of liquid X into the tank. When the mixture of
water + liquid X reaches level B, valve Py is open to allow the flow of liquid Y.
When it reaches level C, all valves are closed and a green light is switch on
signaling a successful operation.
The tank uses three float switches A, B and C. If any of the switches fail to
function, all valves are closed and a red light is switch on.
45 Karnaugh Maps
The input of the system are three float switches A, B and C. The outputs are
there valves Pwater, Px, Py and a green light Lh and a red light Lm. The logic
levels to represent the input and output:.
Input
Float off = 0
Float on = 1
Ouput
Valve opened = 1
Valve closed = 0
Light on = 1
Light off = 0
ABC = 111 Pwater=0, Px=0, Py=0, Lh=1, Lm=0 Level C. Close all valves.
Green light on. Success.
Others Pwater=0, Px=0, Py=0, Lh=0, Lm=1 Closed all valves. Red light
on. System failure.
46 Karnaugh Maps
A
0V Px
Pwater
B
0V
C
0V
Lm
Py
Lh
Some logic circuits may be designed so that there are certain input conditions
for which there are no specific output levels, usually because these input
conditions will never occur. In other words, there will be certain combinations
of input, where we ‘don’t care’ whether the output is 1 or 0.
Let us consider a logic circuit that will detect an odd number from a BCD
code. BCD code are numbers from 0 to 9. Six numbers are not used by the
code: (1010, 1011, 1100,1101,1110 and 1111). These combinations are called
don’t care terms. Suppose the output Y=1 if the input is an odd number.
48 Karnaugh Maps
The truth table is as follows. There are six don’t care terms which is labeled as
X.
An X on the K-Map means that the cell can be a 1 or a 0. Cells containing 1’s
can be group together with cell containing X’s to form a bigger loop. In this
example the X’s in cell (11,13,15) is looped together around the adjacent cell’s
containing 1’s. Including X’s in a loop helps to further simplify the expression.
The X’s in cell (10, 13 and 14) are ignored. The simplified expression is 𝑌 = 𝐷.
49 Karnaugh Maps
4.8 Exercises
1. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
50 Karnaugh Maps
2. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
51 Karnaugh Maps
52 Karnaugh Maps
53 Karnaugh Maps
54 Karnaugh Maps
3. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
55 Karnaugh Maps
4. Draw the appropriate loops on the K-Map and write the simplified Boolean
expression.
56 Karnaugh Maps
e. Y A( B.C.D B) ABC D
f. Y ABC D BC D BC D BCD
g. Y AC AB A A.B.C
h. Y A A.B A.B.C
i. Y A.B A.B B.C B.C
j. Y A.D A.B.D A.C.D A.C.D
Design the logic circuit for Mango Island's Earthquake Warning System.
Your solution should include the following:
a) Truth table
b) Karnaugh map and the simplified equations
c) Logic circuit
57 Karnaugh Maps
Flavor Dispensers
Flavor Selection Hot
Button HC Chocolate Milk Hazelnuts Raspberry
Logic Circuit
0 1 2 M
Encoder
HN
3 4 5 R
6 7
a) Truth table
b) Karnaugh Map and its simplified equations
c) Logic circuit
58 Karnaugh Maps
9. The diagram shown below is a logic circuit to control the flow of water into
a tank. An encoder will generate binary numbers from 000 to 101
according to the water level. The logic circuit will function as follows:
water flow
Green Red
Water Level Light Light Pipe
5
4 encoder
3
2 Generate Logic
000-101
1 Circuit
float
Water tank
Design the logic circuit. Your solution must include the following:
a) Truth table
b) Karnaugh Map and its simplified equations
c) The logic circuit
10. The neutral pH for freshwater streams, lakes and pond ranges from 6 to
8. High acidity in the aquatic systems may cause harmful ecological
effects especially when the pH falls below 6 (5-0). When the pH of
freshwater becomes highly alkaline (9-14), the effects on aquatic life may
include death, and a failure to dispose of metabolic wastes. A freshwater
fish farmer installs a system that can monitor the water pH level in fish
ponds as shown in the diagram below:
The outputs of the system are three LEDs to indicate whether the water
pH is acidic, alkali or neutral:
Green LED =1 when water pH is neutral (6-8)
Red LED =1 when water pH is acidic (0-5)
Blue LED=1 when water pH is alkali (9-14)
60 Karnaugh Maps
11. The diagram shown below is a wind speed system to remind the public
about the storm phenomenon.
Lamp Siren
Logic
Circuit
The logic circuit will received 3 bit binary and effect the output based on
the scale shown below:
a) Truth table
b) Karnaugh map and the simplified equations
c) Logic circuit