Lab # 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 20

DEPARTMENT OF COMPUTER SCIENCE

University of Karachi
MORNING PROGRAM
st st
MCS (1 Year 1 Semester) 2020
Course No 501 Fundamental of Digital Computer (2 + 1)

Student Name: M. Usman Aslam .

Roll Number: .

Section: . Group: Computer Science.


Date :
14/Aug/20 .

.
Checked by
CONTENTS Signature
EXPERIMENT-1

BASIC LOGIC GATES

1-) OBJECTIVE :
To study the operation principles of basic digital logic gates AND, OR,
INVERTER, NAND, NOR and the representation of their functions by truth tables, logic
diagrams and Boolean algebra.

2-) THEORY :
In the Integrated Circuit’s (IC) inputs and outputs occur as voltage levels. These voltage
levels may be measured by some instruments and depending on the predefined voltage ranges
they are accepted as logic-1 or logic-0. The two digits in the binary system, 1 and 0, are
called bits, which is contraction of binary digit. During our experiments, any measured
voltage between 2.5 and 5.0 V will be considered as logic-1 and the voltage between –0.5 and
0.5 V will be accepted as logic-0. Due to the type of the ICs used, these ranges may vary
considering the supply voltage connected. Despite the difference in voltage levels, a basic
operation will be the same. As shown in Figure 1.1, each voltage range has an acceptable
deviation from each other by a transition region.

Volt
5.0

Tolerance allowed
Logic-1 3.75 for logic-1

2.5

Transition Region

0.5
Logic-0 0 Tolerance allowed
-0.5 for logic-0

Figure 1.1: Example of binary signals.

Electronic digital circuits are also called logic circuits. Logic gates are the basic
building blocks for forming digital electronic circuitry. Logic circuits that perform the

7
Logic operations of AND, OR, NOT (Inverter), NAND and NOR are shown with their
graphics symbols, algebraic functions and truth tables in Table 1.1. Digital circuits,
switching circuits, logic circuits and logic gates are used in the same means.

Table 1.1 : Truth table, algebraic function and graphic symbol of basic 2-input logic
gates.

Name Graphic Symbol Algebraic Function Truth Table

x y F

0 0 0

AND F F=x.y 0 1 0
y
1 0 0
1 1 1

x y F

0 0 0
x

OR F F=x+y 0 1 1
y 1 0 1

1 1 1

x F

NOT x F F=x’ 0 1
1 0

x y F

x 0 0 1

F
NAND y F=(x.y)’ 0 1 1
1 0 1
1 1 0
x y F

0 0 1
x

NOR y F F=(x+y)’ 0 1 0

1 0 0
1 1 0

8
The operation principles of basic five logic gates can be explained as follows:

2.1-) The AND Gate : The AND gate is one of the basic gates from which all functions
are constructed. It is a multi-input circuit that may have two or more than two inputs in
which the output is a logic-1 only if all inputs are logic-1. The output produces a logic-0
signal if any input is logic-0. The truth table, algebraic function (Boolean equation) and
graphic symbol of 2-input AND Gate are shown in Table 1.1.

2.2-) The OR Gate: The OR gate is another of the basic gates from which all logic
functions are constructed. It is also a multi-input circuit that may have two or more than
two inputs in which the output is a logic-1 when any of the inputs is a logic-1. Its output
becomes logic-0 if all input signals are logic-0. The truth table, algebraic function
(Boolean equation) and graphic symbol of 2-input OR Gate are shown in Table 1.1.

2.3-) The INVERTER (NOT) Gate : The inverter (NOT circuit) performs the operation
called inversion or complementation. The inverter changes one logic level to the opposite
level. In terms of bits, the output is logic-0 when input is logic-1, and the output is logic-1
when the input is logic-0. The truth table, algebraic function (Boolean equation) and
graphic symbol of an INVERTER (NOT) Gate are shown in Table 1.1.

