You are on page 1of 35

List of Experiments

S.No. Experiments
1. a) Write a program using 8085 Microprocessor to add two Hexadecimal
numbers.
b) Write a program using 8085 Microprocessor to subtract two Hexadecimal
numbers.
2. a) Write a program using 8085 Microprocessor to add two decimal numbers.
b) Write a program using 8085 Microprocessor to subtract two decimal
numbers.
3. a) Write a program using 8085 Microprocessor to add two BCD numbers.
b) Write a program using 8085 Microprocessor to subtract two BCD
numbers.
4. Write a program to perform multiplication of two 8 bit numbers using 8085.
5. Write a program to perform division of two 8 bit numbers using 8085.
6. Write a program to find the smallest number in an array of data using 8085
instruction set.
7. Write a program to find the largest number in an array of data using 8085
instruction set.
8. Write a program to arrange an array of data in ascending order using 8085
instruction set.
9. Write a program to arrange an array of data in descending order using 8085
instruction set.
10. a) Write a program to convert given Hexadecimal number into its equivalent
ASCII number using 8085 instruction set.
b) Write a program to convert given ASCII number into its equivalent
Hexadecimal number using 8085 instruction set.
Course outcome:-

After the completion of the course, the students will be able to:

Cognitive
Course
Levels
outcome Course outcome Description
(Bloom’s
No.
Level)
Use techniques, skills, modern engineering tools, instrumentation
and software/hardware appropriately to learn and demonstrate
CO:1 K-3
arithmetic and logical operations on 8 bit data using 8085
microprocessor.
Analyse 8085 microprocessor and its interfacing with peripheral
CO:2 K-4
devices
Learn about various conversion techniques using 8085 and
CO:3 K-1
generate waveforms using 8085 microprocessor
CO:4 Learn programming concept of 8051 microcontroller K-1

Learn to interface peripheral devices with microcontroller so as


CO:5 K-6
to design microcontroller based projects
Experiment no.1
a) Write a program using 8085 Microprocessor to add two Hexadecimal Numbers.
b) Write a program using 8085 Microprocessor to subtract two Hexadecimal Numbers.

Apparatus required: - Following apparatus is required to perform the practical of 8085


microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

a) Flowchart/Algorithm:- For addition of two hexadecimal numbers

 The Ist number is in memory location 2501H.


 The 2nd number is in memory location 2502H.
 The result is to be stored in memory location 2503H.
Program:-

Memory Mnemonics Operands Op codes Comments


address
2000 LXI H,2501 21 Get address of memory address 2501H in
H-L pair
2001 01
2002 25
2003 MOV A,M 7E Move the contents (Ist number) of the
memory location whose address is in the
H-L register pair to Register A
2004 INX H 23 Increment H-L pair contents by one
2005 ADD M 86 Add the contents of the Accumulator and
the contents of the memory location
addressed by H-L pair.
2006 INX M 23 Increment H-L pair contents by one
2007 MOV M,A 77 Store the contents of Accumulator to
memory location addressed by H-L pair
2008 HLT 76 Stop

b) Flowchart/Algorithm:- For subtraction of two hexadecimal numbers

 The Ist number is in memory location 2501H.


 The 2nd number is in memory location 2502H.
 The result is to be stored in memory location 2503H.
Program:-

Memory Mnemonics Operands OP codes Comments


address
2000 LXI H,2501 21 Get address of memory address 2501H
in H-L pair
2001 01
2002 25
2003 MOV A,M 7E Move the contents (Ist number) of the
memory location whose address is in the
H-L register pair to Register A
2004 INX H 23 Increment H-L pair contents by one
2005 SUB M 86 Subtract the contents of the
Accumulator and the contents of the
memory location addressed by H-L
pair.
2006 INX M 23 Increment H-L pair contents by one
2007 MOV M,A 77 Store the contents of Accumulator to
memory location addressed by H-L pair
2008 HLT 76 Stop

Procedure /Steps to execute the program on Microprocessor Kit:-


Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:

1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the Program.
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL
4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-
Addition
2501 (Ist number) Result
2502 (2nd Number) 2503

