Nothing Special   »   [go: up one dir, main page]

MPCOtill 07

Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

FACULTY OF TECHNOLOGY AND ENGINEERING

DEVANGPATELINSTITUTEOFADVANCETECHNOLOGYAND
RESEARCH
DEPARTMENTOFCOMPUTERENGINEERING

A.Y. 2023-24 [ODD]

LAB MANUAL

CE260: MICROPROCESSOR AND COMPUTER


ORGANIZATION
Semester: III Academic Year: 2023-24
Subject Code: CE260 Subject Name: MPCO
Student Id:22DCE086 Student Name: PATEL VRUTTI

PRACTICAL INDEX

Sr. AIM Assigned Completion Grade Assessment Signature


No. Date Date Date
1 Generation and Types of Computer.
2 Write a program to convert a given
number system to other number
system.
3 Implement a circuit in Logisim to
display given binary number in
decimal on to seven segment
display.
4 Implement a circuit in Logisim
which perform Addition and
Subtraction.
5 Write a program which perform
multiplication using booth
algorithm.
6 1. Add and Subtract the 16-bit
number in memory locations
4000H and 4001H to the 16-bit
number in memory locations
4002H and 4003H. The most
significant eight bits of the two
numbers to be added are in
memory locations 4001H and
4003H. Store the result in
memory locations 4004H and
4005H with the most significant
byte in memory location 4005H.
2. Write a program to multiply &
divide the number stored at
4000H by 08H and store the
result at 4001H & 4002H.
3. Write an assembly language
program to convert temperature
in F to C. C=(F-32) * 5/9
7 Consider two 8-bit data are stored
at memory location 4001H and
4002H. perform following logical
operation on it and store result from
4002H location.
1. OR Operation
2. AND Operation
3. NOT Operation
4. XOR Operation
5. Logical Left & Right Shift
6. Arithmetic Left and Right
Shift
7. Rotate Left and Right with
Carry
8. Rotate Left and Right
without Carry
8 1. Calculate the sum of series of
numbers from the memory
location 4000H & store the
result at 400AH location.
2. Modify above the program such
a way that it halts the execution
if carry generated & stores the
intermediate result at 400AH
location.
3. Write an assembly language
program to find the no. of odd
numbers and even numbers,
given an array of n numbers.
9 Find out whether the given string
ispalindromeornotandprintappropriate
message.Don't use procedure.
10 1. Write an assembly language
program to find the largest
number in an array.
2. Write an assembly language
program to factorial of the given
Number.
11 Write an assembly language
program to arrange an array of data
in ascending order. The length of
the list is at memory location 2200H
and the series itself begins from
memory location 2201H
PRACTICAL-1
AIM: Generation and Types of Computer.

Early History of Computer:

One of the earliest and most well-known devices was an abacus. Then in 1822, the father of
computers, Charles Babbage began developing what would be the first mechanical computer.
And then in 1833 he actually designed an Analytical Engine which was a general-purpose
computer.

1. What is computer?
• A computer is a programmable electronic device that accepts raw data as input and
processes it with a set of instructions (a program) to produce the result as output. It renders
output just after performing mathematical and logical operations and can save the output
for future use. It can process numerical as well as non-numerical calculations. The term
"computer" is derived from the Latin word "computare" which means to calculate.
• A computer is designed to execute applications and provides a variety of solutions through
integrated hardware and software components. It works with the help of programs and
represents the decimal numbers through a string of binary digits. It also has a memory that
stores the data, programs, and result of processing. The components of a computer such as
machinery that includes wires, transistors, circuits, hard disk are called hardware. Whereas,
the programs and data are called software.
• It is believed that the Analytical Engine was the first computer which was invented by
Charles Babbage in 1837. It used punch cards as read-only memory. Charles Babbage is
also known as the father of the computer.

2. History of Computer Generations:

First Generation Computers:


The technology behind the primary generation computers was a fragile glass device, which was
called a vacuum tube. These computers were very heavy and really large. These weren’t very
reliable and programming on them was a tedious task as they used low-level programming
language and used no OS. First-generation computers were used for calculation, storage, and
control purpose. They were too bulky and large that they needed a full room and consume a lot
of electricity.

22DCE077 CE260:Microprocessor and Computer Organization 1


TABLE:1.1 INFORMATION ABOUT 1ST GEN. COMPUTERS

Figure:1.1 First Generation Computer

Second Generation Computers:


Second-generation computers used the technology of transistors rather than bulky vacuum tubes.
Another feature was the core storage. A transistor may be a device composed of semiconductor
material that amplifies a sign or opens or closes a circuit.

Transistors were invented in Bell Labs. The use of transistors made it possible to perform
powerfully and with due speed. It reduced the dimensions and price and thankfully the warmth
too, which was generated by vacuum tubes. Central Processing Unit (CPU), memory,
programming language, and input, and output units also came into the force within the second
generation.

The programming language was shifted from high level to programming language and made
programming comparatively a simple task for programmers.

22DCE077 CE260:Microprocessor and Computer Organization 2


TABLE:1.2 INFORMATION ABOUT 2ND GEN. COMPUTERS

Figure:1.2 Second Generation Computer

Third Generation Computers:


During the third generation, technology envisaged a shift from huge transistors to integrated
circuits, also referred to as IC. Here a variety of transistors were placed on silicon chips, called
semiconductors. The most feature of this era’s computer was speed and reliability. IC was made
from silicon and also called silicon chips.

A single IC has many transistors, registers, and capacitors built on one thin slice of silicon. The
value size was reduced and memory space and dealing efficiency were increased during this
generation. Programming was now wiped out Higher level languages like BASIC (Beginners
All-purpose Symbolic Instruction Code). Minicomputers find their shape during this era.

22DCE077 CE260:Microprocessor and Computer Organization 3


TABLE:1.3 INFORMATION ABOUT 3RD GEN. COMPUTERS

Figure:1.3 Third Generation Computer

Fourth Generation Computers:


In 1971 First microprocessors were used, the large-scale of integration LSI circuits built on one
chip called microprocessors. The advantage of this technology is that one microprocessor can
contain all the circuits required to perform arithmetic, logic, and control functions on one chip.
The computers using microchips were called microcomputers. This generation provided even
smaller size of computers, with larger capacities. That’s not enough, then Very Large Scale
Integrated (VLSI) circuits replaced LSI circuits. The Intel 4004 chip, developed in 1971, located
all the components of the pc from the central processing unit and memory to input/ output
controls on one chip and allowed the dimensions to reduce drastically.

22DCE077 CE260:Microprocessor and Computer Organization 4


TABLE:1.4 INFORMATION ABOUT 4TH GEN. COMPUTERS

Figure:1.4 Fourth Generation Computer

Fifth Generation Computers


The technology behind the fifth generation of computers is AI. It allows computers to behave like
humans. It is often seen in programs like voice recognition, area of medicine, and entertainment. Within
the field of game playing also it’s shown remarkable performance where computers are capable of beating
human competitors.

The speed is the highest, size is the smallest and area of use has remarkably increased within the fifth
generation computers. Though not a hundred percent AI has been achieved to date but keeping in sight
the present developments, it is often said that this dream also will become a reality very soon.

22DCE077 CE260:Microprocessor and Computer Organization 5


TABLE:1.5 INFORMATION ABOUT 5TH GEN. COMPUTERS

Figure:1.5 Fifth Generation Computer

3. Types of computer:

There are two bases on which we can define the types of computers. We will discuss the type of
computers on the basis of size and data handling capabilities. We will discuss each type of
computer in detail. Let’s see first what are the types of computers.

Super Computer
Mainframe computer
Mini Computer
Workstation Computer

22DCE077 CE260:Microprocessor and Computer Organization 6


Server Computers are computers that are combined data and programs. Electronic data and
applications are stored and shared in the server computer. The working of a server computer is
that it does not solve a bigger problem like a supercomputer but it solves many smaller similar