2.4-) The NAND Gate : The NAND gate is a popular logic element because it can be used
as a universal gate; that is, NAND gates can be used in combination to perform the AND,
OR and inverter operations. The NAND gate is simply AND followed by INVERTER
gate. Therefore, NAND gate produces a logic-0 output only all inputs are logic-1. When
any of the inputs is logic-0, the output will be logic-1. The truth table, algebraic function
(Boolean equation) and graphic symbol of 2-input NAND Gate are shown in Table 1.1.

2.5-) The NOR Gate : The NOR gate, like the NAND gate, is a useful logic element
because it can also be used as a universal gate, that is, NOR gates can be used in
combination to perform the AND, OR and inverter operations. Then it is simply OR
followed by INVERTER gate. The truth table, algebraic function (Boolean equation) and
graphic symbol of 2-input NOR Gate are shown in Table 1.1.
The NAND and NOR functions are the complements of AND and OR functions,
respectively. The NAND and NOR gates are extensively used as standard logic gates.

9
2.6-) VOLTAGE TABLE : Representation for the measured voltages at the indicated
points on a logic circuit for every possible combination of the inputs.

2.7-) TRUTH TABLE : Representation of the output logic levels of a logic circuit for
every possible combination of the inputs. This is the best done by means of a systematic
tabulation. The truth tables of some logic gates are given in Table 1.1.

The basic logic gates are available as integrated circuits (ICs). The logic behaviors of
various basic IC gates are given as:
7404 Hex inverters
7408 Quadruple 2-input AND gates
7432 Quadruple 2-input OR gates
7400 Quadruple 2-input NAND gates
7402 Quadruple 2-input NOR gates

Figure 1 .3:Basic digital gates in IC packages with identification number and pin
assignments.
3-) EXPERIMENTAL PROCEDURE :

For each part of the experiment apply the indicated voltage which is given below
and make voltage measurements at the points indicated to complete the voltage tables. Use
the Cathode Ray Oscilloscope (CRO) to measure the voltage. Use CRO in a sensitivity of
1 V/div and make measurements to within 0.1 Volt.

Important Note : Apply Vcc= + 5.0 Volt is to the pin-14 and 0.0 (ground) apply to the
pin-7 for all ICs.

3.1-) INTGRATED CIRCUITS (ICs) :


Note : The ICs type 7408, 7432, 7400 and 7402 have four 2-input AND, OR, AND and
NOR gates within their packages, respectively. The IC type 7404 has six one-input
INVERT gates within its package. You must use only one of these gates in this
experiment. For example, the gate 7408 AND gate whose input pins are pins 1 and 2 and
whose output pin is pin 3. If it is defective, you must select one of the other gates in the
same package.
1-) Select one of the gate from IC,
2-) Set up the following circuit,
3-) Control the selected basic logic gates,
4-) If it is defective, you must select one of the other gates in the same package,
5-) Complete truth table of basic logic gates,
6-) Repeat above steps for all basic logic gates.
OR Gate (7432)
ANS: 3.1

Pin 1 Pin 2 Pin 3


0 0 0
0 +5 1
+5 0 1
+5 +5 1

Results form CIDAR software


AND Gate (7408)
ANS: 3.2

Pin 1 Pin 2 Pin 3


0 0 0
0 +5 0
+5 0 0
+5 +5 1

Results form CIDAR software

NOT Gate (7404)


ANS: 3.3

Pin 1 Pin 2
0 1
+5 1

Results form CIDAR software


NOR Gate (7402)
ANS: 3.4

Pin 1 Pin 2 Pin 3


0 0 1
0 +5 0
+5 0 0
+5 +5 0

Results form CIDAR software

NAND Gate (740)


ANS: 3.5

Pin 1 Pin 2 Pin 3


0 0 1
0 +5 0
+5 0 0
+5 +5 0

Results form CIDAR software


4-) DISCUSSIONS :
4.1-) Convert all voltage tables completed in the experimental parts into logic tables.
Ans.
OR Gate (7432)

Pin 1 Pin 2 Pin 3


