Basic Logic Gates

Module-2: Basic Logic Gates

Module Objectives

Upon successful completion of this module, students should be able to:

  • Describe the operation of the AND, OR, and NOT gates.
  • Describe the operation of the NAND gate and the NOR gate.
  • Describe the operation of the XOR and XNOR gates.
  • Construct simple discrete circuits using the following basic gates: AND, OR, and NOT.
  • Use logic gates in simple applications.

Module Contents:

# / Topic / Page No.
1. / Introduction to Basic Logic Gates / 03
2. / Logic States / 03
3. / Series Switching Circuit Illustration / 04
4.1 / AND Logic Gate / 05
4.2 / Parallel Switching Circuit Illustration / 07
4.3 / OR Logic Gate / 07
4.4 / Inverter Switching Circuit Illustration / 09
4.5 / NOT Logic Gate / 10
5.1 / NAND Logic Gate / 12
5.2 / NOR Logic Gate / 13
7.1 / Practical Task-1 / 15
7.2 / Practical Task-2 / 16
7.3 / Practical Task-3 / 18
7.4 / Practical Task-4 / 20
7.5 / Practical Task-5 / 22
8. / Types of logic gates symbols / 25
9. / Review Exercises / 26

1Module 2: Basic Logic Gates

Basic Logic Gates

INTRODUCTION

Logic gates are the building blocks of any digital circuit which is increasingly used in digital systems. Therefore it is of greater importance to study the logical operation, application, and troubleshooting of logic gates.

A Logic gate has one or more inputs and only one output; it is defined as an electronic circuit or device which makes logical decisions.The output logical decision is a fundamental property of a logic gateand it is a result of certain input combinations.

The logic gates AND, OR, and NOT are referred to as Basic Logic Gates.Thebasic gates combine to form more complex logic circuitscalled Combinational Logic Gates. The available combinational logic gates are: NAND, NOR, XOR, and XNOR.

Logic States:

In digital systems there are only two possible states represented by two voltage levels. The two states or voltage-levels are:
  • HIGH and it represents  Closed switches, Lights ON, or Logic-1
  • LOW and it represents  Open switches, Lights OFF, or Logic-0

Suppose the two level voltages are +5V and 0V (Figure1), then we designate the two states as follows:
  • HIGH +5V Logic-1.
  • LOW 0V Logic-0.
/
Figure 1Logic two States
Logic State / switch / Light / Voltage Level
Binary-0 / Open / OFF / LOW (0V)
Binary-1 / Closed / ON / HIGH (≥+5V)

1Module 2: Basic Logic Gates

Series Switching Circuit Illustration

Consider the Series Switching Circuit shown in Figure 2. The series-connected switches, S1 and S2 represent the inputs, while the lamp L represents the output. This circuit behaves as follows:
  • The light L turns ON only if the switches S1ANDS2 are CLOSED.
  • The light Lturns OFF if any one of the switches is OPEN.
/
Figure 2 Series Switching Circuit

Series Switching Circuit Operation

The logical operation of a series switching circuit of Figure 1 is illustrated in Table 1 as follows:
  • When bothS1 and S2 are open L is OFF.
  • When S1 is open and S2 is closed L is OFF.
  • When S1 is closed and S2 is open L is OFF.
  • When both S1 and S2 are closed L is ON.
/ INPUTS / OUTPUT
S1 / S2 / L
Open / Open / OFF
Open / Closed / OFF
Closed / Open / OFF
Closed / Closed / ON
Table 1The logical operation of a series switching circuit
Such a series switching circuit is also known as AND Switching Circuit because the lamp is ON only if both, S1ANDS2 are CLOSED.

Basic Logic Gates

The three basic logic gates (functions) are:

1)AND

2)OR

3)NOT

1Module 2: Basic Logic Gates

AND Logic Gate

The digital circuit which can act exactly like an AND switching circuitis known as AND logic gate. Then the AND gate can be defined as a logic device that has two or more inputs and a single output such that its output is High only if all its inputs are High.

AND Gate Logic Symbol

The logic symbol of an AND logic gate with two inputs (A & B) and a single output (X) is shown in Figure 3. The AND logic gate can have a maximum number of 8-inputs but only one output. /
Figure 3AND logic symbol

AND LogicalOperation and Truth Table

