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

LABORATORY MANUAL

MICROPROCESSOR LAB

B.Tech, Semester: 5th Sem


Subject Code: MP&MC-313

Session: 2023-24

Name :

Roll No. :

Group/Branch :
Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

VISIONOFTHEINSTITUTE

Aims to become an Institution of excellence in imparting quality outcome based education that empowers the young
generation with knowledge, skills, research aptitude and ethical values to solve contemporary challenging problems.

MISSIONOFTHEINSTITUTE

Develop a platform for achieving globally acceptable level of intellectual acumen and technological competence.
Create an inspiring ambience that raises the motivation level for conducting quality research.
Provide an environment for acquiring ethical values and positive attitude.

VISIONOFTHEDEPARTMENT

Emerge as a premier department of Electrical and Electronics Engineering, a source of technically outstanding
energetic engineers, entrepreneurs and leaders through its highest quality academics and research
MISSIONOFTHEDEPARTMENT

1. Provide the students with basic and advanced knowledge in the field of Electrical and Electronics
Engineering as well as professional skills necessary to face the challenges of the future.
2. Encourage the students to strive for excellence through innovation and collaborative research
activities.
3. Imbibe students with qualities like team work, managerial skills and ethical & cultural values to work
in a collaborative environment.

PROGRAM EDUCATIONAL OBJECTIVES (PEOs)

After 3 to 5 years of graduation, graduates will be able to


1. Apply their basic, advanced and analytical skills in the field of Electrical and Electronics Engineering
necessary to take on higher responsibilities in industry.

2. Hold position in academics and research organizations to pursue a continual path of professional
development and excel through innovation and collaborative research activities.

3. Work effectively as individuals and as team members exhibiting managerial skills and ethical &
cultural values imbibed in them to solve industrial and socially relevant issues

Department of Electronics & Communication Engineering Page 2


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

PROGRAM SPECIFIC OUTCOMES (PSOs)


PSO1:

Apply the knowledge in the field of Embedded and Control systems to provide acceptable solutions for
industrial and societal needs
PSO2:

Model, analyze and validate the performance of Smart Energy Systems that are sustainable.

PROGRAM OUTCOMES (POs)

Engineering Graduates will be able to:

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and
an engineering specialization to the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design system
components or processes that meet the specified needs with appropriate consideration for the public health
and safety, and the cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern engineering
and IT tools including prediction and modeling to complex engineering activities with an understanding of
the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.

Department of Electronics & Communication Engineering Page 3


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

7. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s own work, as a member and leader in a team, to manage
projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in independent
and life-long learning in the broadest context of technological change.

Department of Electronics & Communication Engineering Page 4


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

COURSE OUTCOMES (COs)


Students will be able to
C324.1 Discuss the microprocessor system.K1
C324.2 Development of flow chart for understanding the data flow K3
C324.3 Discuss the assembly language to program microprocessor based system K3
C324.4 Demonstrate Interfacing of different peripheral devices with the microprocessor K4
C324.5 Applying the logic for microprocessor based system K4.

CO-PO-PSO MAPPING

PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2

C324.1 3 2 1 1 1 3 2 1 2
3 3
C324.2 3 2 2 1 2 3 2 1 2
3 3
C324.3 3 2 2 1 2 3 2 1 2
3 3
C324.4 3 3 3 2 3 3 2 1 2
3 3
C324.1 3 2 1 1 1 3 2 1 2
3 3

Department of Electronics & Communication Engineering Page 5


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

Experiment List:

A. Study Experiments (any two):


1. To study 8085 based microprocessor system
2. To study 8086 and 8086A based microprocessor system
3. To study Pentium Processor
B. Programming based Experiments (any four):
4. To develop and run a program for finding out the largest/smallest number from a given set of numbers.
5. To develop and run a program for arranging in ascending/descending order of a set of Numbers
6. To perform multiplication/division of given numbers
7. To perform conversion of temperature from 0F to 0C and vice-versa
8. To perform computation of square root of a given number
9. To perform floating point mathematical operations (addition, subtraction, multiplication and division)
C. Interfacing based Experiments (any four):
10. To obtain interfacing of RAM chip to 8085/8086 based system
11. To obtain interfacing of keyboard controller
12. To obtain interfacing of DMA controller
13. To obtain interfacing of PPI
14. To obtain interfacing of UART/USART
15. To perform microprocessor-based stepper motor operation through 8085 kit
16. To perform microprocessor-based traffic light control
17. To perform microprocessor-based temperature control of hot water