PersonalComputer:
Server Computer (PC)
Server Computer:
Server Computer
Analog Computer
Digital Computer
Hybrid Computer
Tablets and Smartphone

Supercomputer:
When we talk about speed, then the first name that comes to mind when thinking of computers is
supercomputers. They are the biggest and fastest computers (in terms of speed of processing
data). Supercomputers are designed such that they can process a huge amount of data, like
processing trillions of instructions or data just in a second. This is because of the thousands of
interconnected processors in supercomputers. It is basically used in scientific and engineering
applications such as weather forecasting, scientific simulations, and nuclear energy research. It
was first developed by Roger Cray in 1976.

Mainframe computer:
Mainframe computers are designed in such a way that they can support hundreds or thousands of
users at the same time. It also supports multiple programs simultaneously. So, they can execute
different processes simultaneously. All these features make the mainframe computer ideal for big
organizations like banking, telecom sectors, etc., which process a high volume of data in general.

Minicomputer:
Minicomputer is a medium size multiprocessing computer. In this type of computer, there are
two or more processors, and it supports 4 to 200 users at one time. Minicomputer is similar to
Microcontroller. Minicomputers are used in places like institutes or departments for different
work like billing, accounting, inventory management, etc. It is smaller than a mainframe
computer but larger in comparison to the microcomputer.

Workstation Computer:
A workstation computer is designed for technical or scientific applications. It consists of a fast
microprocessor, with a large amount of RAM and a high-speed graphic adapter. It is a single-
user computer. It is generally used to perform a specific task with great accuracy.

Personal Computer (PC):


Personal Computers is also known as a microcomputer. It is basically a general-purpose
computer designed for individual use. It consists of a microprocessor as a central processing
unit(CPU), memory, input unit, and output unit. This kind of computer is suitable for personal
work such as making an assignment, watching a movie, or at the office for office work, etc. For
example, Laptops and desktop computers.

22DCE077 CE260:Microprocessor and Computer Organization 7


Server Computer:
Server Computers are computers that are combined data and programs. Electronic data and
applications are stored and shared in the server computer. The working of a server computer is
that it does not solve a bigger problem like a supercomputer but it solves many smaller similar
ones. Examples of server computer are like Wikipedia, as when users put a request for any page,
it finds what the user is looking for and sends it to the user.

Analog Computer:
Analog Computers are particularly designed to process analog data. Continuous data that
changes continuously and cannot have discrete values are called analog data. So, an analog
computer is used where we don’t need exact values or need approximate values such as speed,
temperature, pressure, etc. It can directly accept the data from the measuring device without first
converting it into numbers and codes. It measures the continuous changes in physical quantity. It
gives output as a reading on a dial or scale. For example speedometer, mercury thermometer, etc.

Digital Computer:
Digital computers are designed in such a way that they can easily perform calculations and
logical operations at high speed. It takes raw data as input and processes it with programs stored
in its memory to produce the final output. It only understands the binary input 0 and 1, so the raw
input data is converted to 0 and 1 by the computer and then it is processed by the computer to
produce the result or final output. All modern computers, like laptops, desktops including
smartphones are digital computers.

Hybrid Computer:
As the name suggests hybrid, which means made by combining two different things. Similarly,
the hybrid computer is a combination of both analog and digital computers. Hybrid computers
are fast like analog computers and have memory and accuracy like digital computers. So, it has
the ability to process both continuous and discrete data. For working when it accepts analog
signals as input then it converts them into digital form before processing the input data. So, it is
widely used in specialized applications where both analog and digital data are required to be
processed. A processor which is used in petrol pumps that converts the measurements of fuel
flow into quantity and price is an example of a hybrid computer.

Tablet and Smartphones:


Tablets and Smartphones are the types of computers that are pocket friendly and easy to carry is
these are handy. This is one of the best use of modern technology. These devices have better
hardware capabilities, extensive operating systems, and better multimedia functionality.
smartphones and tablets contain a number of sensors and are also able to provide wireless
communication protocols.