Subtraction
2501 (Ist number) Result
2502 (2nd Number) 2503

Conclusion: - Thus the Addition and subtraction process of two hexadecimal numbers is taken
out using assembly language for 8085 microprocessor.
Experiment no.2
a) Write a program using 8085 Microprocessor to add two decimal Numbers.
b) Write a program using 8085 Microprocessor to subtract two decimal Numbers.

Apparatus Required: Following apparatus is required to perform the practical of 8085


microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

a) Flowchart/Algorithm:- For addition of two decimal numbers

 The Ist number is in memory location 2501H.


 The 2nd number is in memory location 2502H.
 The result is to be stored in memory location 2503H.
Program:-

Memory Mnemonics Operands OP codes Comments


address
2000 LXI H,2501 21,01,25 Get address of memory address 2501H in
H-L pair
2001 01
2002 25
2003 MOV A,M 7E Move the contents (Ist number) of the
memory location whose address is in the
H-L register pair to Register A
2004 INX H 23 Increment H-L pair contents by one
2005 ADD M 86 Add the contents of the Accumulator and
the contents of the memory location
addressed by H-L pair.
2006 DAA 27 Decimal adjust accumulator
2007 INX M 23 Increment H-L pair contents by one
2008 MOV M,A 77 Store the contents of Accumulator to
memory location addressed by H-L pair
2009 HLT 76 Stop

b) Flowchart/Algorithm:- For subtraction of two decimal numbers

 The Ist number is in memory location 2501H.


 The 2nd number is in memory location 2502H.
 The result is to be stored in memory location 2503H.
Program:-

Memory Mnemonics Operands OP codes Comments


address
2000 LXI H,2501 21 Get address of memory address 2501H in H-L
pair
2001 01
2002 25
2003 MOV A,M 7E Move the contents (Ist number) of the memory
location whose address is in the H-L register
pair to Register A
2004 INX H 23 Increment H-L pair contents by one
2005 SUB M 86 Subtract the contents of the Accumulator and
the contents of the memory location addressed
by H-L pair.
2006 DAA 27 Decimal adjust accumulator
2007 INX M 23 Increment H-L pair contents by one
2008 MOV M,A 77 Store the contents of Accumulator to memory
location addressed by H-L pair
2009 HLT 76 Stop

Procedure /Steps to execute the program on Microprocessor Kit :-


Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:

1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the Program.
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL
4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-
Addition
2501 (Ist number) Result
2502 (2nd Number) 2503

Subtraction
2501 (Ist number) Result
2502 (2nd Number) 2503

Conclusion:-Thus the Addition and subtraction process of two decimal numbers is taken out
using assembly language for 8085 microprocessor.
Experiment no.3
a) Write a program using 8085 Microprocessor to add two BCD Numbers.
b) Write a program using 8085 Microprocessor to subtract two BCD Numbers.

Apparatus Required: Following apparatus is required to perform the practical of 8085


microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

c) Flowchart/Algorithm:- For addition of two BCD numbers

 The Ist number is in memory location 2501H.


 The 2nd number is in memory location 2502H.
 The result is to be stored in memory location 2503H.
Program:-

Memory Mnemonics Operands OP codes Comments


address
2000 LXI H,2502 21 Get address of memory address 2501H
in H-L pair
2001 01
2002 25
2003 MOV A,M 7E Move the contents (Ist number) of the
memory location whose address is in the
H-L register pair to Register A
2004 INX H 23 Increment H-L pair contents by one
2005 ADD M 86 Add the contents of the Accumulator
and the contents of the memory location
addressed by H-L pair.
2006 DAA 27 Decimal adjust accumulator
2007 INX M 23 Increment H-L pair contents by one
2008 MOV M,A 77 Store the contents of Accumulator to
memory location addressed by H-L pair
2009 HLT 76 Stop

d) Flowchart/Algorithm:- For subtraction of two BCD numbers

 The Ist number is in memory location 2501H.


 The 2nd number is in memory location 2502H.
 The result is to be stored in memory location 2503H.