The logical operation of the AND Gate is such that the output is HIGH only when all of the inputs are HIGH. When any one of the inputs is LOW, the output is LOW.
We generally express the logical operation of a gate with a table. The table that lists all input combinations and the corresponding outputs is called the truth table and is illustrated in Table 2. / INPUTS / OUTPUT
A / B / X
0 / 0 / 0
0 / 1 / 0
1 / 0 / 0
1 / 1 / 1
Table 2 Truth table for 2-inputs AND gate

AND Logical Function

The two variables expression “X = AANDB” is called the Logical AND Function and is represented in another format as follows:
X = A B; or simply,X = A B; and they mean the following:
  • If A = High ANDB = High then X = High. Otherwise X = Low.

1Module 2: Basic Logic Gates

umber of Inputs Combinations

The number of all possible combinations 0f 1 and 0 values for n-inputs is given by 2n.
Example-1:
a)For 2-inputs logic gate  Number of input-combinations = 2n = 22 = 4.
b)For 3-inputs logic gate  Number of input-combinations = 2n = 23 = 8.

1Module 2: Basic Logic Gates

4.2Parallel Switching Circuit Illustration

Consider the Parallel Switching Circuit shown in Figure 4. The Parallel-connected switches, S1 and S2 represent the inputs, while the lamp L represents the output. This circuit behaves as follows:
  • If either, S1 ORS2 OR both areCLOSED, then L turns ON.
  • The light turns OFF if both the switches are OPENED.
/
Figure 4Parallel Switching Circuit

4.2.1 Parallel Switching Circuit Operation

The logical operation of a Parallel switching circuit of Figure 4is illustrated in Table 4 as follows:
  • When both S1 and S2 are open L is OFF.
  • When S1 is open and S2 is closed L is ON.
  • When S1 is closed and S2 is open L is ON.
  • When both A and B are closed L is ON.
/ INPUTS / OUTPUT
S1 / S2 / L
Open / Open / OFF
Open / Closed / ON
Closed / Open / ON
Closed / Closed / ON
Table 4The logical operation of a parallel switching circuit
Such a parallel switching circuit is also known as OR Switching Circuit because the lamp is ON if S1ORS2OR both are CLOSED.

4.3OR Logic Gate

The digital circuit which can act exactly like an OR switching circuitis known as OR logic gate. Then the OR gate can be defined as a logic device that has two or more inputs and a single output such that its output is High if any one of its inputs is High.

1Module 2: Basic Logic Gates

4.3.1 OR Gate Logic Symbol

The logic symbol of an OR logic gate with two inputs (A & B) and a single output (X) is shown in Figure 5. The OR logic gate can have a maximum number of 8-inputs but only one output. /
Figure 5OR logic symbol

4.3.2 OR LogicalOperation and Truth Table

The logical operation of the OR Gate is such that the output is HIGH when any one of the inputs is HIGH. When all the inputs are LOW, the output is LOW.
The truth table of an OR gate is shown in Table 5; it illustrates all the inputs combinations and the corresponding outputs. / INPUTS / OUTPUT
A / B / X
0 / 0 / 0
0 / 1 / 1
1 / 0 / 1
1 / 1 / 1
Table 5 Truth table for 2-inputs OR gate

4.3.3 OR Logical Function

The two variables expression “X = AORB” is called the Logical OR Function and is represented by a +between the variablesas follows:
  • X = A +B; and it means the following:
  • If either, A ORB = High, OR A =B = High, then X = High.
  • If both are Low (A =B = 0), then X = Low.

1Module 2: Basic Logic Gates

Exercise-2:

Table 6a illustrates the truth table of a 3-input parallel switching circuit.
a)Rewrite this truth table in terms of 0's and 1's.
b)Draw the switching circuit that represents Table 6a. / Switches / Output / Input / Output
S1 / S2 / S3 / Lamp / A / B / C / X
OFF / OFF / OFF / OFF
OFF / OFF / ON / ON
OFF / ON / OFF / ON
OFF / ON / ON / ON
ON / OFF / OFF / ON
ON / OFF / ON / ON
ON / ON / OFF / ON
ON / ON / ON / ON
Table 6a Truth Table for parallel switching circuit / Table 6b Truth Table in terms of 0's and 1's
c)For a 3-input OR gate, write the Logical OR Function.