Department of Electronics & Communication Engineering Page 6


DO’s and DON’Ts

Do’s
1. Know the location of the fire extinguisher and the first aid box and how to use them in case of
an emergency.
2. Read and understand how to carry out an activity thoroughly before coming to the laboratory.
3. Report fires or accidents to your lecturer/laboratory technician immediately.
4. Report any broken plugs or exposed electrical wires to your lecturer/laboratory technician
immediately.

Don’ts
1. Do not eat or drink in the laboratory.
2. Avoid stepping on electrical wires or any other computer cables.
3. Do not open the system unit equipment particularly when the power is turned on. Some
internal components hold electric voltages of up to 30000 volts, which can be fatal.
4. Do not insert metal objects such as clips, pins and needles into the respective equipment that
may cause fire.
5. Do not remove anything from the laboratory without permission.
6. Do not touch, connect or disconnect any plug or cable without your lecturer/laboratory
technician’s permission.
7. Do not misbehave in the respective laboratory.
Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

LIST OF EXPERIMENTS

Sr. No. Title of experiment Corresponding


CO

1 To study 8085 / 8086 based microprocessor system. CO1


To perform mathematical operations (addition & subtraction) CO2, CO3
2 on two 8-bit numbers
3 To perform multiplication on two 8-bit numbers CO2

4 To perform division on two 8-bit numbers CO2

To develop and run a program for finding out the largest CO2
5
number from given two 8-bit numbers
To develop and run a program for finding out the smallest number CO2
6 from given two 8-bit numbers
To develop and run a program for arranging in ascending order of a CO2
7 given set of 8-bit numbers
To develop and run a program for arranging in descending CO2
8
order of a given set of 8-bit numbers
9 To find the square root of a given 8 bit number CO5, CO3
10 Interfacing 8255 PPI IC with 8085. CO4

MICROPROCESSOR LAB

8085 Programming
1. Introduction to 8085
2. 8-bit Addition and Subtraction
3. 8-bit Multiplication and Division

4. Largest and Smallest number in an array


5. Sorting in Ascending and Descending Order

6. Finding the Square root of a Number.

Interfacing
1. Interfacing 8255 PPI IC with 8085.

Department of Electronics & Communication Engineering Page 8


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

OBJECTIVES OF THE LABORATORY COURSE:


A course on Laboratory Experiments on electrical Science is offered to the students
keeping in view the following objectives.

(i) To provide hands on practical exposure.

(ii) To provide experience in working on 8085 and 8086 microprocessor kit.

(iii) To enforce theoretical instructions with related practical work.

(iv) To get training in Technical Report Writing.

PRESENT PROBLEM:

It is difficult during any Engineering course under the present setup, to arrange
practical and related theory in an integrated manner so as to simultaneously correlate
practical work with the theory teaching. For this, theory lectures have to be followed by
the related practical simultaneously and all the students need to perform the same
experiments at the same time over what just has been covered in the theory. Owing to the
large number of students, it is not possible to arrange for the practical work this way. It
becomes necessary to ask the student to work in groups and perform experiments by
rotation. The student has to, quite often; perform the experiments for which the theory
shall be taught in the classroom at a much later date. Students have to come to the
laboratory completely unprepared as they have neither been taught the related theory nor
been given any instruction about the experiment to be performed.

This Manual has been prepared essentially keeping this difficulty in mind. Brief
theory for each Experiment is given in such a manner that even if the student has not
studied the theory related to the Experiment, one can have sufficient information to
perform the experiment and sufficiently understand it.

Department of Electronics & Communication Engineering Page 9


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

This Manual consists of a set of apparatus prepared for different experiments. For
each experiment, required apparatus is given separately.

Observations should be recorded in the tabular form. Students shall draw a neat
respective Circuit/pin diagram with description of the microprocessor, type of instrument
(AC / DC) and type of supply. All the summary, results shall be recorded by the students.

Department of Electronics & Communication Engineering Page 10


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

