8085 Microprocessor Programs: Microprocessor & Microcontroller Lab Manual
8085 Microprocessor Programs: Microprocessor & Microcontroller Lab Manual
8085 MICROPROCESSOR
PROGRAMS
1
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
ALGORITHM:
PROGRAM:
OBSERVATION:
Input: 80 (4150)
80 (4251)
Output: 00 (4152)
01 (4153)
RESULT:
2
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
ALGORITHM:
PROGRAM:
MVI C, 00 Initialize C to 00
LDA 4150 Load the value to Acc.
MOV B, A Move the content of Acc to B register.
LDA 4151 Load the value to Acc.
SUB B
JNC LOOP Jump on no carry.
CMA Complement Accumulator contents.
INR A Increment value in Accumulator.
INR C Increment value in register C
LOOP: STA 4152 Store the value of A-reg to memory address.
MOV A, C Move contents of register C to Accumulator.
STA 4153 Store the value of Accumulator memory address.
HLT Terminate the program.
3
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
Input: 06 (4150)
02 (4251)
Output: 04 (4152)
01 (4153)
RESULT:
4
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
ALGORITHM:
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) Add the two register contents.
5) Check for carry.
6) Increment the value of carry.
7) Check whether repeated addition is over and store the value of product and carry
in memory location.
8) Terminate the program.
PROGRAM:
5
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
Input: FF (4150)
FF (4151)
Output: 01 (4152)
FE (4153)
RESULT:
6
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
ALGORITHM:
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 product and
carry in memory location.
8) Terminate the program.
PROGRAM:
LXI H, 4150
MOV B, M Get the dividend in B – reg.
MVI C, 00 Clear C – reg for qoutient
INX H
MOV A, M Get the divisor in A – reg.
NEXT: CMP B Compare A - reg with register B.
JC LOOP Jump on carry to LOOP
SUB B Subtract A – reg from B- reg.
INR C Increment content of register C.
JMP NEXT Jump to NEXT
LOOP: STA 4152 Store the remainder in Memory
MOV A, C
STA 4153 Store the quotient in memory
HLT Terminate the program.
7
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
Input: FF (4150)
FF (4251)
RESULT:
8
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
To find the largest number in an array of data using 8085 instruction set.
ALGORITHM:
PROGRAM:
9
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
Output: FE (4300)
RESULT:
Thus the program to find the largest number in an array of data was executed
10
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
To find the smallest number in an array of data using 8085 instruction set.
ALGORITHM:
PROGRAM:
11
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
Output: 0A (4300)
RESULT:
Thus the program to find the smallest number in an array of data was executed
12
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
ALGORITHM:
PROGRAM:
LXI H,4200
MOV C,M
DCR C
REPEAT: MOV D,C
LXI H,4201
LOOP: MOV A,M
INX H
CMP M
JC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT
13
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
RESULT:
14
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
AIM:
ALGORITHM:
PROGRAM:
LXI H,4200
MOV C,M
DCR C
REPEAT: MOV D,C
LXI H,4201
LOOP: MOV A,M
INX H
CMP M
JNC SKIP
MOV B,M
MOV M,A
DCX H
MOV M,B
INX H
SKIP: DCR D
JNZ LOOP
DCR C
JNZ REPEAT
HLT
15
MICROPROCESSOR & MICROCONTROLLER LAB MANUAL
OBSERVATION:
RESULT:
16