4. Why computers are needed?

Automation and Efficiency


Information Processing and Storage
Communication and Connectivity

22DCE077 CE260:Microprocessor and Computer Organization 8


Research and Innovation
Education and Learning
Entertainment and Multimedia
Personal Productivity and Lifestyle

5. Applications of Computer:
Information processing
Communication and connectivity
Automation and efficiency
Storage and retrieval of information
Entertainment and multimedia
Education and learning
Business and productivity
Scientific research and innovation
Creative pursuits
Personal convenience

CONCLUSION:
In this practical, we learn about what is computer, why it’s needed, applications of
computer, all 5 generation of computers and the types of computers.

Staff Signature:

Grade:

Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 9


PRACTICAL-2

Aim:- Write a program to convert a given number system to other number


system.

PROGRAM CODE:
#include<iostream>
using namespace std;
int main()
{
float n;
int ct=0,i;
int bin[32];
cout<<"Enter decimal number:";
cin>>n;
int temp=(int)n;
while(temp>0)
{
bin[ct]=temp%2;
temp=temp/2;
ct++;
}
cout<<"Binary value is:";
for(i=(ct-1);i>=0;i--)
{
cout<<bin[i];
}
float frac=n-(int)n;
if(frac!=0)
{
cout<<".";
}
while(frac!=0)
{
float c;
c=frac*2;
cout<<(int)c;
frac=c-(int)c;
}

22DCE077 CE260:Microprocessor and Computer Organization 10


cout<<endl;
cout<<"22DCE086";
return 0;
}

OUTPUT:

CONCLUSION:
One of the most important applications of the number system is in computer technology.
Generally, a computer uses the binary number system, but humans will use the hexadecimal
number system, as it is easier to understand. For this reason, the number system conversion is
required.

Staff Signature:
Grade:
Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 11


Practical – 3
AIM: Implement a circuit in Logisim to display given binary number in
decimal on to seven segment display.

1. What is 7 segment display?


Ans: Seven segment displays were created to display decimal numerals. With its 7
segments, the display can show numbers from 0 to 9. Additionally, they can also display
upper case letters A, C, E, F and lower case letters b and d.

Fig: 3.1 The 7-Segment Display

2. Truth table:

Fig: 3.2 Truth table for 7 segment display

22DCE077 CE260:Microprocessor and Computer Organization 12


3. K- maps:

22DCE077 CE260:Microprocessor and Computer Organization 13


4. Circuit :

Fig: 3.1 Circuit of 7-Segment display

CONCLUSION:
In this practical we learn about 7-segment display and got idea about how 0 to 9 digits can be diplay with
help of 7-segment display.

Staff Signature:
Grade:
Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 14


Practical – 4
AIM: Implement a circuit in Logisim which perform Addition and
Subtraction.
1. What is Adder?
Ans: An adder, or summer, is a digital circuit that performs addition of numbers. In many
computers and other kinds of processors adders are used in the arithmetic logic units
(ALUs).

Fig: 4.1 Half Adder


2. What is Subtractor?
Ans: In electronics, a subtractor – a digital circuit that performs subtraction of numbers –
can be designed using the same approach as that of an adder.

Fig: 4.2 Half Subtractor


3. Hardware Implementation :

Fig: 4.3 Hardware Implementation

22DCE077 CE260:Microprocessor and Computer Organization 15


4. Circuit :

Fig: 4.4 Logisim circuit – Adder

Fig: 4.5 Logisim circuit – Subtractor

CONCLUSION:
In this practical, we learn about how to create adder and subtractor using only one circuit in
LOGISIM software.

Staff Signature:
Grade:
Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 16