Program:-

Memory Mnemonics Operands OP Comments


address codes
2000 LXI H,2502 21 Get address of memory address 2501H in H-
L pair
2001 01
2002 25
2003 MOV A,M 7E Move the contents (Ist number) of the
memory location whose address is in the H-L
register pair to Register A
2004 INX H 23 Increment H-L pair contents by one
2005 SUB M 86 Subtract the contents of the Accumulator
and the contents of the memory location
addressed by H-L pair.
2006 DAA 27 Decimal adjust accumulator
2007 INX M 23 Increment H-L pair contents by one
2008 MOV M,A 77 Store the contents of Accumulator to
memory location addressed by H-L pair
2009 HLT 76 Stop

Procedure /Steps to execute the program on Microprocessor Kit :-


Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:

1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the Program.
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL
4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-
Addition
2501 (Ist number) Result
2502 (2nd Number) 2503

Subtraction
2501 (Ist number) Result
2502 (2nd Number) 2503

Conclusion:-Thus the Addition and subtraction process of two BCD numbers is taken out using
assembly language for 8085 microprocessor.
Experiment no.4
Write a program to perform multiplication of two 8 bit numbers using 8085.

Apparatus Required: Following apparatus is required to perform the practical of 8085


microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

a) Flowchart/Algorithm:- For Multiplication of two 8 bit numbers

1. This program multiplies two operands stored in memory location 3000H and 3001H,
using successive addition method.
2. In successive addition method, the second operand is considered as counter, and the
first number is added with itself until counter decrements to zero.
3. Let us assume that the operands stored at memory location 3000H is 02H and 3001H is
05H.
4. Then, by using successive addition method, we get 02H + 02H + 02H + 02H + 02H =
0AH.
5. Initially, H-L pair is loaded with the address of first memory location.
6. The first operand is moved to register B from memory location 3000H and H-L pair is
incremented to point to next memory location.
7. The second operand is moved to register C from memory location 3001H to act as
counter.
8. Accumulator is initialized to 00H.
9. Register B is added with accumulator and the result is stored in accumulator.
10. Register C (counter) is decremented by 1.
11. Then, counter is checked for zero. If it hasn’t become zero yet, then register B is again
added with accumulator, and counter is again checked for zero.
12. If counter becomes zero, then H-L pair is incremented and the result is moved from
accumulator to memory location 3002H.
Program:

Address Label Mnemonics Operand Opcode Remarks

2000 LXI H, 3000H 21 Load H-L pair with


address 3000H
2001 00 Lower-order of 3000H.
2002 30 Higher-order of 3000H.
2003 MOV B, M 46 Move the 1st operand from
memory to reg. B.
2004 INX H 23 Increment H-L pair.
2005 MOV C, M 4E Move the 2nd operand
from memory to reg. C.
2006 MVI A, 00H 3E Initialize accumulator with
00H.
2007 00 Immediate value 00H.
2008 NEXT: ADD B 80 Add B with A.
2009 DCR C 0D Decrement reg. C
(counter).
200A JNZ NEXT C2 Jump back to address
2008H if C ≠ 0.
200B 08 Lower-order of 2008H.
200C 20 Higher-order of 2008H.
200D INX H 23 Increment H-L pair.
200E MOV M, A 77 Move the result from
accumulator to memory.
200F HLT 76 Halt
Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-

Multiplication
(Before Execution) (After Execution)
3000H (Ist Number) 3002 Result
3001H (2nd Number)

Conclusion:-Thus the multiplication process is taken out using assembly language for 8085
microprocessor
Experiment no.5
Write a program to perform Division of two 8 bit numbers using 8085.

Apparatus Required: Following apparatus is required to perform the practical of 8085


microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

Flowchart/Algorithm: - The 8085 has no division instruction so to get the result of the division,
we should use the repetitive subtraction method
1. Start the program by loading HL register pair with address of memory location
2. Move the data to a register (B Register).
3. Get the second data and load into accumulator.
4. Compare the two numbers to check for carry.
5. Subtract the two numbers.
6. Increment the value of carry.
7. Check whether repeated subtraction is over and store the value of subtraction and carry
in memory location.
8. Terminate the program.
Program:-

