You are on page 1of 26

Topic 1.1.

1 Types of logic gates

Learning Objectives:

At the end of this topic you will be able to;

Identify and use NOT, AND, NAND, OR, NOR EXOR, and XNOR
gates;
Construct and recognise truth tables for these gates and simple
combinations of them, with up to four inputs.

1
Module ET1
Introduction to Analogue and Digital Systems.

Introduction.

This course in electronics has been designed to provide you, the student with
a broad introduction to many applications of electronics. The focus of the
course is to provide students with the basic understanding of many aspects
of electronics from, microcomputers to communication systems, hardware
systems to writing software control programs. This will provide the essential
foundation for anyone to continue with their studies in university later.

The emphasis is where-ever possible practical in nature, even though


computer simulations may be used alongside traditional practical systems, as
these often provide the possibility to make rapid changes to a particular
circuit to illustrate a particular effect.

In this module we will be concentrating on the fundamentals of digital and


analogue circuits. We should start by ensuring that you understand the
difference between a digital signal and an analogue signal.

An analogue signal.

This is a signal that can have any value between the minimum and maximum of
the power supply. Changes between values can occur slowly or rapidly
depending on the system involved. Graphically this is represented by a graph
similar to that shown below.

Voltage (V)

Max

Min time (s)

2
Topic 1.1.1 Types of logic gates

A digital signal.

This is a signal that can only have two finite values, usually at the minimum
and maximum of the power supply. Changes between these two values occur
instantaneously. Graphically this is represented by a graph similar to that
shown below.

Voltage (V)

Max

Min time (s)

For the time being we will concentrate on digital systems. We have to


introduce some more terms that are used to describe digital signals, because
there are a number of different power supplies available which may cause
confusion if we start to talk about outputs being at a particular voltage.

Therefore there is a standard terminology used when dealing with digital


systems as we have here.

When an input or output signal is at the minimum power supply voltage (usually
0V) this is referred to as a LOW signal or LOGIC 0 signal.

When an input or output signal is at the maximum power supply voltage this is
referred to as a HIGH signal or LOGIC 1 signal.

So now that we understand the terms lets start by looking at the basic
building block of all digital systems, the logic gate.

3
Module ET1
Introduction to Analogue and Digital Systems.

Logic Gates.

The term logic gate actually gives a clue as to the function of these devices in
an electronic circuit. Logic implies some sort of rational thought process
taking place and a gate in everyday language allows something through when
it is opened.

A Logic Gate in an electronic sense makes a logical decision based upon a set
of rules, and if the appropriate conditions are met then the gate is opened
and an output signal is produced.

Logic gates are therefore the decision making units in electronic systems and
there are many different types for different applications. We will now spend
some time looking at the different type of gates and the rules each one uses
to decide an appropriate output.

1. The NOT gate (or inverter)

This is the simplest form of logic gate and has only 1 input and 1 output. So
how can it make a decision if it only has 1 input ? Simply the purpose of this
gate is to invert the input signal so if a Logic 0 is at the input, the output will
be at Logic 1 and vice versa. The symbol for a NOT gate is as follows.

A Q

You will notice that the input has been given the letter A and the output the
letter Q. Traditionally inputs are given letters from the start of the
alphabet A, B, C etc. but this is more a rule of thumb and is not written in
stone. Do not be put off if an input is labelled something different, e.g.
J it is only a letter after all.

4
Topic 1.1.1 Types of logic gates

The output is traditionally labelled Q for logic systems, but again under
different circumstances it may be appropriate to change this to something
more meaningful like Red if the output is a red light.
The output of a logic gate can also be summarised in the form of a table,
called a Truth Table. The truth table for a NOT gate is the simplest of all
Truth Tables and is shown below.

Input Output
A 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. This will seem very
strange at first, but you will learn later how to use it to simplify logic
systems, for now please just learn the format for each gate as it is
introduced. You will soon learn the patterns and look back on this without any
concern. The Boolean expression for a NOT gate is
QA

