0% found this document useful (0 votes)
118 views

1.3.1 Logic Gates

The document discusses logic gates and their functions. It defines logic gates as electronic circuits that process two-state signals according to logical rules. It then describes the symbols, truth tables, and functions of common logic gates - NOT, AND, OR, NAND, and NOR gates. Truth tables show the output for all possible combinations of binary inputs to determine the output of each gate.

Uploaded by

saad nasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views

1.3.1 Logic Gates

The document discusses logic gates and their functions. It defines logic gates as electronic circuits that process two-state signals according to logical rules. It then describes the symbols, truth tables, and functions of common logic gates - NOT, AND, OR, NAND, and NOR gates. Truth tables show the output for all possible combinations of binary inputs to determine the output of each gate.

Uploaded by

saad nasir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

1.

3 HARDWARE AND SOFTWARE AHMED THAKUR

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,

Logic Gate Symbols

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

Truth Table Combinations


 Two Inputs
A B
0 0
0 1
1 0
1 1

 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

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 1
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

Truth Table Combinations may also be


 Four Inputs
taken as binary counting. E.g.
A B C D
0 0 0 0
8 4 2 1
0 0 0 1
0 0 0 0 0
0 0 1 0
0 0 0 1 1
0 0 1 1
0 0 1 0 2
0 1 0 0
0 0 1 1 3

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)

 Produce truth tables for given logic circuits

Functions of Logic Gates


ED

 AND Gate
HM

Description: The output, X is 1 if: both inputs, A and B, are 1


Logic Notation: X = A AND B
Boolean Algebra: X = a • b

Truth Table:
Inputs Output
A B X
0 0 0
A

0 1 0
1 0 0
1 1 1

 OR Gate

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 2
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

Description: The output, X is 1 if either inputs, A or B, is 1


Logic Notation: X = A OR B
Boolean Algebra: X = a + b

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

 NAND Gate (NOT of AND)


HM

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

A B X A B A AND B NOT of AND


0 0 1 0 0 0 1
0 1 1 0 1 0 1
1 0 1 1 0 0 1
1 1 0 1 1 1 0

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 3
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

 NOR Gate (NOT of OR)

Description: The output, X, is 1 if: neither input A nor input B is 1

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

represents the AND operation


+ represents the OR operation
a bar above the letter, e.g. a , represents the NOT operation

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 4
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

 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

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 5
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

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.

Truth Table for Part 1


A B C P Q
0 0 0 0 1
0 0 1 0
TH
0
0 1 0 0 0
0 1 1 0 0
1 0 0 0 1
1 0 1 0 0
1 1 0 1 0
1 1 1 1 0
ED

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.)

Truth Table for Part 2


P Q R
0 1 1
A

0 0 0
0 0 0
0 0 0
0 1 1
0 0 0
1 0 1
1 0 1

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 6
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

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:

Input Vales Intermediate Values Output


A B C P Q R X
0 0 0 0 1 1 1
ED

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:

Input Vales Output


A B C X
A

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

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 7
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

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

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 8
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

Now combining both the parts will give us:

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.

We will use the second method in this example:


Input Vales Intermediate Values Output
A B C (A=1 AND B =NOT 1) (B=1 AND C=NOT 1) X
0 0 0 0 0 0
0 0 1 0 0 0
0 1 0 0 1 1
ED

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.)

Input Vales Output


A B C X
0 0 0 0
0 0 1 0
0 1 0 1
0 1 1 0
A

1 0 0 1
1 0 1 1
1 1 0 1
1 1 1 0

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 9
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

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.

Parameter description Parameter Binary Value Description of condition


0 <= 1000 rpm
Turbine speed S
1 > 1000 rpm
TH
0 <= 80° C
Bearing temperature T
1 > 80° C
0 <= 120 kph
Wind velocity W
1 > 120 kph

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.

We end up with the following three logic statements:


i. turbine speed <= 1000 rpm and bearing temperature > 80°C logic statement: (S = NOT 1 AND T
= 1)
ii. turbine speed > 1000 rpm and wind velocity > 120 kph logic statement: (S = 1 AND W = 1)
iii. bearing temperature <= 80°C and wind velocity > 120 kph logic statement: (T = NOT 1 AND W =
1)

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 10
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

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

We will start by joining (i) and (ii) together using an OR gate:


A

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 11
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

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

We then OR parts (iii) and (iv) together to get the value of X.

Input Vales Intermediate Values Output


A B C i. (S=NOT 1 AND T=1) ii. (S=1 AND W=1) iii. (T=NOT1 AND W=1) iv. X
0 0 0 0 0 0 0 0
0 0 1 0 0 1 0 1
0 1 0 1 0 0 1 1
0 1 1 1 0 0 1 1
1 0 0 0 0 0 0 0
A

1 0 1 0 1 1 1 1
1 1 0 0 0 0 0 0
1 1 1 0 1 0 1 1

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 12
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

Logic circuits in the real world


Anybody with an electronics background who is reading this chapter will be aware that the design
of logic circuits is considerably more complex than has been described.

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).

Using logic ‘building blocks’


One very common ‘building block’ is the NAND gate. It is possible to build up any logic gate, and

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 AND Gate


TH
The OR Gate
ED
HM
A

The NOT Gate

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 13
2210
1.3 HARDWARE AND SOFTWARE AHMED THAKUR

1.3.1 LOGIC GATES

Simplification of logic circuits


The second method involves the simplification of logic circuits. By reducing the number of
components, the cost of production can be less. This can also improve reliability and make it easier
to trace faults if they occur.

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

COMPUTER SCIENCE https://www.facebook.com/groups/OAComputers/


[email protected], 0300-8268885 Page 14
2210

You might also like