1.3.1 Logic Gates
1.3.1 Logic Gates
Recognise and use the following standard symbols used to represent logic gates
Logic gates
A logic gate is an electronic circuit that processes two-state signals according to a logical rule. Each
gate has one or more inputs and a single output. Unless otherwise stated, we associate the value
True with 1 and On, and the value False with 0 and Off. We only need to consider the simplest five
types of logic gates,
R
AND,
OR,
NOT,
KU
NAND
NOR,
A
TH
ED
Draw truth tables and recognise a logic gate from its truth table
Truth tables
A truth table is used to show the output of a logic gate or circuit for all possible combinations of input
values; we usually use the binary values, 1 and 0, as shorthand for True and False. The truth table for
a two-input gate needs four rows.
HM
Three Inputs
A
A B C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
R
0 1 0 1
0 1 0 0 4
0 1 1 0
0 1 0 1 5
0 1 1 1
0 1 1 0 6
KU
1 0 0 0
0 1 1 1 7
1 0 0 1
1 0 0 0 8
1 0 1 0
1 0 0 1 9
1 0 1 1
1 0 1 0 10
1 1 0 0
1 0 1 1 11
1 1 0 1
1 1 0 0 12
A
1 1 1 0
1 1 0 1 13
1 1 1 1
1 1 1 0 14
TH 1 1 1 1 15
Understand and define the functions of NOT, AND, OR, NAND, NOR and XOR (EOR) gates,
including the binary output produced from all the possible binary inputs (all gates, except the
NOT gate, will have 2 inputs only)
AND Gate
HM
Truth Table:
Inputs Output
A B X
0 0 0
A
0 1 0
1 0 0
1 1 1
OR Gate
Truth Table:
Inputs Output
R
A B X
0 0 0
0 1 1
KU
1 0 1
1 1 1
NOT Gate
A
Description: The output, X is 1 if A is 0
the output x is 0 if A is 1
Logic Notation: X = NOT A
TH
Boolean Algebra: X = a
Truth Table
Input Output
A X
0 1
ED
1 0
Description: The output, X, is 1 if: input A AND input B are NOT both 1
Logic Notation: X = A AND B
Boolean Algebra: X = a • b
Truth Table
Inputs Output Inputs AND NAND
A
R
Logic Notation: X = A NOR B
Boolean Algebra: X = a + b
KU
Truth Table
Inputs Output Inputs OR NOR
A B X A B A AND B NOT of OR
0 0 1 0 0 0 1
0 1 0 0 1 1 1
A
1 0 0 1 0 1 1
1 1 0 1 1 1 0
XOR Gate
TH
Description: The output, X, is 1 if: (input A is 1 AND input B is 0)
OR
(input A is 0 AND input B is 1The output, X, is 1 if: neither input A nor input B is 1
ED
X is 1 if either input is 1
Logic Notation: X = A XOR B
Boolean Algebra: X = (a • b ) + ( a • b)
Truth Table
HM
Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 0
Note: the three symbols in the Boolean algebra have the following meaning:
•
A
Produce a logic circuit to solve a given problem or to implement a given written logic statement,
such as IF (switch A is NOT on) OR (switch B is on AND switch C is NOT on) then alarm, X, sounds
When logic gates are combined together to carry out a particular function, such as controlling a
robot, they form a logic circuit.
The output from the logic circuit is checked using a truth table. There now follows three examples
R
which show:
how to produce a truth table
how to design a logic circuit from a given logic statement/Boolean algebra
KU
how to design a logic circuit to carry out an actual safety function.
Example 1
Produce a truth table for the following logic circuit (note the use of • at junctions):
A
TH
ED
There are three inputs to this logic circuit, therefore there will be eight possible binary values which
can be input.
HM
To show step-wise how the truth table is produced, the logic circuit has been split up into three parts
and intermediate values are shown as P, Q and R.
Part 1
This is the first part of the logic circuit; the first task is to find the intermediate values
P and Q.
A
Figure
R
KU
The value of P is found from the AND gate where the inputs are A and B. The value of Q is found from
A
the NOR gate where the inputs are B and C.
Part 2
The second part of the logic circuit has P and Q as inputs and the intermediate output, R:
HM
This produces the following intermediate truth table. (Note: even though there are only two inputs to
the logic gate, we have generated eight binary values in part 1 and these must all be used in this
second truth table.)
0 0 0
0 0 0
0 0 0
0 1 1
0 0 0
1 0 1
1 0 1
Part 3
The final part of the logic circuit has R and C as inputs and the final output, X:
R
This gives the third intermediate truth table:
KU
Truth Table for Part 3
Inputs Output
R C X
1 0 1
0 1 1
0 0 0
A
0 1 1
1 0 1
0 1 1
1 0 1
1 1 0
TH
Putting all three intermediate truth tables together produces the final truth table which represents
the original logic circuit:
0 0 1 0 0 0 1
0 1 0 0 0 0 0
0 1 1 0 0 0 1
1 0 0 0 1 1 1
1 0 1 0 0 0 1
1 1 0 1 0 1 1
HM
1 1 1 1 0 1 0
The intermediate values can be left out of the final truth table, but it is good practice to leave them
in until you become confident about producing the truth tables. The final truth table would then look
like this:
0 0 0 1
0 0 1 1
0 1 0 0
0 1 1 1
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
A safety system uses three inputs to a logic circuit. An alarm, X, sounds if input A represents ON and
input B represents OFF; or if input B represents ON and input C represents OFF.
Produce a logic circuit and truth table to show the conditions which cause the output X to be 1.
The first thing to do is to write down the logic statement representing the scenario in this example. To
do this, it is necessary to recall that ON = 1 and OFF = 0 and also that 0 is usually considered to be
NOT 1.
R
So we get the following logic statement:
KU
A
Note: this statement can also be written in Boolean algebra as:
TH
(a • b ) + ( a • b)
The logic circuit is made up of three parts as shown in the logic statement. We will produce the logic
gate for the first part and the third part. Then join both parts together with the OR gate.
ED
HM
A
R
KU
A
There are two ways to produce the truth table:
trace through the logic circuit using the method described in Example 1
produce the truth table using the original logic statement; this second method has the
TH
advantage that it allows you to check that your logic circuit is correct.
0 1 1 0 0 0
1 0 0 1 0 1
1 0 1 1 0 1
1 1 0 0 1 1
1 1 1 0 0 0
HM
(Note: it is optional to leave in the intermediate values or to remove them giving a four-column truth
table with headings: A, B, C, X.)
1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0
Activity
Draw the logic circuits and complete the truth tables for the following logic statements and Boolean
algebra statements:
a. X = 1 if (A = 1 OR B = 1) OR (A = 0 AND B = 1)
b. Y = 1 if (A = 0 AND B = 0) AND (B = 0 OR C = 1)
c. T = 1 if (switch K is ON or switch L is ON) OR (switch K is ON and switch M is OFF) OR (switch M is
ON)
R
d. (a • b ) + ( a • b)
e. R = 1 if (switch A is ON and switch B is ON) AND (switch B is ON or switch C is OFF)
KU
Example 3
A wind turbine has a safety system which uses three inputs to a logic circuit. A certain combination
of conditions results in an output, X, from the logic circuit being equal to 1. When the value of X = 1
then the wind turbine is shut down.
The following table shows which parameters are being monitored and form the three inputs to the
A
logic circuit.
The output, X, will have a value of 1 if any of the following combination of conditions occur:
either turbine speed <= 1000 rpm and bearing temperature > 80°C
ED
or turbine speed > 1000 rpm and wind velocity > 120 kph
or bearing temperature <= 80°C and wind velocity > 120 kph.
Design the logic circuit and complete the truth table to produce a value of X =1 when any of the
three conditions above occur.
HM
This is a different type of problem to those covered in Examples 1 and 2. This time a real situation is
given and it is necessary to convert the information into a logic statement and then produce the
logic circuit and truth table. It is advisable in problems as complex as this to produce the logic circuit
and truth table separately (based on the conditions given) and then check them against each other
to see if there are any errors.
Stage 1
The first thing to do is to convert each of the three statements into logic statements.
Use the information given in the table and the three condition statements to find how the three
A
parameters, S, T and W, are linked. We usually look for the key words AND, OR and NOT when
converting actual statements into logic.
Stage 2
This now produces three intermediate logic circuits:
i.
R
KU
ii.
A
TH
iii.
ED
Each of the three original statements were joined together by the word OR. Thus we need to join all
of the three intermediate logic circuits by two OR gates to get the final logic circuit.
HM
Finally, we connect this logic circuit with Logic Circuit No. iii to obtain the answer:
iv.
R
KU
A
TH
The final part is to produce the truth table. We will do this using the original logic statement. This
method has the bonus of allowing an extra check to be made on the logic circuit in No. iv to see
whether or not it is correct. It is possible, however, to produce the truth table straight from the logic
circuit in No. iv.
There were three parts to the problem, so the truth table will first evaluate each part. Then, by
applying OR gates, as shown below, the final value, X, is obtained:
ED
i. (S = NOT 1 AND T = 1)
ii. (S = 1 AND W = 1)
iii. (T = NOT 1 AND W = 1)
We find the outputs from parts (i) and (ii) and then OR these two outputs together to obtain a new
intermediate, which we will label part (iv).
HM
1 0 1 0 1 1 1 1
1 1 0 0 0 0 0 0
1 1 1 0 1 0 1 1
Electronics companies need to consider the cost of components, ease of fabrication and time
constraints when designing and building logic circuits. We will mention two possible ways electronics
companies can review logic circuit design:
R
1. One method is to use ‘off-the-shelf’ logic units and build up the logic circuit as a number of ‘
building blocks’.
2. Another method involves simplifying the logic circuit as far as possible; this may be necessary
KU
where room is at a premium (e.g. in building circuit boards for use in satellites to allow space
exploration).
A
therefore any logic circuit, by simply linking together a number of NAND gates. For example, the
AND, OR and NOT gates can be built from these gates as shown below:
The following example (Figure) can be simplified to a single gate. You are asked to show how this
can be done in Activity
R
KU
A
Activity 1
TH
Show by drawing a truth table which single logic gate has the same function as the logic circuit
drawn in Figure.
Activity 2
Complete the truth table for the following logic circuit and then consider what simplified design
could replace the whole logic circuit.
ED
HM
A