Practical – 5
AIM: Write a program which perform multiplication using Booth Algorithm.
CODE:
#include<iostream>
#include<conio.h>
using namespace std;
void add(int a[], int x[], int qrn);
void complement(int a[], int n)
{
int i;
int x[8] = { NULL };
x[0] = 1;
for (i = 0; i < n; i++)
{
a[i] = (a[i] + 1) % 2;
}
add(a, x, n);
}
void add(int ac[], int x[], int qrn)
{
int i, c = 0;
for (i = 0; i < qrn; i++)
{
ac[i] = ac[i] + x[i] + c;
if (ac[i] > 1)
{
ac[i] = ac[i] % 2;
c = 1;
}
else

22DCE077 CE260:Microprocessor and Computer Organization 17


c = 0;
}
}
void ashr(int ac[], int qr[], int &qn, int qrn)
{
int temp, i;
temp = ac[0];
qn = qr[0];
cout << "\t\tashr\t\t";
for (i = 0; i < qrn - 1; i++)
{
ac[i] = ac[i + 1];
qr[i] = qr[i + 1];
}
qr[qrn - 1] = temp;
}
void display(int ac[], int qr[], int qrn)
{
int i;
for (i = qrn - 1; i >= 0; i--)
cout << ac[i];
cout << " ";
for (i = qrn - 1; i >= 0; i--)
cout << qr[i];
}
int main(int argc, char **argv)
{
int mt[10], br[10], qr[10], sc, ac[10] = { 0 };
int brn, qrn, i, qn, temp;
cout<< "\n--Enter the multiplicand and multipier in signed 2's complement form if negative--";
cout << "\n Number of multiplicand bit=";

22DCE077 CE260:Microprocessor and Computer Organization 18


cin >> brn;
cout << "\nmultiplicand=";

for (i = brn - 1; i >= 0; i--)


cin >> br[i]; //multiplicand

for (i = brn - 1; i >= 0; i--)


mt[i] = br[i]; // copy multipier to temp array mt[]

complement(mt, brn);

cout << "\nNo. of multiplier bit=";


cin >> qrn;

sc = qrn; //sequence counter

cout << "Multiplier=";


for (i = qrn - 1; i >= 0; i--)
cin >> qr[i]; //multiplier
qn = 0;
temp = 0;

cout << "qn\tq[n+1]\t\tBR\t\tAC\tQR\t\tsc\n";


cout << "\t\t\tinitial\t\t";
display(ac, qr, qrn);
cout << "\t\t" << sc << "\n";

while (sc != 0)
{
cout << qr[0] << "\t" << qn;
if ((qn + qr[0]) == 1)

22DCE077 CE260:Microprocessor and Computer Organization 19


{
if (temp == 0)
{
add(ac, mt, qrn);
cout << "\t\tsubtracting BR\t";
for (i = qrn - 1; i >= 0; i--)
cout << ac[i];
temp = 1;
}
else if (temp == 1)
{
add(ac, br, qrn);
cout << "\t\tadding BR\t";
for (i = qrn - 1; i >= 0; i--)
cout << ac[i];
temp = 0;
}
cout << "\n\t";
ashr(ac, qr, qn, qrn);
}
else if (qn - qr[0] == 0)
ashr(ac, qr, qn, qrn);

display(ac, qr, qrn);


cout << "\t";
sc--;
cout << "\t" << sc << "\n";
}
cout << "Result=";
display(ac, qr, qrn);
}

22DCE077 CE260:Microprocessor and Computer Organization 20


OUTPUT:

Staff Signature:

Grade:

Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 21


PRACTICAL-6
AIM:
1.Add and Subtract the 16-bit number in memory locations 4000H and 4001H to the 16-bit number
in memory locations 4002H and 4003H. The most significant eight bits of the two numbers to be added
are in memory locations 4001H and 4003H. Store the result in memory locations 4004H and 4005H
with the most significant byte in memory location 4005H.

Addition:
Program Code:

org 100h
MOV AX,[4000H]
MOV BX,[4002H]
ADD AX,BX
MOV [4004H],AX
Ret

Output:

Subtraction:
Program Code:
org 100h
MOV AX,[4000H]
MOV BX,[4002H]
SUB AX,BX
MOV [4004H],AX
Ret