4.4 Inverter Switching Circuit Illustration

Consider the Inverter Circuit shown in Figure 6. The Parallel-connected switch S in series with a resistor R, represents the inputs, while the lamp L represents the output. This circuit behaves as follows:
  • If S isCLOSED, all the current will flow through R and the lamp L will turns OFF.
  • The lamp L turns ON if the switch S is OPENED.
/
Figure 6 Inverter Circuit

1Module 2: Basic Logic Gates

4.4.2 Inverter Circuit Operation

The logical operation of an inverter circuit of Figure 6is illustrated in Table 7 as follows:
  • When S is open L is ON.
  • When S is closed L is OFF.
/ INPUTS / OUTPUT
S / L
Open / ON
Closed / OFF
Table 7The logical operation of an inverter circuit
Such an Inverting Switching circuit is also known as NOT Circuit because the lamp is ON if S is NOT closed.

4.5 NOT Logic Gate

The digital circuit which can act exactly like a NOT switching circuitis known as NOT logic gate. Then the NOT gate can be defined as a logic device that has one input and a single output such that its output is HIGH if its input is LOW.

4.5.1 NOT Gate Logic Symbol

The logic symbol of a NOT logic gate is shown in Figure 7. The NOT gate unlike others gates it has only one input. /
Figure 7NOT logic symbol

1Module 2: Basic Logic Gates

4.5.2 NOT Logical Function

The Logical expression “X = NOTA” is called the NOT Function and is represented by a bar over thevariablesas follows:
  • X = ; and it means the following:
  • where is the complement or the inverse of A;
  • is read “A bar” or “Not A”;
  • so if A = 1, then X = = 0; or if A = 0, then X = = 1.

4.5.3 NOT GateTiming Diagram

The timing diagram which represents Table 7 is in shown in Figure 8. The output waveform is exactly opposite to the input (inverted) at each point.

Figure 8 NOT gate operation

Conduct Lab Activity #3 on page 18.

1Module 2: Basic Logic Gates

5.Universal Logic Gates

5.1 The NAND Gate

The NAND gate is a very popular logic gate and is called a universal function; because it can be used to construct all basic gates or any combination of these gates.

5.1.1 NAND GateSymbol

The term NAND is a short form of NOT-AND and means an AND function with inverted output. A standard logic symbol for a two-input NAND gate and its equivalent to an AND gate followed by a NOT gate (inverter) are shown in Figures (9 and 10) with the inputs labeled A and B and the output labeled X. The bubble indicate an inverted output.

Figure 9NAND Equivalent Logic Circuit /  /
Figure 10NAND Logic Symbol

5.1.2 NAND logical operation and Truth Table

The logical operation of the NAND gate is such that a LOW output occurs only when all inputs are HIGH. When any of the inputs are LOW, the output will be HIGH. The truth table illustrating the logical operation of a two inputs NAND gate for all input combinations is shown in Table 8. / AND / NOT
A / B / Q / X =
0 / 0 / 0 / 1
0 / 1 / 0 / 1
1 / 0 / 0 / 1
1 / 1 / 1 / 0
Table 8 Truth table for NAND gate

1Module 2: Basic Logic Gates

5.1.3 The Logical NAND Function

The two variables expression “” is called the Logical NAND Function. Refer to Figure 9; we can explain the NAND Function as follows:
  • Q = A B; but ;
  • then , and read as:
  • X = NOT(AANDB)or(A B bar)

5.2 The NOR Gate

The NOR gate, like the NAND gate, is a very useful logic gate because of its universal properties which can be used to construct all basic gates or any combination of these gates.

5.2.1 NOR GateSymbol

The term NOR is a short form of NOT-OR and is equivalent to an OR function with inverted output. The standard logic symbol for a two-inputs NOR gate; and its equivalent to an OR gate followed by a NOT gate (inverter) are shown in Figures (11 and 12) with the inputs labeled A and B and the output labeled X. The bubble indicates an inverted output.

Figure 11NOREquivalent Logic Circuit /  /
Figure 12NOR Logic Symbol

1Module 2: Basic Logic Gates

5.2.2 NOR logical operation and Truth Table