PREFACE
This manual of MicroprocessorLab has been specifically designed for the Third Year B. Tech Course in
Electrical & Electronics Engineering with the objective to provide the students, brief guidelines on the
experiment to be performed in the laboratory. This manual contains some features on the basis of
experience to cover the difficulties and problems associated in general, with the laboratory work. Detailed
instructions for carrying out each experiment along with relevant theory has been presented.

The Department Faculty hopes that the students will find this manual helpful in performing the
experiments in digital electronics lab. Thanks to all the department faculty members and also non-
teaching staff members for their support and help in preparation of this manual.

Prepared by:
Dr. Neeraj Kumar
Assistant Professor
Electronics & Communication Engineering
Indian Institute of Information Technology, Bhopal

Department of Electronics & Communication Engineering Page 11


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

DETAILS OF THE EXPERIMENTS CONDUCTED


(TO BE USED BY THE STUDENTS IN THEIR RECORDS)

FACULTY
DATE OF MARKS
SR. EXPT PAGE SIGNATURE
CONDUC TITLE OF THE EXPERIMENT AWARDED
NO. . NO NO. WITH
TION (10)
REMARK

10

Department of Electronics & Communication Engineering Page 12


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT NO.1
8085/8086 MICROPROCESSOR

AIM: To study 8085 microprocessor system.


Pre-requisite questions:
1. What is meant by Microprocessor?
2. Write the architecture of the 8085 and 8086 microprocessor.

INTEL 8085 is one of the most popular 8-bit microprocessor capable of


addressing 64 KB of memory and its architecture is simple. The device has 40 pins,
requires +5 V power supply and can operate with 3MHz single phase clock.

ALU (Arithmetic Logic Unit):


The 8085A has a simple 8-bit ALU and it works in coordination with the
accumulator, temporary registers, 5 flags and arithmetic and logic circuits. ALU has
the capability of performing several mathematical and logical operations. The
temporary registers are used to hold the data during an arithmetic and logic operation.
The result is stored in the accumulator and the flags are set or reset according to the
result of the operation. The flags are affected by the arithmetic and logic operation.
They are as follows:
 Sign flag
After the execution of the arithmetic - logic operation if the bit D7
of the result is 1, the sign flag is set. This flag is used with signed
numbers. If it is 1, it is a negative number and if it is 0, it is a positive
number.
 Zero flag
The zero flag is set if the ALU operation results in zero. This flag
is modified by the result in the accumulator as well as in other registers.
 Auxiliary carry flag
In an arithmetic operation when a carry is generated by digit D3
and passed on to D4, the auxiliary flag is set.
 Parity flag
After arithmetic – logic operation, if the result has an even number
of 1’s the flag is set. If it has odd number of 1’s it is reset.

Department of Electronics & Communication Engineering Page 13


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

 Carry flag
If an arithmetic operation results in a carry, the carry flag is set.
The carry flag also serves as a borrow flag for subtraction.

Timing and control unit

This unit synchronizes all the microprocessor operation with a clock and
generates the control signals necessary for communication between the
microprocessor and peripherals. The control signals RD (read) and WR (write)
indicate the availability of data on the data bus.

Instruction register and decoder

The instruction register and decoder are part of the ALU. When an instruction is
fetched from memory it is loaded in the instruction register. The decoder decodes the
instruction and establishes the sequence of events to follow.

Register array

The 8085 has six general purpose registers to store 8-bit data during program
execution. These registers are identified as B, C, D, E, H and L. they can be combined
as BC, DE and HL to perform 16-bit operation.

Accumulator

Accumulator is an 8-bit register that is part of the ALU. This register is used to
store 8-bit data and to perform arithmetic and logic operation. The result of an
operation is stored in the accumulator.

Program counter

The program counter is a 16-bit register used to point to the memory address of
the next instruction to be executed.

Stack pointer

It is a 16-bit register which points to the memory location in R/W memory, called
the Stack.

Communication lines
8085 microprocessor performs data transfer operations using three communication
lines called buses. They are address bus, data bus and control bus.

Department of Electronics & Communication Engineering Page 14


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

 Address bus – it is a group of 16-bit lines generally identified as A 0 – A15.