The bar over the A indicates that the output Q is the opposite of A.

We will now consider four of the most common logic gates in use in electronic
circuits. These are the :

AND gate
OR gate
NAND gate
NOR gate

Note : These logic gates have a minimum of 2 inputs but can have up to
8 inputs, however for this course the maximum number of inputs

5
Module ET1
Introduction to Analogue and Digital Systems.

we will deal with is 4 although it is possible for you to use larger


gates in your project work later on in the course.

6
Topic 1.1.1 Types of logic gates

2. The AND gate.

We will start with a 2 input AND gate. The symbol for a 2 input AND gate is
as follows.

A
Q
B

The truth table for the 2 input AND gate is shown below.

Inputs Output
B A Q
0 0 0
0 1 0
1 0 0
1 1 1

We can see that the output is only at a Logic 1 when Input A AND Input B
are at a Logic 1.

The Boolean expression for a 2 input AND gate is


Q A.B

The . between the A and B means AND in Boolean Algebra.

Now we will consider a 3 input AND gate.

The symbol is:

A
B Q
C

7
Module ET1
Introduction to Analogue and Digital Systems.

The truth table for the 3 input AND gate is shown below.

Inputs Output
C B A Q
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

We can see that the output is only at a Logic 1 when Input A AND Input B
AND Input C are at a Logic 1.

The Boolean expression for a 3 input AND gate is


Q A.B.C

Now try to complete the following for a 4 input AND gate.

Inputs Output
Symbol:
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
Boolean Expression: 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

8
Topic 1.1.1 Types of logic gates

3. The OR gate.

We will start with a 2 input OR gate. The symbol for a 2 input OR gate is as
follows.
A
Q
B

The truth table for the 2 input OR gate is shown below.

Inputs Output
B A Q
0 0 0
0 1 1
1 0 1
1 1 1

We can see that the output is at a Logic 1 when Input A OR Input B OR both
are at a Logic 1.

The Boolean expression for a 2 input OR gate is


Q A B

The + between the A and B means OR in Boolean Algebra.

Now we will consider a 3 input OR gate.

The symbol is:


A
Q
B
C

9
Module ET1
Introduction to Analogue and Digital Systems.

The truth table for the 3 input OR gate is shown below.

Inputs Output
C B A Q
0 0 0 0
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 1

We can see that the output is at a Logic 1 when either Input A OR Input B
OR Input C OR any combination are at a Logic 1.

The Boolean expression for a 3 input OR gate is


Q A BC

Now try to complete the following for a 4 input OR gate.

Inputs Output
Symbol:
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
Boolean Expression: 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

10
Topic 1.1.1 Types of logic gates

4. The NAND gate.

We will start with a 2 input NAND gate. The symbol for a 2 input NAND gate
is as follows.

A
Q
B

The truth table for the 2 input NAND gate is shown below.

Inputs Output
B A Q
0 0 1
0 1 1
1 0 1
1 1 0

If you compare this truth table with that for the AND gate, you will find
that the output Q is the exact opposite to the AND.

The Boolean expression for a 2 input NAND gate is


Q A.B

As before the . between the A and B means AND, and the bar means
invert the output in Boolean Algebra.

Now we will consider a 3 input NAND gate.

The symbol is:

A
B Q
C

11
Module ET1
Introduction to Analogue and Digital Systems.

The truth table for the 3 input NAND gate is shown below.

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 1
1 0 1 1
1 1 0 1
1 1 1 0

The Boolean expression for a 3 input NAND gate is


Q A.B.C

Now try to complete the following for a 4 input NAND gate.

Inputs Output
Symbol:
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
Boolean Expression: 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

12
Topic 1.1.1 Types of logic gates

5. The NOR gate.

We will start with a 2 input NOR gate. The symbol for a 2 input NOR gate is
as follows.

