You are on page 1of 13

JAIPUR NATIONAL UNIVERSITY, JAIPUR

School of Engineering and Technology (SADTM Campus)

Department of Computer Science Engineering

8085 - MICROPROCESSORS LAB MANUAL

Prepared by: Anil Agarwal


List of Experiments
8085 Programming

1. Introduction to 8085
2. 8 bit Addition and Subtraction
3. 8 bit Multiplication and Division
4. 16 bit Addition and Subtraction
5. 16 bit Multiplication and Division
6. Largest and Smallest number in an array
7. Sorting in Ascending and Descending Order
8. Code Conversions using 8085
9. BCD Addition and Subtraction
10. Matrix Multiplication
11. Fibonacci Series
12. Factorial of N Data
13. Palindrome
14. Sum of Series
15. Square Root
Interfacing
1. Interfacing 8255 PPI IC with 8085
2. Interfacing 8253 Timer IC with 8085
3. Interfacing 8279 Keyboard Display IC with 8085

7(A). ASCENDING ORDER

AIM:
To sort the given number in the ascending order using 8085 microprocessor.
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 I
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.

FLOWCHART:
START

[B] 04H

[HL] [2100H]
[A] [HL]

[HL [HL] + 1

IS
[A] < [HL]?

[D] [HL]

[HL] [A]

YES [HL] [HL] - 1

NO
[HL] [D]

[HL] [HL] + 1

[C] [C] – 01 H

IS
[C] = 0?
[B] [B]-1

IS
[B] = 0?

NO

STOP
YES

NO

YES

PROGRAM:

ADDR OPCO LABEL MNEM OPER COMMENTS


E DE ONICS AND
SS
2000 MVI B,04 Initialize B reg with number
2001 of comparisons (n-1)
2002 LOOP 3 LXI H,2100 Initialize HL reg. to
2003 2100H
2004
2005 MVI C,04 Initialize C reg with no. of
2006 comparisons (n-1)
2007 LOOP2 MOV A,M Transfer first data to acc.
2008 INX H Increment HL reg. to point
next memory location
2009 CMP M Compare M & A
200A JC LOOP1 If A is less than M then go to
200B loop1
200C
200D MOV D,M Transfer data from M to D reg
200E MOV M,A Transfer data from acc to M
200F DCX H Decrement HL pair
2010 MOV M,D Transfer data from D to M
2011 INX H Increment HL pair
2012 LOOP1 DCR C Decrement C reg
2013 JNZ LOOP2 If C is not zero go to loop2
2014
2015
2016 DCR B Decrement B reg
2017 JNZ LOOP3 If B is not Zero go to loop3
2018
2019
201A HLT Stop the program

OBSERVATION:

INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
2100 09 2100 01
2101 07 2101 03
2102 05 2102 05
2103 03 2103 07
2104 01 2104 09
7(B). DESCENDING ORDER

AIM:
To sort the given number in the descending order using 8085 microprocessor.
ALGORITHM:

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


2. Compare the first two numbers and if the first number is smaller than second then I
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.

FLOWCHART:
START

[B] 04H

[HL] [2100H]
[A] [HL]

[HL [HL] + 1

IS
[A] < [HL]?

[D] [HL]

[HL] [A]

NO [HL] [HL] - 1

YES
[HL] [D]

[HL] [HL] + 1

[C] [C] – 01 H

IS
[C] = 0?
[B] [B]-1

IS
[B] = 0?

NO

STOP
YES

NO

YES

PROGRAM:

ADDR OPCO LABEL MNEM OPER COMMENTS


E DE ONICS AND
SS
2000 MVI B,04 Initialize B reg with number
2001 of comparisons (n-1)
2002 LOOP 3 LXI H,2100 Initialize HL reg. to
2003 2100H
2004
2005 MVI C,04 Initialize C reg with no. of
2006 comparisons(n-1)
2007 LOOP2 MOV A,M Transfer first data to acc.
2008 INX H Increment HL reg. to point
next memory location
2009 CMP M Compare M & A
200A JNC LOOP1 If A is greater than M then go
200B to loop1
200C
200D MOV D,M Transfer data from M to D reg
200E MOV M,A Transfer data from acc to M
200F DCX H Decrement HL pair
2010 MOV M,D Transfer data from D to M
2011 INX H Increment HL pair
2012 LOOP1 DCR C Decrement C reg
2013 JNZ LOOP2 If C is not zero go to loop2
2014
2015
2016 DCR B Decrement B reg
2017 JNZ LOOP3 If B is not Zero go to loop3
2018
2019
201A HLT Stop the program

OBSERVATION:

INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
2100 01 2100 09
2101 03 2101 07
2102 05 2102 05
2103 07 2103 03
2104 09 2104 01

Experiment No. - 8

AIM:
Write a program to search a number in an array and finding its parity using 8085
microprocessor.

ALGORITHM:

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


2. Compare the first two numbers and if the first number is smaller than second then I
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 program to search a number in an array and finding its parity using 8085
microprocessor is executed.

PROGRAM:

ADDRE OPCO LABEL MNEM OPER COMMENTS


SS DE ONICS AND
2000 LXI H,2100 Initialize HL reg. to
2001 2100H
2002
2003 MOV C,M Initialize C reg with no. of Data
2004 MVI B,0A Insert the no. to search in B reg.
2005
2006 INX H Increment HL reg. to point next
memory location
2007 LOOP1 MOV A,M Transfer first data to acc.
2008 CMP B Compare B & A
2009 JZ LOOP Jump if zero flag is set to LOOP
200A
200B
200C DCR C Decrement C reg
200D INX H Increment HL reg. to point next
memory location
200E JMP LOOP1 Unconditionally Jump to LOOP1
200F
2010
2011 LOOP ANI FF AND A data with FF to find the
2012 parity
2013 JPE LOOP2 If parity is even then go to LOOP2
2014
2015
2016 STA 2200 Store A content to memory location
2017 2200
2018 [if parity is odd]
2019 JMP LOOP3 Unconditionally Jump to LOOP3
201A
201B
201C LOOP2 STA 2201 Store A content to memory location
201D 2201
201E [if parity is even]
201F LOOP 3 HLT Stop the program

OBSERVATION:

No. searching in an array (B – Register) = 0A


INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
2100 05 (No. of Data)
2101 02 2200 [Odd Parity Output]
2102 04 2201 0A [Even Parity Output]
2103 09
2104 0A
2105 0C

0000 1010
*1111 1111
--------------
0000 1010
--------------
Parity is Even, because no. of one’s is even.

You might also like