0 0 1
0 1 1
1 0 1
1 1 1
AND Gate (7408)

Pin 1 Pin 2 Pin 3


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

NOT Gate (7404)

Pin 1 Pin 2
0 1
1 1

NOR Gate (7402)

Pin 1 Pin 2 Pin 3


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

NAND Gate (740)

Pin 1 Pin 2 Pin 3


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

4.2-) Compare your experimental results with theoretical results.

Ans The experimental result satisfied with the theoretical results.


4.3-) Explain the basic logic gates, complete three and four input logic gates truth table.
Ans
Following are the basic logic gates.
1. AND
2. OR
3. NOT (Inverter)

1. AND Gate

The AND gate is a digital logic gate with ‘n’ i/ps one o/p, which perform logical conjunction
based on the combinations of its inputs. The output of this gate is true only when all the inputs
are true. When one or more inputs of the AND gate’s i/ps are false, then only the output of the
AND gate is false. The symbol and truth table of an AND gate with two inputs is shown
below.
2. OR Gate

The OR gate is a digital logic gate with ‘n’ i/ps and one o/p, that performs a logical
conjunction based on the combinations of its inputs.The output of the OR gate is true only
when one or more inputs are true. If all the i/ps of the gate are false, then only the output of
the OR gate is false. The symbol and truth table of an OR gate with two inputs is shown
below.

4 input OR Gate Truth Table


3. NOT Gate

The NOT gate is a digital logic gate with one input and one output that operates an inverter
operation of the input.The output of the NOT gate is the reverse of the input. When the input
of the NOT gate is true then the output will be false and vice versa. The symbol and truth
table of a NOT gate with one input is shown below. By using this gate, we can implement
NOR and NAND gates
4.4-) Realize NAND and NOR functions using only AND, OR and INVERT gates.
Ans:
NAND gate as Universal Gate
The below diagram is of a two input NAND gate. The first part is an AND gate and second
part is a dot after it represents a NOT gate. So it is clear that during the operation of NAND
gate, the inputs are first going through AND gate and after that, the output gets reversed,
and we get the final output. Now we will look at the truth table of NAND gate.
We will consider the truth table of the above NAND gate i.e. a two-input gate. The two
inputs are A and B.

NOR gate as universal gate


We have seen how NAND gate can be used to make all the three basic gates by using that
alone. Now we will discuss the same in case of NOR gate.

The above diagram is of an OR gate made by only using NOR gates. The output of this
gate is exactly similar to that of a single OR gate. We can see the circuit arrangement of
OR gate using, NOR gate is similar to that of AND gate using NAND gates.

4.5-) What is the purpose of a truth table and algebraic function?


Ans: Truth Table: A truth table is a mathematical table used in logic—specifically in
connection with Boolean algebra, Boolean functions, and propositional calculus—which
sets out the functional values of logical expressions on each of their functional arguments,
that is, for each combination of values taken by their logical variables.
Algebraic Functions:
An algebraic function is an equation that allows one to input a domain, or x-value and
perform mathematical calculations to get an output, which is the range, or y-value, that is
specific for that particular x-value. There is a one in/one out relationship between the
domain and range
4.6-) What is the purpose of an inverter in a digital circuit?
Ans: An inverter circuit outputs a voltage representing the opposite logic-level to its
input. Its main function is to invert the input signal applied. If the applied input is low then
the output becomes high and vice versa.

4.7-) If we were to build a truth table for a 16-input AND gate, how many different
combinations of inputs would we have?
Ans: Suppose we were build a truth table for 16 input AND gate so 2 n where n =
no of inputs. Therefore 2 16 = 65536 combination of input gates.

4.8-) Make a truth table for the diagram in Figure 1.9.


C
A D
B
F

Figure 1.9: A combinational basic logic circuit.

Truth Table:

A B Á C (B.C) D ´ B( F)
A+ F
0 0 1 0 1 1
0 1 1 1 0 1
1 0 0 0 0 0
1 1 0 0 0 0

You might also like