How to arrange numbers in Descending order using Microprocessor 8085 program

TANSCHE third year B.Sc physics practical program to arrange a set of numbers in descending order using microprocessor 8085

In the third year of the B.Sc. Physics practical curriculum under TANSCHE, it's crucial to grasp how microprocessors work. One important experiment features the Microprocessor 8085, which is a popular 8-bit processor. In this experiment, students get to practice basic arithmetic operations.

This blog post will highlight the experiment where students arrange a series of numbers in descending order using the Microprocessor 8085. This hands-on activity helps students dive into the essential functions of the 8085 microprocessor, as well as programming logic and memory management. By completing this task, you'll develop a clear understanding of how the 8085 processes data and performs arithmetic functions, laying a strong groundwork in microprocessor systems.

Microprocessor 8085 program to arrange numbers in Descending order

Aim:

Write an assembly language program to arrange a set of numbers in descending order using microprocessor 8085.

Apparatus required:

Microprocessor 8085 kit, power supply etc

Program:

Descending order - Main program

Memory address

Machine code

Mnemonics

Operands

Comments

8000

11

LXI

D, 8601H

Memory location to store the result

8001

01

8002

86

8003

21

LXI

H, 8500H

Count address in H-L pair

8004

00

8005

85

8006

46

MOV

B, M

Move data in memory to B

8007

CD

CALL

8200H

Call the subroutine in 8200H

8008

00

8009

82

800A

12

STA

D

Store the result

800B

CD

CALL

8050H

Call the subroutine in 8050H

800C

50

800D

80

800E

13

INR

D

Increment D register

800F

05

DCR

B

Decrement B register

8010

C2

JNZ

8007H

Is B non-zero? Jump to 8007H

8011

07

8012

80

8013

76

HLT

Stop the program

Subroutine 1:

Memory address

Machine code

Mnemonics

Operands

Comments

8200

21

LXI

8500H

Count address

8201

00

8202

85

8203

4E

MOV

C, M

Count in C register to check whether all numbers have been compared

8204

97

SUB

A

Make content of accumulator zero

8205

23

INX

H

Get the next number

8206

BE

CMP

M

Compare memory with accumulator

8207

D2

JNC

820BH

Is it the largest number in the accumulator? Go to 820BD

8208

0B

8209

82

820A

7E

MOV

A, M

Get smallest number in the accumulator

820B

0D

DCR

C

Decrement the count register

820C

C2

JNZ

8205H

Is C non-zero? Go to 8205H

820D

05

820E

82

820F

C9

RET

Return to main program

Subroutine 2:

Memory address

Machine code

Mnemonics

Operands

Comments

8050

21

LXI

8500H

Count address

8051

00

8052

85

8053

4E

MOV

C, M

Count in C register to check whether all numbers have been compared

8054

23

INX

H

Get the next number

8055

BE

CMP

M

Compare memory with accumulator

8056

CA

JZ

805D

Is it the larger number in the accumulator? Go to 805D

8057

5D

8058

80

8059

0D

DCR

C

Decrement the count register

805A

C2

JNZ

8054H

Is C non-zero? Go to 8054H

805B

54

805C

80

805D

3E

MVI

A, 00

Store accumulator by 00

805E

00

805F

77

MOV

M, A

Replace the largest number by 00

8060

C9

RET

Return to main program

Example:

Arranging in descending order

        Number of data in a array 8500H - 06

First input location 8501H - 23H

Second input location 8502H - 21H

Third input location 8503H - 14H

Fourth input location 8504H - 10H

Fifth input location 8505H - 04H

Sixth input location 8506H - 18H

Result location

8601H - 23H

8602H - 21H

8603H - 18H

8604H - 14H

8605H - 10H

8606H - 04H

Procedure:

Result: 

The assembly programmes for microprocessor 8085 to arrange a set of numbers in descending order was written and executed using the microprocessor 8085 kit.

Click here for Ascending order


For further reference:
External site

Post a Comment

0 Comments