Address Label Mnemonics Operand Op code Remarks


2000 LXI H, 21 Load the HL pair register with
3000H the address 3000H of memory
location
2001 00
2002 30
2003 MOV B, M 46 Copy the content of memory
location (3000H) into register
B (Get the divisor).

2004 MVI C,00 0E Clear C register for quotient


2005 00
2006 INX H 23 Increment the contents of H-L
register pair
2007 MOV A,M 7E Move the contents of memory
location 3001 into Accumulator
(Get dividend in A register)
2008 NEXT: CMP B B8 Compare A with B register
2009 JC LOOP DA Jump if carry to LOOP
200A 11
200B 20
200C SUB B 90 Subtract the contents of B from
A register
200D INR C 0C Increment the contents of C
200E JMP NEXT C3 Jump to NEXT
200F 08
2010 20
2011 LOOP: STA 3002 32 Store the remainder in memory
location 3002.
2012 02
2013 30
2014 MOV A,C 79 Copy the content of register C
into accumulator
2015 STA 3003 32 Store the quotient in memory
location 3003.
2016 03
2017 30
2018 HLT 76 Terminate the program
execution

Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-

Division
(Before Execution) (After Execution)
3000H (Ist Number) 3002 Result (Quotient)
3001H (2nd Number) 3003 (Remainder)

Conclusion:- Thus the Division process is taken out using assembly language for 8085
microprocessor.
Experiment no.6
Write a program to find the smallest number in an array of data using 8085.The length of the
block is in memory location 3000H and the block itself starts from memory location 3001H
and store the smallest number in memory location 3100.

Apparatus Required:- Following apparatus is required to perform the practical of 8085


microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table.

Flowchart/Algorithm: -

Program:-

Address Label Mnemonics Operand Op code Remarks


2000 LDA 3000 3A Load the contents of 3000
memory location to Accumulator
2001 00
2002 30
2003 MOV C,A 4F Move the contents of A to C
register
2004 LXI H,3001 21 Load immediately 3001 in
register pair H-L
2005 01
2006 30
2007 MOV A,M 7E Move the contents of memory
location pointed by H-L register
pair to A register.
2008 INX H 23 Increment the contents of H-L
register pair by 1
2009 BACK: CMP M BE Compare the contents of memory
location with the contents of A
200A JC SKIP DA Jump if carry to SKIP label
200B 0E
200C 20
200D MOV A,M 7E Move the contents of memory
location pointed by H-L register
pair to A register.
200E SKIP: INX H 23 Increment the contents of H-L
register pair by 1
200F DCR C 0D Decrement the contents of
Register C by 1
2010 JNZ BACK C2 Jump if not zero to BACK label
2011 09
2012 20
2013 STA 3100 32 Store the contents of A to
memory location 3100H
2014 00
2015 31
2016 HLT 76 Terminate the program
execution

Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL
3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT

Result:-

Smallest number
(Before Execution) (After Execution)
3000H (Length) 3100 (Smallest number)
3001H
3002H
:
:

Conclusion:- Thus the smallest number is find out in an array of data using 8085 instruction set.
Experiment no.7
Write a program to find the largest number in an array of data using 8085.The length of the
block is in memory location 3000H and the block itself starts from memory location 3001H
and store the largest number in memory location 3100.
Apparatus Required: Following apparatus is required to perform the practical of 8085
microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table
Flowchart/Algorithm:-