The address bus is unidirectional i.e., the bits flow in one direction from
16
Microprocessor to the peripheral devices. It is capable of addressing 2
memory locations.
 Data bus – it is a group of 8 lines used for data flow and it is bidirectional.
The data ranges from 00 – FF.
 Control bus – it consist of various single lines that carry synchronizing
signals. The microprocessor uses such signals for timing purpose.

SYSTEM SPECIFICATIONS OF 8085 (HARDWARE)


CPU - 8 bit microprocessor the 8085
XTAL FREQUENCY - 6.144 MHz
RAM - 8K bytes with provision for expansion
EPROM -16K/32K bytes of EPROM with the provision for expansion
MEMORY - total on board capacity of 64K bytes
TIMER - three 16 bit programmable timers’ counters using 8253
I/O LINES -24 I/O lines using 8255 expandable to 48 I/O lines.
INTERRUPTS - 8 interrupts lines through 8259
SERIAL INTERFACES - RS 232 through SID & SOD lines
OTHER INTERFACES - (a) A/D converter I/F
(b) D/A converter I/F
(c)Relay I/F
(d) Opto isolated input I/F
(e) Printer I/F

DISPLAY - 20*2 LCD display


BUS - All data, Add & Control signals at 50 pin FRC connector.
POWER SUPPLY - (Optional) +5V, 1.5 A for the Kit & Serial I/F
REQUIREMENT +/-12V for Aux Serial I/F, +12, +21, +24V for programming

Department of Electronics & Communication Engineering Page 15


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

LIST OF COMMANDS (8085)

1. L List a Memory Block


2. M Examine/Modify Memory
3. E Enter a Memory Block
4. R Examine/ Modify Register
5. S Single Step
6. G Go
7. B Block Move
8. I Insert
9. D Delete
10. N Insert Data
11. O Delete data
12. F Fill
13. H Relocate
14. J Memory Compare
15. K String
16. P Print
17. 1 Assemble/ Disassemble

Department of Electronics & Communication Engineering Page 16


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

LIST OF COMMANDS (8086)


SL KEY COMMAND COMMAND SUB COMMAND AVAILABLE
NO. PRESSE NAME DESCRIPTION
D WITH LIST OF SUB
COMMAND OPTION
1 S Sub_MIR Substitute- Memory, Read /write into/ from Memory/
I/O, Register from Port Address/ from Register
2 M Move Move-Block, Constant Move a block of memory to another
destination address
Fill a constant data byte in a
Memory Block
3 C Compare Compare– Block, Compare two blocks of memory for
Constant, Master being equal
Compare contents of memory block
with a constant
Compare contents of master socket
with EPROM
4 J Mem_Tst Memory test Test RAM memory for being Ok
5 E Ex_Mon Expand monitor Expands monitor command set for
working in assembler mode
6 G Go To Execute in – Burst, Execute command in Burst, single
Sing_stp, Break_Pt step mode & in break point
7 T List List List the contents of EPROM
8 P Program Program Program the EPROM in ZIF socket
with the data
9 U Ser_Out Serial out Up Loads program
10 I Ser_In Serial In Down Loads the program
11 B Blank Blank Check Blank Check the EPROM

POST EXPERIMENT QUESTIONS:


1. Differentiate 8085 and 8086 microprocessor
2. Explain the register set
3. List out the commands of 8085 and 8086 microprocessor

Department of Electronics & Communication Engineering Page 17


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

Department of Electronics & Communication Engineering Page 18


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 2(A)

8 BIT DATA ADDITION


AIM:
To add two 8 bit numbers stored at consecutive memory locations.

PRE-REQUISITE QUESTIONS:
1. What is the pattern of representation of a 8 bit number?
2. What is total memory consumption of 8 bit processor?
3. How many address lines are used for communication in 8 bit microprocessor?

ALGORITHM:

1. Initialize memory pointer to data location.


2. Get the first number from memory in accumulator.
3. Get the second number and add it to the accumulator.
4. Store the answer at another memory location.

RESULT:

Thus the 8 bit numbers stored at 4500 &4501 are added and the result stored at 4502
& 4503.

POST EXPERIMENT QUESTIONS:


1. What is the command used for getting 8 bit numbers?
2. Define OP-CODE. What is the op-code of the instruction ADD?
3. How many cycles are consumed by a processor for ADD instructions?
4. What is the instruction for addition with carry?