A
Q
B

The truth table for the 2 input NOR gate is shown below.

Inputs Output
B A Q
0 0 1
0 1 0
1 0 0
1 1 0

If you compare this truth table with that for the OR gate, you will find that
the output Q is the exact opposite of the OR.

The Boolean expression for a 2 input NOR gate is


Q A B

As before the + between the A and B means OR and the bar means invert
the result in Boolean Algebra.

Now we will consider a 3 input NOR gate.

The symbol is:


A
B Q
C

13
Module ET1
Introduction to Analogue and Digital Systems.

The truth table for the 3 input NOR gate is shown below.

Inputs Output
C B A Q
0 0 0 1
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 0

The Boolean expression for a 3 input NOR gate is


Q A BC

Now try to complete the following for a 4 input OR gate.

Inputs Output
Symbol:
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
Boolean Expression: 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

14
Topic 1.1.1 Types of logic gates

6. The EXOR gate.

The EXOR gate has 2 inputs and is a specialised version of the OR gate. The
symbol for a 2 input EXOR gate is as follows.

A
Q
B

The truth table for the 2 input EXOR gate is shown below.

Inputs Output
B A Q
0 0 0
0 1 1
1 0 1
1 1 0

Comparison with the 2 input OR gate will reveal that Q is a Logic 1 when
either A or B is a Logic 1, but not when A and B are Logic 1.

The Boolean expression for a 2 input EXOR gate is


Q A B

alternatively Q A.B A.B

The between the A and B means Exclusive OR, however the alternative
form will prove to be more useful later on in the course when simplifying
Boolean expressions.

15
Module ET1
Introduction to Analogue and Digital Systems.

7. The XNOR gate.

The XNOR gate has 2 inputs and is the inverted form of the EXOR gate. The
symbol for a 2 input XNOR gate is as follows.

A
Q
B

The truth table for the 2 input XNOR gate is shown below.

Inputs Output
B A Q
0 0 1
0 1 0
1 0 0
1 1 1

If you compare this truth table with that for the EXOR gate, you will find
that the output Q is the exact opposite to the EXOR.

The Boolean expression for a 2 input XNOR gate is


Q A B

alternatively Q A.B A.B

The between the A and B means Exclusive OR, and the bar means that
the result is inverted. Once again however the alternative form will prove to
be more useful later on in the course when simplifying Boolean expressions.

Now let us see what you can remember !

16
Topic 1.1.1 Types of logic gates

1. Look at the following logic symbols labelled A G.

i. Which is the correct symbol for an AND gate.

ii. Which is the correct symbol for a NOT gate.

iii. Which is the correct symbol for a NOR gate.

iv. Which is the correct symbol for an EXOR gate.

v. Which is the correct symbol for a NAND gate.

vi. Which is the correct symbol for an XNOR gate.

vii. Which is the correct symbol for an OR gate.

2. Complete the following truth tables.


i. AND gate.

Inputs Output
B A Q
0 0
0 1
1 0
1 1

17
Module ET1
Introduction to Analogue and Digital Systems.

ii. NOR gate.

Inputs Output
B A Q
0 0
0 1
1 0
1 1

iii. XNOR gate.

Inputs Output
B A Q
0 0
0 1
1 0
1 1

iv. NAND gate.

Inputs Output
B A Q
0 0
0 1
1 0
1 1

v. OR gate.

Inputs Output
B A Q
0 0
0 1
1 0
1 1

18
Topic 1.1.1 Types of logic gates

3. The Boolean equations labelled A I, below are to be used to answer the


following questions.

A) Q A.B

B) Q A B

C) Q A B

D) Q A.B A.B

E) Q A B

F) Q A.B A.B

G) QA

H) Q A.B

I) Q A B

i.Which expression is correct for an AND gate.

ii. Which expression is correct for a NOT gate.

iii. Which expression is correct for a NOR gate.