Program:-
Address Label Mnemonics Operand Op code Remarks
2000 LDA 3000 3A Load the contents of 3000 to A
register.
2001 00
2002 30
2003 MOV C,A 4F Move the contents of A to C
register.
2004 LXI H,3001 21 Load immediately 3001 in H-L
register pair.
2005 01
2006 30
2007 MOV A,M 7E Move the contents of Memory to
A register
2008 INX H 23 Increment the contents of H-l
register pair by 1
2009 BACK: CMP M BE Compare the contents of
Memory location with the
contents of A
200A JNC SKIP D2 Jump if not carry to Label SKIP
200B 0E
200C 20
200D MOV A,M 7E Move the contents of Memory to
A register
200E SKIP: INX H 23 Increment the contents of H-l
register pair by 1
200F DCR C 0D Decrement the contents of C
register.
2010 JNZ BACK C2 Jump if not zero to label BACK
2011 09
2012 20
2013 STA 3100 32 Store the contents of A in
memory location 3100.
2014 00
2015 31
2016 HLT 76 Terminate the program
execution

Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-

Largest number
(Before Execution) (After Execution)
3000H (Length) 3100 (Largest number)
3001H
3002H
:
:

Conclusion:- Thus the Largest number is find out in an array of data using 8085 instruction set.
Experiment no.8
Write a program to arrange an array of data in ascending order using 8085 instruction set.
Apparatus Required:-Following apparatus is required to perform the practical of 8085
microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table
Flowchart/Algorithm:-
Program:-
Address Label Mnemonics Operand Op code Remarks
2000 LXI H,3000H 21 Set pointer for array
2001 00
2002 30
2003 MOV C,M 4E Load the count value.
2004 DCR C 0D Decrement counter.
2005 Repeat: MOV D,C 51
2006 LXI H, 3001H 21 Set the memory pointer for data
2007 01
2008 30
2009 Loop: MOV A,M 7E Move the number into accumulator
200A INX H 23 Increment the H-L register
200B CMP M BE Compare the contents of accumulator
with the contents of memory location
specified by H-L register pair.
200C JC SKIP DA Jump if carry to SKIP
200D 14
200E 20
200F MOV B,M 46 Move the contents of memory
location specified by H-L register
pair to register B.
2010 MOV M,A 77 Move the contents of Accumulator to
memory location specified by H-L
register pair.
2011 DCX H 2B Decrement the contents of H-L
register pair
2012 MOV M,B 70 Move the contents of register B to
memory location specified by H-L
register pair.
2013 INX H 23 Increment the contents of H-L
register pair
2014 SKIP: DCR D 15 Decrement the contents of D register.
2015 JNZ LOOP C2 Jump if not zero to LOOP
2016 09
2017 20
2018 DCR C 0D Decrement the contents of Register
C.
2019 JNZ REPEAT C2 Jump if not zero to REPEAT.
201A 05
201B 20
201C HLT 76 Terminate the program

Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result
1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-

(Before Execution) (After Execution)


3000H (COUNT VALUE) 3000H
3001H 3001H
3002H 3002H
3003H 3003H
3004H 3004H
3005H 3005H

Conclusion: - Thus the given array of data was arranged in ascending order.
Experiment no.9

Write a program to arrange an array of data in Descending order using 8085 instruction set.
Apparatus Required:-Following apparatus is required to perform the practical of 8085
microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

Flowchart/Algorithm:-
Program:-

Address Label Mnemonics Operand Op code Remarks


2000 LXI H,3000H 21 Set pointer for array
2001 00
2002 30
2003 MOV C,M 4E Load the count value.
2004 DCR C 0D Decrement counter.
2005 Repeat: MOV D,C 51
2006 LXI H, 3001H 21 Set the memory pointer for data
2007 01
2008 30
2009 Loop: MOV A,M 7E Move the number into accumulator
200A INX H 23 Increment the H-L register
200B CMP M BE Compare the contents of accumulator
with the contents of memory location
specified by H-L register pair.
200C JNC SKIP DA Jump if not carry to SKIP
200D 14
200E 20
200F MOV B,M 46 Move the contents of memory
location specified by H-L register
pair to register B.
2010 MOV M,A 77 Move the contents of Accumulator to
memory location specified by H-L
register pair.
2011 DCX H 2B Decrement the contents of H-L
register pair
2012 MOV M,B 70 Move the contents of register B to
memory location specified by H-L
register pair.
2013 INX H 23 Increment the contents of H-L
register pair
2014 SKIP: DCR D 15 Decrement the contents of D register.
2015 JNZ LOOP C2 Jump if not zero to LOOP
2016 09
2017 20
2018 DCR C 0D Decrement the contents of Register
C.
2019 JNZ REPEAT C2 Jump if not zero to REPEAT.
201A 05
201B 20
201C HLT 76 Terminate the program

Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT
Result:-