OBSERVATION:

INPUT OUTPUT
4500 4502
4501 4503

Department of Electronics & Communication Engineering Page 19


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

FLOW CHART:

START

[C] 00H

[HL]4500H

[A] [M]

[HL] [HL]+1

[A] [A]+[M]

NO

Is there a
Carry ?

[C] [C]+1

[HL] [HL]+1

[M] [A]

[HL] [HL]+1

[M] [C]

STOP

Department of Electronics & Communication Engineering Page 20


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 2(B)

8 BIT DATA SUBTRACTION

AIM:

To subtract two 8 bit numbers stored at consecutive memory locations.

PRE-REQUISITE QUESTIONS:
1. What is instruction used for subtracting a8 bit number?
2. How the eight bit numbers are subtracted in binary format?
3. What is the instruction for subtraction with barrow?

ALGORITHM:

1. Initialize memory pointer to data location.


2. Get the first number from memory in accumulator.
3. Get the second number and subtract from the accumulator.
4. If the result yields a borrow, the content of the acc. is complemented and 01H is
added to it (2’s complement). A register is cleared and the content of that reg. is
incremented in case there is a borrow. If there is no borrow the content of the
acc. is directly taken as the result.
5. Store the answer at next memory location.

RESULT:

Thus the 8 bit numbers stored at 4500 &4501 are subtracted and the result stored at 4502
& 4503.

OBSERVATION:

INPUT OUTPUT
4500 4502
4501 4503

POST EXPERIMENT QUESTIONS:


1. What is the op-code of the instruction SUB?
2. How many cycles are consumed by a processor for SUB, SBB instructions?
3. How the results obtained using SBB instructions are stored in memory location?

Department of Electronics & Communication Engineering Page 21


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

FLOW CHART:

START

[C] 00H

[HL] 4500H

[A] [M]

[HL] [HL]+1

[A] [A]-[M]

Is there a NO
Borrow ?

YES
Complement [A]
Add 01H to [A]

[C] [C]+1

[HL] [HL]+1

[M] [A]

[HL] [HL]+1

[M] [C]

STOP

Department of Electronics & Communication Engineering Page 22


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

ASSEMBLY LANGUAGE PROGRAM

HEX Codes Mnemonics Comments

0E, 00 MVI C,00H Clear C register

21, 00, 80 LXI H,8000H Load initial address to get operand

7E MOV A,M Load Acc with memory element

23 INX H Point to next location

46 MOV B,M Load B with second operand

90 SUB B Subtract B from A

D2, 0D, F0 JNC STORE When CY = 0, go to STORE

0C INR C Increase C by 1

21, 50, 80 LXI H,8050H Load the destination address

77 MOV M,A Store the result

23 INX H Point to next location

71 MOV M,C Store the borrow

76 HLT Terminate the program

Department of Electronics & Communication Engineering Page 23


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 3

8 BIT DATA MULTIPLICATION


AIM:

To perform multiplication on two 8- bit numbers.

PRE-REQUISITE QUESTIONS:
1. What instruction is used for Multiplying two 8 bit numbers?
2. How the multiplication of eight bit numbers are carried out in a 8 bit
microprocessor?

ALGORITHM:

LOGIC: Multiplication can be done by repeated addition.

1. Initialize memory pointer to data location.


2. Move multiplicand to a register.
3. Move the multiplier to another register.
4. Clear the accumulator.
5. Add multiplicand to accumulator
6. Decrement multiplier
7. Repeat step 5 till multiplier comes to zero.
8. The result, which is in the accumulator, is stored in a memory location.

RESULT:

Thus the 8-bit multiplication was done in 8085p using repeated addition method.

POST EXPERIMENT QUESTIONS:


1. What is the op-code of the instruction SUB?
2. How many cycles are consumed by a processor for SUB, SBB instructions?
3. How the results obtained using SBB instructions are stored in memory location

Department of Electronics & Communication Engineering Page 24


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

FLOW CHART:

START

[HL] 4500

B M

[HL]  [HL]+1

A00

C00

[A]  [A] +[M]

Is there NO
any carry

YES
CC+1

BB-1

NO
IS B=0

