0% found this document useful (0 votes)
44 views5 pages

Dr. B.R. Ambedkar National Institute of Technology, Jalandhar

This document contains a lab assignment submitted by students to their professor for a microprocessor and interfacing course. The assignment asks students to write a program to arrange 10 given numbers in ascending order using an 8085 microprocessor. It includes the aim, required platform, algorithm, program sequence in mnemonics, flowchart, sample output, and result. The program uses counters and compares/swaps numbers in memory locations to sort the numbers from lowest to highest.

Uploaded by

Pranav Shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views5 pages

Dr. B.R. Ambedkar National Institute of Technology, Jalandhar

This document contains a lab assignment submitted by students to their professor for a microprocessor and interfacing course. The assignment asks students to write a program to arrange 10 given numbers in ascending order using an 8085 microprocessor. It includes the aim, required platform, algorithm, program sequence in mnemonics, flowchart, sample output, and result. The program uses counters and compares/swaps numbers in memory locations to sort the numbers from lowest to highest.

Uploaded by

Pranav Shukla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

DR. B.R.

AMBEDKAR NATIONAL INSTITUTE OF


TECHNOLOGY, JALANDHAR

MICROPROCESSOR AND INTERFACING LAB


LAB ASSIGNMENT 7

SUBMITTED TO:
DR. SATHIYA S

SUBMITTED BY:
 PARTH SHINH
18106052
 PIYUSH GUPTA
18106053
 PRABHLEEN KAUR
18106054
ICE 3RD Year

Group: G3-C
QUESTION 1:
 AIM:
Write a program sequence to arrange given 10 numbers in ascending order.

 PLATFORM REQUIRED:
SIM 8085

 ALGORITHM OF THE PROGRAM:

1. Initialize two counters. As here are 10 numbers so set both counters to 09H.
2. Load H-L pair with address where series of given numbers is stored as here
0000H.
3. Move the content from memory to Accumulator.
4. Increment H-L pair and compare both the numbers (in memory and AC).
5. If the number in Accumulator is less or equal to next number (in H-L pair),
then don’t interchange otherwise swap the numbers.
6. Decrement counter 2.
7. Repeat these steps (from step 3) until counter 2 reaches to zero.
8. If counter 2 = 0, then decrement counter 1.
9. Repeats all these till counter 1 reaches to zero.
10. Terminate the program.

 PROGRAM SEQUENCE IN MNEMONICS:

MVI B,09H
L3:MVI C,09H
LXI H,0000H
L1:MOV A,M
INX H
CMP M
JC L2
JZ L2
MOV D,M
MOV M,A
DCX H
MOV M,D
INX H
L2:DCR C
JNZ L1
DCR B
JNZ L3
HLT
 FLOWCHART:

START

Initialize Counter 1

Initialize Counter 2 and H-L


pair

Move no. from memory to AC

Increment H-L pair

Compare number in memory


with number in accumulator
N
O

If N
A>M O
HLT

Y Y
E E
S S

Interchange the
numbers If
Counter
1 =0

NO Increment H-L pair

If
Decrement Counter 2 Counter2 Decrement
YES
=0 Counter 1
 PROGRAM OUTPUT:
 RESULT:
Given numbers are sorted in ascending order.

You might also like