22DCE077 CE260:Microprocessor and Computer Organization 22


Output:

AIM:

2 :- Write a program to multiply & divide the number stored at 4000H by 08H and store
the resul at
4001H & 4002H.
Multiplication:
Program Code:

org 100h
MOV AX,[4000H]
MOV BX,08H
MUL BX
MOV [4001H],AX
ret
Output:

22DCE077 CE260:Microprocessor and Computer Organization 23


AIM:
3.Write an assembly language program to convert temperature in F to C. C=(F-32) * 5/9
Program Code:
org 100h
MOV AL,[4000H]
SUB AL,32d
MOV BL,5d
MUL BL
MOV CL,9d
DIV CL
MOV [4002H],AL
Ret

Output:

Conclusion:
Through this practical we can learn about microprocessor 8086 and how to implement
different operations on it and also about assembly language.

Staff Signature:

Grade:

Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 24


PRACTICAL-7

AIM:

Consider two 8-bit data are stored at memory location 4001H and 4002H.

perform following logical operation on it and store result from 4002H location.

1.OR Operation

Program Code:

org 100h

MOV AL,[4001H]

MOV BL,[4002H]

OR AL,BL

MOV [4002H],AL

Ret

Output:

22DCE077 CE260:Microprocessor and Computer Organization 25


AND Operation

Program Code:

org 100h

MOV AL,[4001H]

MOV BL,[4002H]

AND AL,BL

MOV [4002H],AL

Ret

Output:

NOT Operation

Program Code:

org 100h

MOV AL,[4001H]

NOT AL

MOV [4002H],AL ret

22DCE077 CE260:Microprocessor and Computer Organization 26


Output:

XOR Operation

org 100h

Program Code:

MOV AL,[4001H]

MOV BL,[4002H]

XOR AL,BL

MOV [4002H],AL

ret

Output:

22DCE077 CE260:Microprocessor and Computer Organization 27


5 :- Logical Left & Right Shift

Logical Left

Program Code:

org 100h

MOV AL,[4001H]

SHL AL,1

MOV [4002H],AL

ret

Output:

Logical Right:

Program Code:

org 100h

MOV AL,[4001H]

SHR AL,1

MOV [4002H],AL ret


22DCE077 CE260:Microprocessor and Computer Organization 28
Output:

6 :- Arithmetic Left and Right Shift

Arithmetic Left Shift

Program Code:

org 100h

MOV AL,[4001H]

SAL AL,1

MOV [4002H],AL

ret

Output:

22DCE077 CE260:Microprocessor and Computer Organization 29


Arithmetic Right Shift

Program Code:

org 100h

MOV AL,[4001H]

SAR AL,1

MOV [4002H],AL

ret

Output:

Rotate Left and Right with Carry

Rotate Left

Program Code:

org 100h

STC

MOV AL,[4001H]

RCL AL,1

MOV [4002H],AL ret

22DCE077 CE260:Microprocessor and Computer Organization 30


RCL AL,1

MOV [4002H],AL

ret

Output:

Rotate Right

Program Code:

org 100h

STC

MOV AL,[4001H]

RCR AL,1

MOV [4002H],AL

ret

22DCE077 CE260:Microprocessor and Computer Organization 31


Output:

Rotate Left and Right without Carry

Rotate Left

Program Code:

org 100h

MOV AL,[4001H]

ROL AL,1

MOV [4002H],AL

ret

Output:

22DCE077 CE260:Microprocessor and Computer Organization 32


Rotate Right

Program Code:

org 100h

MOV AL,[4001H]

ROR AL,1

MOV [4002H],AL

Ret

Output:

Conclusion:

Through this practical we can learn about different kind of operations performed

in microprocessor 8086

22DCE077 CE260:Microprocessor and Computer Organization 33


Staff Signature:

Grade:

Remarks by the Staff:

22DCE077 CE260:Microprocessor and Computer Organization 34

You might also like