YES

Department of Electronics & Communication Engineering Page 25


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

[HL] [HL]+1

[M] [A]

[HL] [HL]+1

[M] [C]

STOP

OBSERVATION:

INPUT OUTPUT
4500 4502
4501 4503

Department of Electronics & Communication Engineering Page 26


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 4

8 BIT DIVISION
AIM:

To perform division on two 8-bit numbers.

PRE-REQUISITE QUESTIONS:
1. What instruction is used for Division of two 8 bit numbers?
2. How the division of eight bit numbers are carried out in a 8 bit microprocessor?

ALGORITHM:

LOGIC: Division is done using the method Repeated subtraction.


1. Load Divisor and Dividend
2. Subtract divisor from dividend
3. Count the number of times of subtraction which equals the quotient
4. Stop subtraction when the dividend is less than the divisor .The dividend now
becomes the remainder. Otherwise go to step 2.
5. Stop the program execution.

RESULT:

Thus an ALP was written for 8-bit division using repeated subtraction method
and executed using 8085 p kits

POST EXPERIMENT QUESTIONS:


1. What is the op-code of the instruction SUB?
2. How many cycles are consumed by a processor for SUB, SBB instructions?
3. How the results obtained using SBB instructions are stored in memory location.

OBSERVATION:

S.NO INPUT OUTPUT


ADDRESS DATA ADDRESS DATA
1 4500 4502
4501 4503
2 4500 4502
4501 4503

Department of Electronics & Communication Engineering Page 27


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

FLOWCHART:
START

B00

[HL] 4500

A M

[HL]  [HL]+1

M  A-M

[B]  [B] +1

NO
IS A<0
YES
AA+M

BB-1

[HL] [HL]+1

[M] [A]

[HL] [HL]+1

[M] [B]

STOP

Department of Electronics & Communication Engineering Page 28


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 5

LARGEST ELEMENT IN AN ARRAY