(Before Execution) (After Execution)


3000H (COUNT VALUE) 3000H
3001H 3001H
3002H 3002H
3003H 3003H
3004H 3004H
3005H 3005H

Conclusion: - Thus the given array of data was arranged in Descending order.
Experiment no.10
a) Write a program to convert given hexadecimal number into its equivalent ASCII number
using 8085 instruction set.
b) Write a program to convert given ASCII number into its equivalent hexadecimal number
using 8085 instruction set.
Apparatus Required: Following apparatus is required to perform the practical of 8085
microprocessor:
1. 8085 Microprocessor Kit
2. Power Supply
3. Instruction Manual
4. Op code Table

a) Flowchart/Algorithm:- Hexadecimal number to ASCII code


1. Load the HEX value in to the accumulator.
2. Compare the number with 0A.
3. If number < 0A then jump to step 7.
4. Add 07H with the number and store the result in the accumulator.
5. Store the result in memory.
6. Terminate the program.
Program:-
Address Label Mnemonics Operand Op code Remarks
2000 LXI H 3000 21 Load immediately H-L register pair
with 3000 memory location
2001 00
2002 30
2003 LXI D 4000 11 Load immediately D-E register pair
with 3000 memory location
2004 00
2005 40
2006 MOV A,M 7E Move the contents of memory to A
register
2007 CPI 0A FE Compare immediately 0A with the
contents of A register
2008 0A
2009 JC SKIP DA Jump if carry
200A 0E
200B 20
200C ADI 07 C6 Add immediately 07 with the
contents of A register
200D 07
200E SKIP ADI 30H C6 Add immediately 30 with the
contents of A register
200F 30
2010 STAX D 12 Store the contents of Accumulator in
the memory location pointed by D-E
register pair.
2011 HLT 76 Terminate the program.
b) Flowchart/Algorithm:- ASCII code to hexadecimal number
1. Input the content of 3000 in accumulator.
2. Subtract 30H from accumulator.
3. Compare the content of accumulator with 0AH.
4. If content of accumulator is less than 0A then goto step 6 else goto step 5.
5. Subtract 07H from accumulator.
6. Store content of accumulator to memory location 3050.
7. Terminate the program.

Program:-
Address Label Mnemonics Operand Op code Remarks
2000 LDA 3000 3A Load contents of A register from
3000 memory location
2001 00
2002 30
2003 SUI 30 D6 Subtract immediately 30h from A
register contents.
2004 30
2005 CPI 0A FE Compare immediately 0A with A
register contents
2006 0A
2007 JC SKIP DA Jump if carry
2008 0C
2009 20
200A SUI 07 D6 Subtract immediately 07h from
register A contents.
200B 07
200C SKIP STA 3000 32 Store the contents of A register in
memory location 3000.
200D 00
200E 30
200F HLT 76 Terminate the program.

Steps to Execute the Program on 8085 Microprocessor Kit:-

Follow the steps given below in order to execute the program on 8085 Microprocessor Kit:
1. Enter Program
2. Enter Data
3. Execute Program
4. Check Result

1. Enter Program
a. Press RESET
b. Press 1A
c. Enter starting address of the program
d. Press NEXT
e. Start entering the program
f. Press NEXT

2. Enter Data
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter the address of operand
d. Press NEXT
e. Enter data
f. Press FILL

3. Execute Program
a. Press RESET
b. Press GO
c. Enter starting address of the program
d. Press FILL

4. Check Result
a. Press RESET
b. Press EXAMINE MEMORY (EXMEM)
c. Enter address of result
d. Press NEXT

Result:-

Hexadecimal to ASCII number ASCII to Hexadecimal number

Conclusion:- Given hexadecimal number is converted into its equivalent ASCII number and
vice versa using 8085 instruction set.

You might also like