Gce Electronics Book Chapter 1
Gce Electronics Book Chapter 1
1: Logic gates
Learning Objectives:
• identify the symbols and truth tables for the following logic gates:
• NOT
• AND
• NAND
• OR
• NOR
• XOR
• XNOR
Introduction
This course is designed to provide a broad introduction to electronics, giving a foundation on which to build
further studies. The emphasis throughout is on practical work, though computer simulation may be used to
illustrate aspects of circuit behaviour.
An analogue signal:
• gives an ‘analogy’- copies the behaviour of a physical quantity. A temperature sensor, for example,
outputs a voltage that copies the behaviour of the temperature of an object. A change in temperature
produces a corresponding change in voltage.
• can have any value between the minimum and maximum of the power supply.
A digital signal:
• carries information in the form of a number. Electronic systems usually employ the binary number
system, which uses only the numbers 0 and 1, coded as voltages.
• has only two possible values - we could decide that 0 = 0 V and 1 = 5 V, for example. Changes
between these occur instantaneously.
Terminology:
When a digital signal is at minimum voltage (usually 0 V,) it is referred to as a LOW signal or LOGIC 0
signal.
When the signal is at maximum voltage, it is referred to as a HIGH signal or LOGIC 1 signal.
Logic Gates
Logic gates are the basic building block of all digital electronic systems.
They are the decision making units in electronic systems and there are different types for different
situations.
The simplest form of logic gates has only one input and one output. Its function is to invert the input signal -
it turns a logic 0 input into a logic 1 output and vice-versa.
Input A Output Q
0 1
1 0
There is also a shorthand way of writing down the function of this logic gate, using a special type of algebra
called Boolean algebra.
After the NOT gate, the four most common logic gates are:
• AND gate
• OR gate
• NAND gate
• NOR gate
Note: These logic gates have a minimum of two inputs but can have up to eight. However, this
course will use gates with a maximum of three inputs.
The output is logic 1 only when input A AND input B are both at logic 1.
The Boolean expression for a two input AND gate is: Q = A . B
The ‘.’ between the A and B means AND in Boolean algebra.
The output is logic 1 only when input A AND input B AND input C are at logic 1.
The Boolean expression for a three input AND gate is: Q = A . B . C
The OR gate
The output is logic 1 when either input A OR input B OR input C OR any combination is/are at logic 1.
Compare this truth table with that for the AND gate. For the NAND gate, output Q is the exact opposite of
that for the AND gate.
The Boolean expression for the two input NAND gate is: Q = A . B
As before the ‘.’ between A and B means AND, and the ‘bar’ means ‘invert’ in Boolean algebra.
Now, the three input NAND gate:
Compared to the OR gate, the NOR gate outputs are the exact opposite.
The Boolean expression for a 2-input NOR gate is: Q = A + B
As before, the ‘+’ means OR and the ‘bar’ means ‘invert’ in Boolean algebra.
The output is logic 1 when either A or B is logic 1, but not when both A and B are logic 1.
The Boolean expression for a two input XOR gate is: Q = A B
or, alternatively: Q = A.B + A.B
The ‘ ⊕ ’ between the A and B indicates Exclusive OR. The alternative form is more useful when
simplifying Boolean expressions.
The behaviour is that of two 2 input XOR gates connected one after the other, as the following diagram
shows:
The output of the first XOR gate, labelled X, is obtained using inputs A and B. Output Q, the output of the
second XOR gate, is obtained using C and X as inputs.
Inputs Outputs
C B A X Q
0 0 0 0 0
0 0 1 1 1
0 1 0 1 1
0 1 1 0 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 0 1
The output Q is logic 1 when either A OR B OR C is logic 1, or A AND B AND C are all logic 1 but NOT
when any two inputs are logic 1.
Inputs Output
C B A Q
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 1
The Boolean expression for a three input XOR gate is usually written as: Q = A B C
The XNOR (eXclusive-NOR) gate is the inverted form of the XOR gate.
The Boolean expression for the two input XNOR gate is: Q = A B
or, alternatively: Q = A.B + A.B
Once again however the alternative form will prove to be more useful later on in the course when
simplifying Boolean expressions.
The 3-input XNOR is the exact opposite of the 3-input XOR gate. Its truth table is:
Inputs Output
C B A Q
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
Questions may focus on individual logic gates but are more likely to consider combinations of gates. For
example, you could be asked to complete the truth table for a combinational logic system.
Example 1: Study the following logic system carefully and then complete the truth table that follows:
Inputs Outputs
B A K Q
0 0
0 1
1 0
1 1
The output of the NOT gate is labelled K. The first step is to complete the column for output K, the inverse
of A. This is shown below:
Inputs Outputs
B A K Q
0 0 1
0 1 0
1 0 1
1 1 0
The next step is to complete the final column. Signal Q is the output of the AND gate which has B and K as
inputs.
Example 2: Complete the truth table for the system shown below:
Inputs Outputs
C B A L M Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
First step - complete the column for the NOT gate output (L). [Remember its input is B].
Second step - complete the column for the AND gate output (M). [Its inputs are M and C].
Finally - complete the NOR gate output (Q). [Its inputs are A and M].
Solution:
Inputs Outputs
C B A L M Q
0 0 0 1 0 1
0 0 1 1 0 0
0 1 0 0 0 1
0 1 1 0 0 0
1 0 0 1 1 0
1 0 1 1 1 0
1 1 0 0 0 1
1 1 1 0 0 0
Investigation 1.1
Set up each of the logic circuits given using a simulation program such as ‘Circuit Wizard’ or ‘Yenka
Technology’. Complete the truth table for each circuit.
1.
Inputs Output
B A Q
0 0
0 1
1 0
1 1
Note: Using the “built in” inputs and outputs, the resulting circuit would resemble the following:
2.
Inputs Output
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Exercise 1.1
Inputs Outputs
B A N Q
0 0
0 1
1 0
1 1
Inputs Outputs
C B A S T Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
What type of gate is this and what are the two inputs?
Logic gates are available within an integrated circuit (IC) - a set of electronic circuits built on the same
wafer of semiconductor material.
The data sheet for a logic gate package includes the pin out - how the pins connect to the logic gates inside
it. The pin outs opposite relate to ICs known as quad 2-input AND gates. Using the right pin out is
important, as incorrect connections can damage the whole package.
When switches are used to input digital signals into logic gates, they are always combined with a resistor
into a switch unit.
The circuits shown below use a 12 V power supply, for illustrative purposes. The results apply to any power
supply voltage.
• Circuit A outputs a 0 V signal until the switch is pressed. It then outputs ~12 V.
• Circuit B outputs a 12 V signal until the switch is pressed. It then outputs ~0 V.
In Circuit A:
• before the switch is pressed, there is no connection to the 12 V power rail. The input to the logic gate
is ‘pulled-down’ to 0 V by resistor R, inputting logic 0 to the logic system.
• when the switch is operated, it has virtually zero resistance and so the voltage drop across it is ~0 V.
All the supply voltage appears across the resistor, so voltage drop across it is ~12 V, changing the
input logic level to logic 1.
In Circuit B:
• before the switch is pressed, there is no connection to the 0 V power rail. The input to the logic gate is
‘pulled-up’ to 12 V by resistor R, inputting logic 1 to the logic system.
• when the switch is operated, the voltage drop across the switch is ~0 V. All of the supply voltage, 12
V, is dropped across the resistor, changing the input to logic 0.
In summary
• Circuit A outputs a logic 0 signal until the switch is pressed. It then outputs logic 1.
• Circuit B outputs a logic 1 signal until the switch is pressed. It then outputs logic 0.
When a load is connected to a logic gate in such a way that the logic gate supplies current to the load, the
logic gate is said to be sourcing current.
When a load is connected so that current flows from the power supply through the load to the logic gate,
then the logic gate is said to be sinking current.
Investigation 1.2
Inputs Output
B A Q
0 0
0 1
1 0
1 1
2: Boolean algebra
Learning Objectives:
• generate the Boolean expression for a system with up to three inputs from a truth table.
• generate the Boolean expression for a system with up to four inputs from a logic circuit
diagram.
• recall and use the following identities:
• A.1=A
• A.0=0
• A.A =A
• A.A=0
• A+1=1
• A+0=A
• A+A=A
• A+A=1
Logic systems can become quite complex. We need a range of simplification techniques. The first of these
is Boolean algebra manipulation.
Consider the following truth table for a logic system (don’t worry about what it is meant to do).
C B A Q
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 0
In this table, four combinations of inputs produce an output of logic 1. The first step is to write down
the Boolean equation for each of these. All input variables must be included in each individual Boolean
equation, as shown below:
C B A Q Boolean Equation
0 0 0 0
0 0 1 1 C.B.A
0 1 0 0
0 1 1 1 C.B.A
1 0 0 1 C.B.A
1 0 1 1 C.B.A
1 1 0 0
1 1 1 0
To obtain the complete Boolean expression, we take each term and ‘OR’ them together:
The resulting expression may not be the simplest. We look at simplification techniques later.
Exercise 1.2
1.
C B A Q Boolean Equation
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0
2.
C B A Q Boolean Equation
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 0
1 1 1 1
3.
D C B A Q Boolean Equation
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 0
0 1 0 0 1
0 1 0 1 0
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 0
1 1 0 1 0
1 1 1 0 1
1 1 1 1 0
Example 1: Derive the Boolean expression for the following logic circuit.
First of all, divide the circuit into stages as shown above. This breaks down a large circuit into smaller more
manageable chunks.
Then, write down the Boolean expressions for all the outputs of Step 1.
Finally do the same for Step 3, to arrive at the expression for the output of the whole system as:
Notice the use of brackets to keep the inputs to the NAND gate together.
Finally, the two large expressions are inputs into the NOR gate. Again brackets are used to keep the inputs
together. The final Boolean equation is:
Exercise 1.3
Derive the Boolean equations for the output of the following logic systems.
1.
Q =
2.
Q =
3.
Q =
The next requirement is a method of simplifying these Boolean expressions. This relies on extracting
specific identities from the complex expressions. These can be reduced to simpler expressions.
We now examine these special identities.
Identity 1 A.1 = A
The AND gate opposite has inputs A and logic 1. Hence output Q = A.1.
Identity 2 A.0 = 0
Now, the AND gate has inputs A and logic 0. Hence output Q = A.0.
Identity 3 A.A = A
Identity 4 A.A = 0
Identity 5 A+1=1
Identity 6 A+0=A
Identity 7 A+A=A
Identity 8 A+A=1
In all of these examples the variable A has been used, but the rules apply for any variable.
We start by looking for common terms. In this case, A appears in all terms so can be extracted and
placed in a bracket as shown:
Similarly, B is common to the first two terms inside the bracket and can be extracted as a common
factor, to give:
Extracting more complicated common factors can reduce the number of simplification steps. To show this,
the same example is simplified by this different technique.
Simplify the following expression:
There is a common factor, A.B, in the second and third terms. Extracting it gives:
In the next two examples, the intermediate descriptions have been omitted to streamline the
process.
Solution:
Solution:
In this last example, notice that the original expression first needed to be expanded before the expression
could be simplified.
Exercise 1.4
1. Q = A.B + B
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
2. Q = C.(A + C)
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
4. Q = A.B.(B + C) + B.C + B
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
……………………………………………………………………………………………………………….
There are two special identities that we have not discussed in detail yet, even though we used one of them
already in simplifying Boolean expressions. They are printed on the information sheet of the examination
paper.
In each case, one variable appears in both terms. In one term, it is inverted.
The simplification requires the removal of this variable from the AND term.
Further proof is provided by completing the truth table for the same function:
The results in the last two columns are identical. This means that the expression has the same
effect as the expression .
Solution:
The examples considered so far have dealt with only AND, OR and NOT gates.
For NAND and NOR gates, it is important to remember that the inversion takes place after the AND or OR
operation.
When simplifying expressions that include these gates, it is not possible to remove one of the terms from
under the ‘bar’ and leave the other behind.
For example:
A B A A.B A.B + A
0 0 1 1 1
0 1 1 1 1
1 0 0 1 1
1 1 0 0 0
Clearly the two highlighted columns are not the same. The terms are not equal.
Another rule, known as de Morgan’s theorem is needed to simplify circuits involving these gates.
de Morgan’s Theorem
Don’t worry about how de Morgan arrived at his theorem. We just need to be able to use it to simplify
Boolean expressions containing NAND and NOR terms.
A B A B A.B A+B
0 0 1 1 1 1
0 1 1 0 1 1
1 0 0 1 1 1
1 1 0 0 0 0
The last two columns are identical showing that the two logic expressions are the same and
therefore showing that the prediction is correct.
Once again, we can check this using the truth table method:
A B A B A+B A.B
0 0 1 1 1 1
0 1 1 0 0 0
1 0 0 1 0 0
1 1 0 0 0 0
Once again, the last two columns are identical; the two logic expressions are the same and
so showing that the prediction is correct.
Using the processes we looked at earlier, develop a Boolean expression for this logic circuit.
Step 1: Break the top ‘bar’ between the two brackets and change the sign, to give:
The first term has a double ‘bar’ over it, meaning that it is inverted and then inverted again, returning it to its
original state. Therefore, this double inversion can be removed:
Step 2: Break the ‘bar’ over the second term and change the sign, to give:
Again, the double inversion over C can be removed, giving the final expression:
With more complicated expressions, further simplification might be needed using the rules of Boolean
algebra discussed earlier.
Exercise 1.5
1.
2.
3.
4.
5.
A written specification or a truth table can be used to develop a Boolean expression for the system. From
that, a logic circuit diagram can be designed.
The rule of thumb is to start with any bracketed terms, then AND and finally OR functions.
Example 1: Draw the logic circuit diagram for the following Boolean expression:
Then connect its output to an AND gate, with B as the other input:
Exercise 1.6
For each of the following, draw the corresponding logic circuit diagram:
1.
2.
3.
3. Karnaugh maps
Learning Objectives:
Each square or cell in the Karnaugh map corresponds to a cell in truth table, as shown below:
Inputs Output
B A Q
0 0
0 1
1 0
1 1
Inputs Output
B A Q
0 0 0
0 1 0
1 0 0
1 1 1
Inputs Output
B A Q
0 0
0 1
1 0
1 1
Exercise 1.7
Complete the truth table and Karnaugh map for the following gates:
XOR gate:
Inputs Output
B A Q
0 0
0 1
1 0
1 1
NAND gate
Inputs Output
B A Q
0 0
0 1
1 0
1 1
XNOR gate
Inputs Output
B A Q
0 0
0 1
1 0
1 1
The previous section demonstrates how to fill in a Karnaugh map from a truth table. The next technique is
to obtain a Boolean expression from a Karnaugh map.
For this, we take an alternative view of the Karnaugh map, using Boolean algebra:
Inputs Output
B A Q
0 0
0 1
1 0
1 1
For example:
The diagrams show the truth table and corresponding map for a logic system.
Inputs Output
B A Q
0 0 0
0 1 1
1 0 0
1 1 0
These do not match any of our standard logic gates, however, using our alternative view of the Karnaugh
map, we can extract the Boolean equation straight from the cell that contains a logic 1, giving:
Q=
In this simple case, we could have obtained this result directly from the truth table, without having to draw
the Karnaugh map. However, the map approach has advantages when the system becomes more complex.
For example:
Inputs Output
B A Q
0 0 1
0 1 1
1 0 0
1 1 1
From the truth table or from the map, we obtain the equation:
To do this:
• identify groups of 2, 4, 8 (for bigger maps), neighbouring cells containing logic 1;
• find the term(s) common to each group;
• combine these terms using the OR operator.
Using the example above, we have two groups of two neighbouring cells that contain logic 1:
It does not matter that one cell is in both groups. The cells in the vertical group are in the ‘A = 1’ column.
This means that the term common to them is A.
The advantage of a Karnaugh map is that we can quickly spot common terms in a complicated expression.
This will be more obvious when we deal with four input expressions.
Check your answer by simplifying the expression obtained from the truth table using the rules of Boolean
algebra.
Inputs Output
B A Q
0 0
0 1
1 0
1 1
The true power of Karnaugh maps becomes clearer when we look at three and four input logic systems. A
three input logic system has eight possible input combinations:
Inputs Output
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Populating the Karnaugh map is carried out in a similar way as for the two input map.
In the diagrams, letters have been used to identify how the cells in the truth table correspond to those on a
Karnaugh map:
Inputs Output
C B A Q
0 0 0 a
0 0 1 b
0 1 0 c
0 1 1 d
1 0 0 e
1 0 1 f
1 1 0 g
1 1 1 h
Notice the break in alphabetical sequence that happens on the third column of the map.
Inputs Output
C B A Q
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 0
The truth table for this equation and the corresponding Karnaugh map follow:
Inputs Output
C B A Q
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 0
1 0 1 0
1 1 0 1
1 1 1 1
There are several ways to create groups for this Karnaugh map.
To obtain this directly from the Karnaugh map, use groups of four cells rather than groups of two:
The cells in the group on the right are in the four cells where ‘B = 1’.
This means that the term common to them is B.
Exercise 1.8
Inputs Output
C B A Q
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0
1 0 1
1 1 0
1 1 1
………………………………………………………………………………………….
The rule:
Use the largest groups possible, including those that wrap around at the edges!
Four input logic systems, giving sixteen possible combinations of inputs, generating even bigger truth tables
and Karnaugh maps:
As before, letters show how the cells in the truth table relate to those on the Karnaugh map:
Inputs Output
D C B A Q
0 0 0 0 a
0 0 0 1 b
0 0 1 0 c
0 0 1 1 d
0 1 0 0 e
0 1 0 1 f
0 1 1 0 g
0 1 1 1 h
1 0 0 0 i
1 0 0 1 j
1 0 1 0 k
1 0 1 1 l
1 1 0 0 m
1 1 0 1 n
1 1 1 0 o
1 1 1 1 p
Notice that the sequence breaks in both the third column and the third row of the map. Once the map is
populated, the rules described so far enable us to produce a simplified Boolean expression.
Example:
Inputs Output
D C B A Q
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 0
0 1 0 1 1
0 1 1 0 0
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 0
1 1 1 1 1
Confirm that the Boolean equation for this truth table is:
The next diagram shows one way to form groups of logic 1 cells:
The result:
Note:
This expression was obtained from the Karnaugh map in one step.
Doing the same using Boolean algebra would require around eight stages of simplification.
Exercise 1.9
Inputs Output
D C B A Q
0 0 0 0 0
0 0 0 1 0
0 0 1 0 0
0 0 1 1 1
0 1 0 0 1
0 1 0 1 1
0 1 1 0 1
0 1 1 1 0
1 0 0 0 0
1 0 0 1 0
1 0 1 0 0
1 0 1 1 1
1 1 0 0 1
1 1 0 1 1
1 1 1 0 1
1 1 1 1 0
(b) Use it to produce the simplest possible Boolean equation for the output Q of the
logic system in terms of inputs A, B, C and D.
(Hint: you should be able to find three groups in the resulting Karnaugh map.)
……………………………………………………………………………………………………….
A word of caution - with Karnaugh maps, the way the groups are formed determines the resulting
expression. This may lead to a number of different correct answers.
Here are two different ways to group the cells and the answers they produce:
Exercise 1.10
For each of the following, produce the truth table and from it draw a Karnaugh map. Use the map to simplify
the equations.
1.
Inputs Output
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Q = …………………………………………………………………..
2.
Inputs Output
D C B A Q
0 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 0 0 0
1 0 0 1
1 0 1 0
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
Q = …………………………………………………………………..
3.
Inputs Output
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
Q = …………………………………………………………………..
4.
Inputs Output
D C B A Q
0 0 0 0 1
0 0 0 1 1
0 0 1 0 1
0 0 1 1 0
0 1 0 0 0
0 1 0 1 1
0 1 1 0 0
0 1 1 1 1
1 0 0 0 0
1 0 0 1 1
1 0 1 0 0
1 0 1 1 0
1 1 0 0 0
1 1 0 1 1
1 1 1 0 0
1 1 1 1 1
Q = …………………………………………………………………..
We have looked at the processes involved in completing Karnaugh maps for two, three and four input logic
systems from their truth tables.
However, what if we are not given the truth table but just a Boolean expression to simplify?
We now look at how to create the Karnaugh map directly from the Boolean equation.
This is not as difficult as it might sound as long as we remember some simple rules:
Take each term individually and put a ‘1’ in the corresponding cell(s) of a blank Karnaugh map:
Finally, fill in the remaining cells with ‘0’s to complete the map:
Create groups, as large as possible, to include every cell containing ‘1’ at least once.
Some cells, for example the right-hand pair on the bottom row, appear in a number of groups.
This example includes an inverted function, a NOR function. This is difficult to put into a Karnaugh map
directly. It is easier to apply de Morgan’s theorem first, to get rid of the overall inversion.
As before, the map is built by taking each term and putting a ‘1’ in the corresponding cell(s):
Then, the remaining cells have ‘0’s added to complete the map:
Exercise 1.11
1.
…………………………………………………………………
…………………………………………………………………
2.
…………………………………………………………………
…………………………………………………………………
3.
…………………………………………………………………
…………………………………………………………………
…………………………………………………………………
4.
[Remember to split the NAND function]
…………………………………………………………………
…………………………………………………………………
…………………………………………………………………
Learning Objectives:
The inverted gates, NAND and NOR, are special. The function of all other gates can be made from
combinations of these gates. In this course, only NAND gate combinations are discussed.
Why do this?
Look at the following two ways to make the same logic system:
The second system has more logic gates than the first. However, the first system has three different types
of gates, NOT, OR and AND.
Logic gate packages contain a number of individual logic gates. For example, the 4049 hex inverting buffer
IC contains six NOT gates. The 4081 IC contains four AND gates.
To construct the first system requires three different logic ICs and most of the logic gates on them would not
be used.
Even though the second system requires four logic gates, they are all the same type, NAND gates. A 4011
IC contains four NAND gates and so the system can be built from just one IC,
a significant cost saving over the first system - around one-third of the price.
Now that we know why NAND gate logic is used, let’s look at how to carry out this procedure and create
combinations of NAND gates that perform like the other logic gates.
The NAND gate has its two inputs connected together so both must
sit at the same logic level.
The truth table for a two input NAND gate has four possible
input combinations. However, with the inputs connected
together, only two are possible - either both inputs at logic 0
or both at logic 1.
This is the inverse of a NAND gate, and so is a NAND gate followed by a NAND inverter.
Confirm that this arrangement behaves like an AND gate by completing the truth table.
Inputs Output
B A X Q
0 0
0 1
1 0
1 1
The OR gate:
The OR gate requires three NAND gates, two connected as NOT gates.
Confirm that this arrangement behaves like an OR gate by completing the truth table.
Inputs Output
B A X Y Q
0 0
0 1
1 0
1 1
The NOR gate is the inverse of the OR gate, so needs a NAND inverter added to it:
Confirm that this arrangement behaves like a NOR gate by completing the truth table:
Inputs Output
B A X Y Z Q
0 0
0 1
1 0
1 1
Each gate is replaced by its NAND equivalent, connected up in the same way.
Example 1:
Convert the following logic system into NAND gates only.
This is known as a double inversion and both NAND gates can be removed.
In the system developed above, two such NAND gates follow input A.
In an examination, make it absolutely clear what you are doing by identically marking the redundant pair of
gates. Where there are more than one pair of redundant gates, choose a different marking method for each
pair.
In this example, all the stages have been set out in fine detail. In practice, some of these stages can be
carried out simultaneously, but take care to show the examiner what you are doing.
• identify and cross out redundant pairs of gates caused by double inversions;
Example 2:
First of all, replace all gates with their NAND equivalent and connect them together.
Then, check for any pairs of redundant gates and identify them.
Notice the way in which the two pairs of redundant gates are identified.
Investigation 1.3
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
(b) You should have found the Q outputs are identical. Can you think of a reason for this?
If you are not sure look back to the example on page 53
…………………………………………………………………………………………
…………………………………………………………………………………………
…………………………………………………………………………………………
Multiple Redundancies
As we have seen, some systems can be simplified by removing redundant pairs of ‘NAND inverters’.
Occasionally, multiple redundancies may occur, where an input is inverted and then connected to two (or
more) inverted inputs of other logic gates.
Multiple redundancy occurs in the three gates marked X. All three can be eliminated since the output of
both right-hand gates is A, as the diagram below shows:
At first glance, the circuit resembles the previous one. However, while the top two gates marked X are both
NAND inverters, the bottom connection from the junction leads to one input of a NAND gate marked Y, not
to another NAND inverter.
The top two gates cancel each other out and can be removed, but a NAND inverter is needed to provide a
signal of A to the input of the lower gate ‒ nevertheless a net saving of one gate.
Summary
The concept of multiple redundancies may appear complicated. It can be identified by looking at the original
logic circuit containing NOT AND OR NAND and NOR gates:
Where the output of a NOT gate is connected to two other logic gates, there is a possibility of multiple
redundancy.
• Where the two other gates are OR/NOR, there will be three redundant gates
• Where one of other gates is a OR/NOR and the other one is AND/NAND, there will be two redundant
gates but an additional NAND inverter will be needed
• Where the two other gates are AND/NAND there will be no redundant gates.
This idea can be extended to cover cases where the output of a NOT gate is connected to more than two
other logic gates, but this will not be considered during the course.
Exercise 1.12
1. (a) Redraw the following logic circuit using two input NAND gates only:
2. (a) Redraw the following logic circuit using two input NAND gates only:
3. (a) Use the Boolean equation for an XOR gate to draw its logic circuit based on NOT,
AND and OR gates.
(b) (i) Redraw the logic circuit using two input NAND gates only.
The first two gates have been provided for you.
(ii) Cross out any redundant gates. Your final solution should contain five gates.
(c) Label the outputs of the three right hand NAND gates with the letters Y, Z and Q.
Complete the truth table and confirm that this system behaves like an XOR gate.
Inputs Output
Q
B A W X Y Z
0 0
0 1
1 0
1 1
4. (a) Redraw the following logic circuit using two input NAND gates only.
(b) Identify any redundant gates (there are some multiple redundancies).
5. (a) An engineer suggests that the NAND gate equivalent of an XOR gate can be designed using
just four NAND gates.
Complete the truth table to confirm that this behaves like an XOR gate.
Inputs Output
Q
B A X Y Z
0 0
0 1
1 0
1 1
(b) Use this information to draw an XNOR gate using five NAND gates.
5. Multiplexers
Learning Objectives:
• design and analyse a logic system with up to four inputs, using a multiplexer
as a programmable logic system.
A multiplexer is a device able to transfer a signal from any one of a number of inputs to an output, using a
combination of digital signals applied to its input select pins.
2:1 multiplexer
This has:
• two input terminals, D0 and D1;
• one input select terminal, S0;
• one output terminal, Q.
4:1 multiplexer
This has:
• four data input terminals, labelled D0 to D3;
• two input select terminals, S0 and S1;
• one output terminal Q.
Different families of IC use different labelling schemes for the input select pins. The diagram above used
the labels ‘S0’, ‘S1’ and ‘S2’. Other schemes use ‘S1’, ‘S2’ and ‘S4’ respectively.
Sometimes, the data pins are labelled with the series (D0…) starting at the top of the diagram.
Multiplexers are commonly used in communication systems. However they can be used to simplify logic
system design, as the following example shows:
Example 1: Show how a 4:1 multiplexer can be used to generate the following logic function:
Inputs Output
B A Q
0 0 1
0 1 0
1 0 1
1 1 1
Its data inputs, D0 to D3, are connected to either logic 0 or logic 1, reflecting the contents of the truth table.
Inputs A and B are connected to the select input pins. S0 and S1. They then determine which data input
signal is transferred to the output Q:
When:
• B = 0 and A = 0:
• D0 is connected to output Q, sending logic 1 to the output.
• B = 0 and A = 1:
• D1 is connected to output Q, sending logic 0 to the output.
• B = 1 and A = 0:
• D2 is connected to output Q, sending logic 1 to the output.
• B = 1 and A = 1:
• D3 is connected to output Q, sending logic 1 to the output.
This demonstrates how a multiplexer can be used to generate a logic function. It offers an alternative
approach to simplifying with Boolean algebra or using a Karnaugh map.
Inputs Output
C B A Q
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 0
This is not a straightforward expression. The resulting circuit requires two NOT gates,
two AND gates, an OR gate and a XOR gate. Even with NAND gate reduction, it would still need nine gates
and use three ICs.
The multiplexer is useful with logic functions that are complex and require a large number of logic gates.
The answer usually relates to cost. Multiplexers, particularly those with large number of inputs, are more
expensive than logic gates.
Investigation 1.4
Using a circuit simulation package or breadboard, set up the circuit given as the solution to Example 2 to
confirm that the truth table obtained is correct.
Note: The input pins on the 4051 IC are labelled S1, 2 and 4, not S0, S1 and S2 given on the earlier diagram.
Exercise 1.13
1. Show how the 4:1 multiplexer can produce the logic function shown in the truth table.
Inputs Output
B A Q
0 0 1
0 1 1
1 0 0
1 1 1
2. Complete the circuit diagram to show how an 8:1 multiplexer can generate the
following logic function:
Inputs Output
C B A Q
0 0 0 0
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 0
1 1 1 1
Inputs Output
C B A Q
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
(b) Write down the Boolean expression for the output Q, in terms of A, B and C.
Q = ............................................................................................................
We have only dealt with digital signals being connected to the inputs of logic gates where the input was
either equal to the positive supply voltage or 0 V. We will now consider how to connect an analogue signal
to a logic gate.
Logic gates are designed to recognize a predetermined band of voltages as representing logic 0 and
logic 1. These bands are specific for each family of ICs as seen in the following table
The graph below shows the graph of a typical analogue signal produced by light sensing sub-system.
Under certain light conditions the analogue signal could remain in the open band for long periods of time
causing unpredictable behaviour of a logic system that the sensor is interfaced with.
The solution is to use the Schmitt inverter which was introduced in the core concepts chapter. It can be
used to process or condition an analogue signal to remove the undesirable characteristics of:
The Schmitt inverter produces a digital output which is compatible with logic systems.
Example:
Solution:
When the input voltage rises to 8 V the
output instantly falls to zero.
Subsequent changes in input voltage
are ignored until it drops to 4 V. At
this point the output changes to 12 V.
Investigation 1.5
Set up the following circuit with the function generator outputs adjusted to the settings shown to produce a
triangular waveform.
If you are setting this circuit up on Circuit Wizard ensure the voltage setting for the CMOS 40106 IC is set to
9 V. Go to Project → Simulation → Power supply and set the voltage to 9 V.
(a) Study the oscilloscope display and determine the switching thresholds for the Schmitt inverter