AIM:
To develop and run a program for finding out the largest number from given
two 8-bit numbers.
PRE-REQUISITE QUESTIONS:
1. What is an array?
2. How the array will be considered in an 8 bit microprocessor?
3. What is the function of counter?

ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content
(next element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.

RESULT:
Thus the largest number in the given array is found out.

POST EXPERIMENT QUESTIONS:


1. What is the function of INC, DRC instructions?
2. How the looping can be done to identify the largest number in an array?

Department of Electronics & Communication Engineering Page 29


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

OBSERVATION:

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8105
8101
8102
8103
8104

FLOW CHART:
START


[HL] [8100H]


[B] 04H


[A] [HL]


[HL [HL] + 1

NO IS
[A] < [HL]?

YES

[A] [HL]


[B] [B]-1

IS NO
[B] = 0?

YES

[8105] [A]

STOP

Department of Electronics & Communication Engineering Page 30


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 6

SMALLEST ELEMENT IN AN ARRAY

AIM:
To develop and run a program for finding out the smallest number from given
two 8-bit numbers.

PRE-REQUISITE QUESTIONS:
1. What is the logic used for finding the smallest number in an array?
2. What is the function of accumulator in the current program?

ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content
(next element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.

RESULT:
Thus the smallest number in the given array is found out.

POST EXPERIMENT QUESTIONS:


1. How many machine cycles are taken by INC and DRC instructions?
2. How many machine cycles are used for the execution of entire program?
3. What is the function of STA instruction?
4. Can STA instruction be replaced by any other instruction?

Department of Electronics & Communication Engineering Page 31


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

OBSERVATION:

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8105
8101
8102
8103
8104

FLOW CHART:
START


[HL] [8100H]


[B] 04H


[A] [HL]


[HL [HL] + 1

YES IS
[A] < [HL]?

NO

[A] [HL]


[B] [B]-1

IS NO
[B] = 0?

YES

[8105] [A]

STOP

Department of Electronics & Communication Engineering Page 32


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 7

ASCENDING ORDER
AIM:
To develop and run a program for arranging in ascending order of a given set
of 8-bit numbers.

PRE-REQUISITE QUESTIONS:
1. What is the logic used for sorting an array in ascending order?
2. Discuss the register pairs.

ALGORITHM:

1.Get the numbers to be sorted from the memory locations.


2.Compare the first two numbers and if the first number is larger than second then
Interchange the number.
3. If the first number is smaller, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order

RESULT:

Thus the ascending order program is executed and thus the numbers are
arranged in ascending order.

POST EXPERIMENT QUESTIONS:


1. Write the program for arranging an array ascending order using register pairs.

Department of Electronics & Communication Engineering Page 33


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

FLOWCHART: START


[B] 04H


[HL] [8100H]


[C] 04H


[A] [HL]


[HL [HL] + 1

YES IS
[A] < [HL]?

NO

[D] [HL]


[HL] [A]


[HL] [HL] - 1


[HL] [D]


[HL] [HL] + 1


[C] [C]–01H

Department of Electronics & Communication Engineering Page 34


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

NO
A

IS
[C] = 0?
YES


[B] [B]-1

NO
IS
[B] = 0?

STOP

OBSERVATION:

INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
8100 8100
8101 8101
8102 8102
8103 8103
8104 8104

Department of Electronics & Communication Engineering Page 35


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 8

DESCENDING ORDER
AIM:
To develop and run a program for arranging in descending order of a given set
of 8-bit numbers.
.
PRE-REQUISITE QUESTIONS:
1. What is the logic used for sorting an array in descending order?

ALGORITHM:

1.Get the numbers to be sorted from the memory locations.


Compare the first two numbers and if the first number is smaller than second then
2. interchange the number
3. If the first number is larger, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order.

RESULT:

Thus the descending order program is executed and thus the numbers are
arranged in descending order.

POST EXPERIMENT QUESTIONS:


1. Write the program for arranging an array descending order using register pairs.

Department of Electronics & Communication Engineering Page 36


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

FLOWCHART: START


13. 04H


[HL] [8100H]


[C] 04H


[A] [HL]


[HL [HL] + 1

NO IS
[A] < [HL]?

YES

[D] [HL]


[HL] [A]


[HL] [HL] - 1


[HL] [D]


[HL] [HL] + 1


[C] [C]–01H

Department of Electronics & Communication Engineering Page 37


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

NO
IS
[C] = 0?


[B] [B]-1

NO
IS
[B] = 0?

STOP

OBSERVATION:

INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
8100 8100
8101 8101
8102 8102
8103 8103
8104 8104

Department of Electronics & Communication Engineering Page 38


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 9

SQUARE ROOT OF A NUMBER

AIM:
. To perform computation of square root of a given number.

PRE-REQUISITE QUESTIONS:
1. What is the logic used for obtaining a square root of a 8 bit number?
2. State the functions of CALL, JMP, CMP instructions.

ALGORITHM:

Store the approximation in two registers and get the numbers whose square root be
1. calculated in a register.
Make sub program of division. Assign new variables for approximation and number by
2. considering the starting value as zero.
3. Compare the approximation and the number till the approximation is less than the number by
incrementing L.
5. Add the result 1 of division subroutine and approximation.
6. Call the subroutine with new value.
7. Compare the result 2 of 2nd call for subroutine.
8. If result 2 and approximation value are same store the result else get a new number and
repeat the steps from 2-7.

RESULT:

Thus the ascending order program is executed and thus the square root of a given number is
obtained.

POST EXPERIMENT QUESTIONS:


1. Define subroutine
2. Discuss briefly about Stack Pointer(SP).

Department of Electronics & Communication Engineering Page 39


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

Flow Diagram

ASSEMBLY LANGUAGE PROGRAM:

Address HEX Codes Labels Mnemonics Comments

8000 80, 00, 83 START LXI SP, 8300H SP = 8300H

8003 3E, 01 MVI A, 01H A (first approximation) = 01 H

8005 57 UP MOV D, A D = A Tracking Xold

8006 2E, NUM MVI L, NUM L = number N whose square


root is to be calculated

8008 CD, 1E, 80 CALL DIV Call div subroutine to calculate


N/X HereN in L and X in A. It
Department of Electronics & Communication Engineering Page 40
Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

Address HEX Codes Labels Mnemonics Comments

performs L = L/A and it returns


result in L

800B 7D MOV A, L A = L (return argument)

800C 82 ADD D A = A+D (N/X) + X

800D 26, 00 MVI H, 00H H = 00 H

800F 6F MOV L, A L=A

8010 3E, 02 MVI A, 02H A = 02 H

8012 CD, 1E, 80 CALL DIV Call div subroutine Here sum in
L and 2in A Xnew= ((N/Xold)+
Xold)/2

8015 7D MOV A, L A=L

8016 BA CMP D Compare D and A Comparing


Xold and Xnew

8017 C2, 05, 80 JNZ UP Is A = D, if no go to up If they


are equal then the obtained
value of X is the answer

801A 32, 00, 81 STA 8100H Store the result at the desired
memory location 8100H

801D 76 HLT Stop

801E 4F DIV MOV C, A C=A

801F 7D MOV A, L A=l

8020 2E, 00 MVI L, 00H L = 00

8022 B9 UP1 CMP C Compare a and c registers

8023 D8 RC Is A < C? If yes return to main

8024 91 SUB C A=A–C

8025 2C INR L L=L+1

8026 C3, 22, 80 JMP UP1 Go back to UP1

8000 80, 00, 83 START LXI SP, 8300H SP = 8300H

Department of Electronics & Communication Engineering Page 41


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

EXPERIMENT No. 10

INTERFACING 8255 WITH 8085


AIM:
. Write a program of Flashing LED connected to the 8051 Micro Controller

APPARATUS REQUIRED:

8085 p kit, 8255Interface board, DC regulated power supply, VXT parallel bus

PRE-REQUISITE QUESTIONS:
1. What is meant by interfacing of a peripheral device?
2. Which are the different interfacing devices used with 8085?
3. What are the advantages of interfacing devices?

I/O MODES:
Control Word:

MODE 0 – SIMPLE I/O MODE:


Department of Electronics & Communication Engineering Page 42
Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

This mode provides simple I/O operations for each of the three ports
and is suitable for synchronous data transfer. In this mode all the ports can be
configured either as input or output port.
Let us initialize port A as input port and port B as output port.

PROGRAM:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


4100 START: MVI A, 90 Initialize port A
4101 as Input and Port
B as output.
4102 OUT C6 Send Mode
4103 Control word
4104 IN C0 Read from Port A
4105
4106 OUT C2 Display the data
4107 in port B
4108 STA 4200 Store the data
4109 read from Port A
410A in 4200
410B HLT Stop the
program.

MODE1 STROBED I/O MODE:


In this mode, port A and port B are used as data ports and port C is used as control
signals for strobed I/O data transfer.
Let us initialize port A as input port in mode1

MAIN PROGRAM:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


4100 START: MVI A, B4 Initialize port A
4101 as Input port in
Mode 1.
4102 OUT C6 Send Mode
4103 Control word
4104 MVI A,09 Set the PC4 bit
for INTE A
4105
4106 OUT C6 Display the data
in port B
4107
EI
4108 MVI A,08 Enable RST5.5
4109
410A SIM
EI
410B HLT
Department of Electronics Stop the
& Communication Engineering Page 43
Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

program.

ISR (Interrupt Service Routine)

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


4200 START: IN C0 Read from port A
4201
4202 STA 4500 Store in 4500.
4203
4204
4205 HLT Stop the
program.

Sub program:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


405E JMP 4200 Go to 4200
405F
4060

BSR MODE (Bit Set Reset mode)

Any lines of port c can be set or reset individually without affecting other
lines using this mode. Let us set PC0 and PC3 bits using this mode.

Department of Electronics & Communication Engineering Page 44


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

PROGRAM:

ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS


4100 START: MVI A, 01 Set PC0
4101
4102 OUT C6 Send Mode
4103 Control word
4104 MVI A,07 Set PC3
4105
4106 OUT C6 Send Mode
4107 Control word
4109 HLT Stop the
program.

RESULT:
Thus 8255 are interfaced and their characteristic in mode0, mode1 and BSR
mode is studied.

POST EXPERIMENT QUESTIONS:


1. Define Control word.
2. Explain different I/O Modes?
3. Describe briefly about ISR.

Department of Electronics & Communication Engineering Page 45


Indian Institute of Information Technology, Bhopal
Microprocessor Lab (MP&MC-313) Manual (EEE, 5th Sem)

Department of Electronics & Communication Engineering Page 46

You might also like