The logical operation of the NOR gate is such that a LOW output occurs when any of its inputs are HIGH. Only when all inputs are LOW, the output will be HIGH. The truth table illustrating the logical operation of a two input NOR gate for all input combinations is shown in Table 9. / OR / NOT
A / B / Q / X =
0 / 0 / 0 / 1
0 / 1 / 1 / 0
1 / 0 / 1 / 0
1 / 1 / 1 / 0
Table 9 Truth table for NOR gate

5.2.3 The Logical NOR Function

The two variables expression “” is called the Logical NOR Function. Refer to Figure 11; we can explain the NOR Function as follows:
  • Q = A +B; but ;
  • then, and read as:
  • X = NOT(A+B)or[(A + B)bar]

6. Applications ofBasic Logic Gates:

Perform a google search and write at least two applications for each gate listed below.

1)AND / 2)OR / 3)NAND / 4)NOR
a)…………………
…………………
b)…………………
c)…………………
………………… / a)…………………
…………………
b)…………………
c)…………………
………………… / a)…………………
…………………
b)…………………
c)…………………
………………… / a)…………………
…………………
b)…………………
c)…………………
…………………

1Module 2: Basic Logic Gates

Types of logic gates symbols

Distinctive-shape vs. Rectangular-shape symbols:

The IEEE standard provides two different types of symbols for logic gates.

a)Distinctive-shape symbols: is the mostcommonly usedsymbol.

b)Rectangular-shape symbols: where all the gates use the same shape, along with an internal label to identify the type of gate.

According to the IEEE standard, “the distinctive shape symbol is not preferred, but doesn’t mean that rectangular-shape symbols are preferred either. However, since most digital designers, authors, as well as computer-aided design systems, prefer the distinctive-shape symbols; that’s what is used in all the modules. However students must learn both the standards since the rectangular shape symbols are frequently used in PLC.Based on students’ knowledge and what they have learned in this module, they must be able to fill the table below:

Gate / Distinctive-shape / Rectangular-shape
AND
OR
NOT
NAND
NOR

1Module 2: Basic Logic Gates

Review Exercises

1)Complete the AND logic table and symbol seen below.

2)Complete the OR logic table and symbol seen below.

3)Complete the INVERTER logic table and symbol seen below.

4)What is the function of an INVERTER GATE?

…………………………………………………………………………………………………………………………

5)Complete the NAND logic table and symbol seen below.

1Module 2: Basic Logic Gates

6)How does the NAND gate differ from an AND gate?

…………………………………………………………………………………………………………………………

…………………………………………………………………………………………………………………………

7)Complete the NOR logic table and symbol seen below.

8)How does the NOR gate differ from an OR gate?

…………………………………………………………………………………………………………………………

…………………………………………………………………………………………………………………………

9)From the Truth Tables of all gates we note that for n inputs, there are 2ncombinations of inputs. Therefore;
if we have 1 input, there are 21 combinations, ____ combinations.
if we have 2 inputs, there are ___ combinations, 4 combinations.
if we have ___ inputs, there are 24 combinations, ____ combinations.
if we have ___ inputs, there are 26 combinations, 64 combinations.

1Module 2: Basic Logic Gates

10)From the following three circuits draw the truth tables and explain whathappens when you change the stateof the input.

11)A car manufacturing firm wants to introduce a Seat Belt Alarm. When the engine is on and the Seat belt isnot properly in place, an alarm is sounded. Produce a logic circuittorepresent this situation.

12)For the circuit shown below write the input states and the Boolean expression.

A / B
Inputs / Inputs
Boolean Expression / Boolean Expression

1Module 2: Basic Logic Gates

13)A student is given a merit certificate if he gets a pass in all subjects or obtains an overall average of 60 inhis annual exam.

a)Draw a logic circuit that would allow a computer to decide which student should get a meritcertificate.

b)Produce the truth table for this circuit.

a) / b)

14)Determine the outputs of the following example logic circuits using their truth table and rule.


a) …………………………………………… /
b) ……………………………………………

1Module 2: Basic Logic Gates

15)Determine the output when the LDR is in darkness, and then when exposed to light.

…………………………………………………………………………………………………………………………

16)For the 4-inputgateshown in the figure below,determine the output.

…………………………………………………………………………………………………………………………

1Module 2: Basic Logic Gates