iv. Which two expressions are correct for an EXOR gate. &

v. Which expression is correct for a NAND gate.

vi. Which two expressions are correct for an XNOR gate. &

vii. Which expression is correct for an OR gate.

19
Module ET1
Introduction to Analogue and Digital Systems.

Practical Logic Gates.

Logic gates are usually supplied in plastic d.i.l. (dual in line) packages
containing multiple copies of one type of logic gate. The following diagram
shows a picture of this type of package, although logic gates are usually
contained in 14 or 16 pin packages. (A larger device has been shown here for
clarity but the principle of identification are the same for smaller packages)

Pin 1 identification

Pin 1

There are two common types available, TTL or 74xx series and CMOS or
4xxx series. It is likely that you will come across both types in your practical
work, so whats the difference between them ?

The key differences are outlined in the table below:

Parameter TTL (74xx family) CMOS (4xxx family)


Supply Voltage 5V 0.25V only 3V to 18V
Below 30% of
Logic 0 range 0 to 0.8V
supply voltage
Above 70% of
Logic 1 range 2.0 to 5.0V
supply voltage
Frequency of operation 50 MHz 4 MHz
Power consumption 10mW / gate 0.1mW / gate

This information will be needed when you carry out your practical work, as you
will need to know which type of logic gate you are using.

20
Topic 1.1.1 Types of logic gates

You will also need to be careful how you connect each logic gate into your
circuit as each package can contain up to six individual gates. To be able to
identify which leads are connected to which gate you need to look at a data
sheet for the actual logic gate you are using. A couple of these have been
reproduced below.

It is important that you check the connections every time you use a logic gate
as connecting these incorrectly can result in the whole logic chip being
destroyed.

From an examination situation you will not be required to know the difference
between TTL and CMOS devices, this is required for any practical tests that
you carry out, and will be particularly important for your project work.

21
Module ET1
Introduction to Analogue and Digital Systems.

Analysis of simple logic circuits.

In the examination you may have to recognise truth tables for these basic
gates individually, but it is much more likely that these gates will be linked
together in simple combinations and you will be asked to complete a truth
table for a larger system. We will now consider a couple of examples of these
systems.

1. Study the following logic system carefully and then complete the truth
table that follows:

Inputs Outputs
B A C Q
0 0
0 1
1 0
1 1

In this problem, the output of the NOT gate has been labeled C. The first
stage is to complete the output column for C which is the NOT of A as
shown below.

Inputs Outputs
B A C Q
0 0 1
0 1 0
1 0 1
1 1 0

22
Topic 1.1.1 Types of logic gates

Now we need to complete the final column Q which is the output of the AND
gate with B and C as the inputs.

Inputs Outputs
B A C Q
0 0 1 0
0 1 0 0
1 0 1 1
1 1 0 0

2. Study the following logic system carefully and then complete the truth
table that follows:

Inputs Outputs
C B A F G 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 complete the output column for the NOT gate (Column F)
{Remember the input is B.}
Then complete the output column for the AND gate (Column G)
{Remember the inputs are F and C.}
Finally complete the final output from the NOR gate (Column Q)
{Remember the inputs are A and G}

23
Module ET1
Introduction to Analogue and Digital Systems.

Solution:

Inputs Outputs
C B A F G 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

Heres a couple for you to try:

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

24
Topic 1.1.1 Types of logic gates

2. Study the following logic system carefully and then complete the truth
table that follows:

Inputs Outputs
C B A F G 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

We will look more at the design of logic circuits to meet a given


specification in Topic 1.2 - Logic system design.

25
Module ET1
Introduction to Analogue and Digital Systems.

Self Evaluation Review

My personal review of these objectives:


Learning Objectives

Identify and use NOT, AND, NAND,
OR, NOR EXOR, and XNOR gates
Construct and recognise truth tables
for these gates and simple
combinations of them

Targets: 1.

2.

26

You might also like