Documente Academic
Documente Profesional
Documente Cultură
Microprocessor
Unit-5
Unit-5 8085
8085 Assembly
Microprocessor && Interfacing
Assembly Programs
Interfacing
Programs 2150707 1
-- 2150707 Darshan
Darshan
DarshanInstitute
Darshan Institute
Instituteof
Institute of
ofEngineering
of Engineering
Engineering&
Engineering &
&Technology
& Technology
Technology
Technology
Subject Overview
Sr. No. Unit % Weightage
1 Introduction to Microprocessor 8%
2 Microprocessor Architecture and Operations 7%
3 8085 Microprocessor 10%
4 Assembly Language Basics 10%
5 8085 Assembly Language Programs 10%
6 Stack & Subroutines 10%
7 I/O Interfacing 15%
8 Advanced Microprocessors 20%
9 SUN SPARC Microprocessor 5%
10 ARM Processor 5%
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 2 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program to add two 8-bit number (consider carry bit)
Accumulator <- ABh
B <- ACh
YES
Carry? Increment Result
NO
Display Result
End
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 3 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program to add two 8-bit number with carry
1. MVI A, ABh
2. MVI B, ACh
3. ADD B ; A=A+B
4. JC L1 ; if CY=1
5. JNC L2 ; if CY=0
7. L2:HLT
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 4 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Exercise
Write a program to subtract two 8-bit number
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 5 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program to exchange the data at 1501H & 1502H memory
location.
1. LDA 1501 ;load A <- M[1501]
2. MOV B,A ; B <- A
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 6 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program for reverse counter and display result in output
port1
Initialize counter
A <- 0Ah
C <- 00h
Decrement Counter
YES
Counter 0
No
Halt
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 7 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program for reverse counter and display result in output
port1
1. MVI A,0A
2. MVI C,00
3. L1: OUT 01 ; display content of accumulator
4. DCR A ; decrement accumulator
5. CMP C ; compare C with accumulator
6. JNZ L1 ; if Z 0
7. JZ L2 ; if Z = 0
8. L2: HLT
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 8 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program to Set PSW (Accumulator & 5 Flags)
1. LXI H, FFFF
2. PUSH H
5. PUSH H
6. POP PSW
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 9 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Exercise
1. Memory Location 2050H holds databyte F7H. Write an
instruction to transfer data byte to Accumulator using 3
different Opcodes: MOV, LDAX, LDA
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 10 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Write a program to add the content of M[2040H] with A,
Subtract M[2041H] from add result.
Assume
A=30H
M[2040]=68H
M[2041]=7FH
PROGRAM:
1. LXI H,2040
2. ADD M ; A=A+M[2040]
3. INX H ; HL=HL+1
4. SUB M ; A=A-M[2041]
5. HLT
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 11 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
WAP to add 10 bytes starting from 3001h to 300Ah. Use register B to
save any carries generated, while adding data bytes. Display result to
output port 01h and store at M[300B].
Registers Memory
03 3001
A Result 04 3002
09 .
B Carry Counter C 06 .
D E D2
.
08
H L F7
A5
02
E3 300A
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 12 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
1. MVI A,00
Start
2. MVI B,00
WAP to add 10 bytes starting from 3001h to 300Ah.
3. MVI C,0A
Clear Reg. to save Result 4. LXI H,3001
Clear Reg. to save Carry 5. L1:ADD M
Set Counter 6. JC C1
Set m/m Pointer 7. L2:INX H
8. DCR C
Sum = Sum + Pointer 9. JNZ L1
10. JZ END
NO Is there 11.C1: INR B
Carry? 12. JMP L2
YES 13.END:OUT 01
14.STA 300B
Carry= Carry + 1
15.HLT
Pointer=Pointer + 1
Counter = Counter -1 End
Registers Memory
03 3001
A Result 04 3002
09 .
B Counter C 06 .
D E D2
.
08
H L F7
A5
02
E3 300A
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 14 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Start 1. MVI A,00
2. MVI C,0A
Clear Reg. to save Result 3. LXI H,3001
WAP to fnd largest number from 3001h to 300Ah.
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 16 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
WAP to find odd and even numbers in given array of 10 elements
starting from 2001H and perform addition of Odd and Even number
respectively.
Data=05h RRC
A:Accumulator
D7 D6 D5 D4 D3 D2 D1 D0
0 0 0 0 0 1 0 11
0 0 0 0 0 1 0
CY
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 17 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
Start 1. MVI B,00;StoreODD
2. MVI D,00;StoreEVEN
B <- 00h 3. MVI C,0A;Counter
D<- 00h 4. LXI H,0001;Pointer
C <- 0Ah 5. L1: MOV A,M
WAP to fnd sum of ODD and EVEN number.
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 19 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Exercise
WAP to find number of 1s and 0s of 8-bit number stored at
M[2010]
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 20 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology
8085 Assembly Program
Exercise
WAP to multiply two 8-bit numbers.
WAP to arrange an array of 10 numbers starting from 3001 to
300A in descending order.
WAP to eliminate duplicate entry from an array of 10 numbers.
Unit-5
Unit-5 8085
8085 Assembly
Assembly Programs
Programs 21 Darshan
Darshan Institute
Institute of
of Engineering
Engineering &
& Technology
Technology