0% found this document useful (0 votes)
28 views46 pages

MPI Lab Manual Teacher

Uploaded by

Smit Anjana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views46 pages

MPI Lab Manual Teacher

Uploaded by

Smit Anjana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 46

SARDAR PATEL EDUCATION CAMPUS

SARDAR PATEL COLLEGE OF ENGINEERING


(SPCE), BAKROL-124

GUJARAT TECHNOLOGICAL UNIVERSITY


BACHELOR OF ENGINEERING

DEPARTMENT OF COMPUTER ENGINEERING

MICROPROCESSOR & INTERFACING

(3160712)

6th Semester

LABORATORY MANUAL
SARDAR PATEL COLLEGE OF ENGINEERING
BAKROL, ANAND

CERTIFICATE

This is to certify that Mr./Miss. ________________________________

of_______________________Enrollment No.____________________
has satisfactorily completed his/her term work in the subject
______________________________________ for the term ending in
_____________________ 20 /20 .

Date: ________

Signature of Teacher Head of Department


TABLE OF CONTENT

Experiment Experiment Submission


SR NO Sign
Title Date Date
Write an 8085 Assembly Language Program
1 (ALP) for exchanging two 8 bit numbers stored
on Memory Locations 2050 H and 2051 H.
Write an 8085 Assembly Language Program
(ALP) to add two 8 bit numbers stored on
2
Memory Locations 2050 H and 2051 H and store
result on Memory Location 2052 H.
Write an 8085 Assembly Language Program
3 (ALP) to add two 16 bit numbers stored on
memory.
Write an 8085 assembly language program to find
4
the minimum from two 8-bit numbers.
Write an 8085 assembly language program to get
5
the minimum from block of N 8-bit numbers.
Write an 8085 assembly language program to add
6
block of 8-bit numbers.
Write an 8085 ALP to find even and odd number
7
from array and store them.
Write an 8085 assembly language program to add
8
two decimal numbers using DAA instruction.
Write an 8085 ALP to find even and odd number
9
from array and store them.
Write an 8085 Assembly Language Program
10 (ALP) to find 1’s binary representation of a given
8 bit number.
Write an 8085 Assembly Language Program
(ALP) to arrange an array of six data bytes in an
11
ascending order. An array of six data bytes is
stored on Memory Location 5000 H onwards.
Write an 8085 Assembly Language Program
(ALP) to find 2’s complement of a given 8 bit
12 number stored on Memory Location 8051 H and
store the result (complimented number) on
Memory Location 8050 H.
Write an 8085 ALP to reverse an array of 8-bit
13
numbers
Write an 8085 Assembly Language Program
(ALP) to multiply two numbers stored on
14
Memory Locations 8000 H and 8001 H and store
the result on Memory Location 8050 H.
Write an 8085 ALP to convert BCD to binary
15
number.
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 1

Aim: Write an 8085 Assembly Language Program (ALP) for exchanging two 8 bit numbers
stored on Memory Locations 2050 H and 2051 H

Code:

MVI A,02h // Move 02h 8-bit data in Accumulator (A)

STA 2050h // Store Content of Accumulator (02) at Memory Location 2050

MVI A,03h // Move 03h 8-bit data in Accumulator (A)

STA 2051h // Store Content of Accumulator (03) at Memory Location 2051

LDA 2050h // Load Data (03) from Memory Location 2050 into A.

MOV B, A // Move Content of Accumulator (03) into Register B

LDA 2051h // Load Data (02) from Memory Location 2051 into A.

STA 2050h // Store Content of Accumulator (02) at Memory Location 2050

MOV A, B // Move Content of Register B (03) into Accumulator

STA 2051h // Store Content of Accumulator (03) at Memory Location 2051

HLT // End of Program

Input:

Memory Location Value


2050 02h
2051 03h

1
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Output:

Memory Location Value


2050 03h
2051 02h

Questions:

Q.1 What is meant by the statement that 8085 is a 8-bit microprocessor?

Q.2 What is the operating frequency of 8085?

Q.3 List the various registers of 8085.

Teacher Signature
2
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 2

Aim: Write an 8085 Assembly Language Program (ALP) to add two 8 bit numbers stored on
Memory Locations 2050 H and 2051 H and store result on Memory Location 2052 H.

Code:

MVI A,02h // Move 02h 8-bit data in Accumulator (A)

STA 2050h // Store Content of Accumulator (02) at Memory Location 2050

MVI A,03h // Move 03h 8-bit data in Accumulator (A)

STA 2051h // Store Content of Accumulator (03) at Memory Location 2051

LDA 2050h // Load Data (03) from Memory Location 2050 into A.

MOV B, A // Move Content of Accumulator (03) into Register B.

LDA 2051h // Load Data (02) from Memory Location 2051 into A.

ADD B // Add Content of Register B (03) & Content of A (02).

STA 2052h // Store Content of Accumulator (05) at Memory Location 2052

HLT // End of Program

Input:

Memory Location Value


2050 02h
2051 03h

3
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Output:
Memory Location Value
2052 05h

Questions:

Q.1 what is an instruction?

Q.2 In how many categories the instructions of 8085 be classified?

Q.3 what are the different instruction word sizes in 8085?

Teacher Signature
4
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 3

Aim: Write an 8085 Assembly Language Program (ALP) to add two 16 bit numbers stored on
memory

Code:

MVI A,02h // Move 02h 8-bit data in Accumulator (A)

STA 2050h // Store Content of Accumulator (02) at Memory Location 2050

MVI A,03h // Move 03h 8-bit data in Accumulator (A)

STA 2051h // Store Content of Accumulator (03) at Memory Location 2051

MVI A,04h // Move 04h 8-bit data in Accumulator (A)

STA 2052h // Store Content of Accumulator (04) at Memory Location 2052

MVI A,05h // Move 05h 8-bit data in Accumulator (A)

STA 2053h // Store Content of Accumulator (05) at Memory Location 2053

LHLD 2050h // Load Data (03) from Memory Location 2051 into Register H & Data (02) from Memory

Location 2050 into Register L.

XCHG // Move Content of Register H (03) into register D & Content of Register L (02) into

Register E

LHLD 2052h // Load Data (05) from Memory location 2053 into Register H & Data (04) from

Memory Location 2052 into Register L.

DAD D // Adds Content of Register H (05) with Content of Register D (03) as well as
5
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

content of Register L (04) with Content of Register E (02) (including carry if it’s

generated) and result (08) into Register H and result (06) into Register L.

SHLD 2054h // Store Content of Register H (08) at Memory Location 2054 and Register L (06) at

Memory Location 2055

HLT // End of Program

Input:

Memory Location Value


2050 02h
2051 03h
2052 04h
2053 05h

Output:

Memory Location Value


2054 08h
2055 06h

Questions:

Q.1 Give one example each of the five types of addressing modes.

6
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.2 What happens when HLT is executed in software?

Q.3 Write down the instructions that load H-L register pair by the contents of memory
location 3500H. Then move the contents to register C.

Q.4 Explain maskable and non-maskable interrupts

Teacher Signature

7
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 4

Aim: Write an 8085 assembly language program to find the minimum from two 8-bit numbers.

Code:

MVI A,05h // Move 05h 8-bit data in Accumulator (A)

STA 2051h // Store Content of Accumulator (05) at Memory Location 2051

MVI A,03h // Move 03h 8-bit data in Accumulator (A)

STA 2052h // Store Content of Accumulator (03) at Memory Location 2052

LDA 2051h // Load Data (05) from Memory Location 2050 into A.

MOV B, A // Move Content of Accumulator (05) into Register B

LDA 2052h // Load Data (03) from Memory Location 2052 into A.

CMP B // Compare Content of Accumulator (03) with Content of Register B (05) if Content of

Accumulator is less than Content of Register b then CY (Carry Flag) SET TO 1.

JC MIN // If Carry Flag is SET to 1 Then Jump on Label MIN

MOV A, B // If Carry Flag is NOT SET to 1 then, Move Content of Register B (05) into Accumulator

MIN:

STA 2051h // Store Content of Accumulator (03) at Memory Location 2051

HLT // End of Program

8
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Input:

Memory Value
Location
2051 05h
2052 03h

Output:

Memory Value
Location
3050 03h

Questions:

Q.1 Explain the two instructions (a) LDAX and (b) STAX

Q.2 What the instruction DCR M stands for?

9
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.3 What the instruction DAD H stands for?

Q.4 Explain the two instructions (a) RAR and (b) RRC

Teacher Signature
10
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 5

Aim: Write an 8085 assembly language program to get the minimum from block of N 8-bit
numbers.

Code:

MVI A,01h // Move 01h 8-bit data in Accumulator (A)

STA 2051h // Store Content of Accumulator (01) at Memory Location 2051

MVI A,06h // Move 06h 8-bit data in Accumulator (A)

STA 2052h // Store Content of Accumulator (06) at Memory Location 2052

MVI A,03h // Move 03h 8-bit data in Accumulator (A)

STA 2054h // Store Content of Accumulator (03) at Memory Location 2054

MVI A,02h // Move 02h 8-bit data in Accumulator (A)

STA 2055h // Store Content of Accumulator (02) at Memory Location 2055

MVI A,04h // Move 04h 8-bit data in Accumulator (A)

STA 2056h // Store Content of Accumulator (04) at Memory Location 2056

LXI H, 2052h // Store Content (52) into L (Reg- L) and 20 into H (Register H)

LDA 2051h // Load Data (01) from Memory Location 2050 into A.

MVI C, 04h // Move Content (04) into Register C.

LOOP: // This is a Label named LOOP

MOV B, M // Move Content of Register M (HL - 06) into Register B.


11
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

CMP B //Compare Content of Accumulator (01) with Content of Register B (06) If Content of

accumulator is less than Content of Register B then CY (Carry Flag) SET TO 1.

JC MIN // Whenever CY (Carry Flag) SET TO 1 Then Jump on Label Named MIN

MOV B.A // If CY not SET TO 1 Then Move Content of A (01) into Reg-B

MIN: // This is a Label Named MIN

INX H // Increment the Content of HL (L-53) Register Pair by 1.

DCR C // Decrement the Content of Register C (04) by 1, whenever Register C Has 00h Value

than Zero Flag (0) will SET TO 1.

JNZ LOOP // It Jump on Label LOOP until Z (Zero Flag) is Not SET TO 1.

STA 3050h // Store Content of AC (01) which minimum from 5 8 bit number Stored at Memory

Location 3050.

HLT // End of Program

Input:

Memory Value
Location
2051 01h
2052 06h
2054 03h
2055 02h
2056 04h

12
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Output:

Memory Value
Location
3050 01h

Questions:

Q.1 Describe the S and AC flag register of 8085.

Q.2 Describe the P and Z flag register of 8085.

Q.3 Explain the function of the two DMA signals HOLD and HLDA.

13
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.4 What happens when RESET IN signal goes low?

Teacher Signature

14
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 6

Aim: Write an 8085 assembly language program to add block of 8-bit numbers.

Code:

MVI A,02h // Move 02h 8-bit data in Accumulator (A)

STA 2050h // Store Content of Accumulator (02) at Memory Location 2050

MVI A,06h // Move 06h 8-bit data in Accumulator (A)

STA 2051h // Store Content of Accumulator (06) at Memory Location 2051

MVI A,07h // Move 07h 8-bit data in Accumulator (A)

STA 2052h // Store Content of Accumulator (07) at Memory Location 2052

MVI A,08h // Move 08h 8-bit data in Accumulator (A)

STA 2053h // Store Content of Accumulator (08) at Memory Location 2053

MVI A,01h // Move 01h 8-bit data in Accumulator (A)

STA 2054h // Store Content of Accumulator (01) at Memory Location 2054

LXI H,2050h // Move Data (20) into H (Register H) and Data (50) into L- Reg.

MVI A,00h // Move Data (00) into Accumulator (A)

MVI C,05h // Move Data (05) into Register C (C)

LOOP:

ADD M // Adds Content of M (Indicates Content of Memory Location Stored on HL Register Pair

(2050h = 02)) with Content of Accumulator (00)


15
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

INX H // Increment Content of HL Register pair by 1.

DCR C // Decrement Content of C (Register C) by 1. If Content of Register C is beomes 00h then Z

(Zero Flag) will SET TO 1.

JNZ LOOP // Jump on Label named LOOP until Zero Flag (Z) will not reset.

STA 3050h // Store Content of Accumulator (18) at Memory Location 3050

HLT // End of Program

Input:

Memory Location Value


2050 02h
2051 06h
2052 07h
2053 08h
2054 01h

Output:

Memory Location Value


3050 18h

Questions:

Q.1 Indicate the different machine cycles of 8085.

16
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.2 Explain the difference between HLT and HOLD states.

Q.3 Mention the different types of operations possible with arithmetic, logical, branch
instruction?

Teacher Signature

17
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 7

Aim: Write an 8085 ALP to find even and odd number from array and store them.

Code:

LXI H, 2000H // Initialize memory pointer 1

LXI D, 2100H // Initialize memory pointer 2

MVI C, 32H // Initialize counter

MOV A, M // Get the number

ANI 0lH // Check for odd number

JZ 2011H // If EVEN, don’t store

MOV A, M // Get the number

STAX D // Store the number in result list

INX D // Increment pointer 2

INX H // Increment pointer l

DCR C // Decrement counter

JNZ 2008H // If not zero, repeat

LXI H, 2000H // Initialize memory pointer l

LXI D, 2200H // Initialize memory pointer2

MVI C, 32H // Initialize counter

MOV A, M // Get the number

18
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

ANI 0lH // Check for even number

JNZ 2027H // If ODD, don’t store

MOV A, M // Get the number

STAX D // Store the number in result list

INX D // Increment pointer 2

INX H // Increment pointer l

DCR C // Decrement counter

JNZ 201EH // If not zero, repeat

HLT // Stop

Input:

Memory
Location Value
2000 01h
2001 02h
2002 03h
2003 04h
Output:

Memory Memory
Location Value Location Value
2200 02h 2100 01h
2201 04h 2101 03h

19
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Questions:

Q.1 Full-form of SIM and RIM.

Q.2 Explain the instructions (a) SHLD (b) LHLD.

Q.3 What the instruction DCR M stands for?

Q.4 Explain the two instructions (a) RAL (b) RLC

Teacher Signature
20
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 8

Aim: Write an 8085 assembly language program to add two decimal numbers using DAA
instruction

Code:

MVI A,0Ah // Move 0Ah 8-bit data (Hexadecimal) in Accumulator (A)

DAA // Convert Content (0A- Hexadecimal) into 10 (Decimal), Store result (10) in Accumulator

MOV B, A // Move Content of Accumulator (10) into Register B

MVI A,0Bh // Move 0Bh 8-bit data (Hexadecimal) in Accumulator (A)

DAA // Convert Content of Accumulator (0B- Hexadecimal) into 11 (Decimal), Store result (11)

in Accumulator

ADD B // Add Content of Register B (10) with Content of Accumulator (10), Result (21) Store in

Accmulator

HLT // End of Program

Input:

Registers Value
A (Accumulator) 0Ah
B (Register B) 0Bh

21
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Output:
Registers Value
A (Accumulator) 21h

Questions:

Q.1 Explain the instruction PCHL.

Q.2 Difference between arithmetic shift and logical shift.

Q.3 What the SP register does in a program?

22
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.4 Byte wise what are the lengths of CALL and RET instructions

Teacher Signature

23
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 9

Aim: Write an 8085 ALP to find even and odd number from array and store them.

Code:

LXI H, 2000H // Initialize memory pointer 1

LXI D, 2100H // Initialize memory pointer 2

MVI C, 32H // Initialize counter

MOV A, M // Get the number

ANI 0lH // Check for odd number

JZ 2011H // If EVEN, don’t store

MOV A, M // Get the number

STAX D // Store the number in result list

INX D // Increment pointer 2

INX H // Increment pointer l

DCR C // Decrement counter

JNZ 2008H // If not zero, repeat

LXI H, 2000H // Initialize memory pointer l

LXI D, 2200H // Initialize memory pointer2

MVI C, 32H // Initialize counter

MOV A, M // Get the number


24
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

ANI 0lH // Check for even number

JNZ 2027H // If ODD, don’t store

MOV A, M // Get the number

STAX D // Store the number in result list

INX D // Increment pointer 2

INX H // Increment pointer l

DCR C // Decrement counter

JNZ 201EH // If not zero, repeat

HLT // Stop

Input:

Memory
Location Value
2000 01h
2001 02h
2002 03h
2003 04h
Output:

Memory Memory
Location Value Location Value
2200 02h 2100 01h
2201 04h 2101 03h

25
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Questions:

Q.1 Exchange the contents of DE register pair with that of HL register pair, usingPUSH, POP
instructions.

Q.2 Bring out the distinguishing features between memory mapped I/O scheme and I/O
mapped I/O scheme..

Q.3 What is meant by “access time” of a memory?

Q.4 What is a volatile memory?

Teacher Signature

26
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 10

Aim: Write an 8085 Assembly Language Program (ALP) to find 1’s binary representation of a
given 8 bit number.

Code:

MVI A,0Ah // Move 0Ah 8-bit data into Accumulator (A)

STA 2050h // Store Content of A (0Ah) at Memory Location 2050

LDA 2050h // Load 0Ah data from Memory Location 2050 into A.

MVI B,00h // Move 00h 8-bit data into Register-B

MVI C,08h // Move 08h 8-bit data into Register-C

LOOP: // This is a Label named LOOP

RRC // Content of Accumulator (0Ah) is Rotate Right

JZ SKIP // Jump on Label named SKIP if Zero Flag is SET TO 1.

INR B // Increment the Content of Register B. (00h)

SKIP: // This is a Label named SKIP

DCR B // Increment the Content of Register B. (00h)

JNZ LOOP // Jump on Label named LOOP if Zero Flag is SET TO 1.

MOV A,B // Move Content of Register B (08h) into Accumulator.

STA 3050h // Store Content of A (0Dh) at Memory Location 3050

HLT // End of the Program


27
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Input:

Memory Value
Location
2050h 0Ah

Output:

Memory Value
Location
3050h 08h

Questions:

Q.1 A semiconductor memory is specified as 4 K × 8. Indicate the number of words, word size
and total capacity of this memory.?

Q.2 the characteristic features of a RAM.

28
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.3What is a flash memory?

Q.4 What is meant by addressing mode?

Teacher Signature

29
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 11

Aim: Write an 8085 Assembly Language Program (ALP) to arrange an array of six data bytes in
an ascending order. An array of six data bytes is stored on Memory Location 5000 H onwards.

Code:

LXI H,5000 // Set pointer for array

MOV C,M // Load the Count

DCR C // Decrement Count

REPEAT: MOV D,C

LXI H,5001

LOOP: MOV A,M // copy content of memory location to Accumulator

INX H

CMP M

JC SKIP // jump to skip if carry generated

MOV B,M // copy content of memory location to B - Register

MOV M,A // copy content of Accumulator to memory location

DCX H // Decrement content of HL pair of registers

MOV M,B // copy content of B - Register to memory location

INX H // Increment content of HL pair of registers


30
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

SKIP: DCR D // Decrement content of Register - D

JNZ LOOP // jump to loop if not equal to zero

DCR C // Decrement count

JNZ REPEAT // jump to repeat if not equal to zero

HLT // Terminate Program

Input:

Memory Location Data


5000 00h
5001 05h
5002 04h
5003 03h
5004 02h
5005 01h

Output:

Memory Location Data


5000 00h
5001 01h
5002 02h
5003 03h
5004 04h
5005 05h

31
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Questions:

Q.1 How the physical address is generated for the different memory addressing modes?

Q.2 Give examples of Register Addressing mode.

Q.3 Discuss Immediate Addressing Mode.

Q.4 How many instructions are there in the instruction set of 8086?

Teacher Signature

32
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 12

Aim: Write an 8085 Assembly Language Program (ALP) to find 2’s complement of a given 8 bit
number stored on Memory Location 8051 H and store the result (complimented number) on
Memory Location 8050 H.

Code:

LDA 8000H // Load the number from memory

CMA // Complement the accumulator

STA 8050H // Store the 1's complemented result

INR A // Increase A by 1

STA 8051H // Store the 2's complemented result

HLT // Terminate the program

Input:

Memory Location Data


8000 AB

Output:

Memory Location Data


8050 54
8051 55

33
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Questions:

Q.1 List out the conditional jump instruction?

Q.2 Explain PUSH and POP instructions.

Q.3 How many interrupts can be implemented using 8086 μP?

Q.4 Explain ALE and IO/M pin function

Teacher Signature

34
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 13

Aim: Write an 8085 ALP to reverse an array of 8-bit numbers.

Code:

MVI A,01h // Move 01h 8 – bit data in to Accumulator (A).

STA 2050h // Store Content of A (01) at Memory Location 2050.

MVI A,02h // Move 02h 8 – bit data in to Accumulator (A).

STA 2051h // Store Content of A (02) at Memory Location 2051.

MVI A,03h // Move 03h 8 – bit data in to Accumulator (A).

STA 2052h // Store Content of A (03) at Memory Location 2052.

MVI A,04h // Move 04h 8 – bit data in to Accumulator (A).

STA 2053h // Store Content of A (04) at Memory Location 2053.

MVI A,05h // Move 05h 8 – bit data in to Accumulator (A).

STA 2054h // Store Content of A (05) at Memory Location 2054.

LXI H,2050h // Move 20h 8 – bit data into Register H & 50h 8- bit data into Register L means initialize HL

Register Pair with 2050h as a memory location.

LXI D,3054h // Move 30h 8 – bit data into Register D & 54h 8- bit data into Register E means initialize DE

Register Pair with 3054h as a memory location.

MVI C,05h // Move 05h 8 – bit data into Register C.

LOOP: // This is a label named LOOP.


35
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

CALL SWAP // Call to subroutine SWAP.

INX B // Increment content of BC Register pair by 1.

DCX D // Decrement content of DE Register pair by 1.

DCR C // Decrement content of C register by 1.

JNZ LOOP // Jump on label named LOOP until Zero Flag will not SET TO 1.

HLT // End of Program

SWAP: // Subroutine SWAP

MOV B, M // Move Content of memory location (2050) which stored inside HL register pair to Register

B.

LDAX D // Load Content of DE register pair into Accumulator (A).

MOV M, A // Move Content of Accumulator to memory location (2050) which stored inside HL register

pair.

MOV A, B // Move Content of B register to accumulator (A).

STAX D // Store content of accumulator to memory location (3054) which stored inside DE register

pair.

RET // Return to main program

36
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Input:

Memory
Values
Locations
2050 01h
2051 02h
2052 03h
2053 04h
2054 05h
Output:

Memory
Location Value
2050 05h
2051 04h
2052 03h
2053 02h
2054 01h

Questions:

Q.1 What is a subroutine?

Q.2 Why a subroutine is used in a program?

37
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.3 Name the different types of subroutines.

Q.4 How the program returns from the subroutine?

Teacher Signature

38
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 14

Aim: Write an 8085 Assembly Language Program (ALP) to multiply two numbers stored on
Memory Locations 8000 H and 8001 H and store the result on Memory Location 8050 H.

Code:

LXI H,8000H // Load first operand address

MOV B, M // Store first operand to B

INX H // Increase HL pair

XRA A // Clear accumulator

MOV C, A // Store 00H at register C

LOOP: ADD M // Add memory element with Acc

JNC SKIP // When Carry flag is 0, skip next task

INR C // Increase C when carry is 1

SKIP: DCR B // Decrease B register

JNZ LOOP // Jump to loop when Z flag is not 1

LXI H,8050H // Load Destination address

MOV M, C // Store C register content into memory

INX H // Increase HL Pair

MOV M, A // Store Acc content to memory

HLT // Terminate the program


39
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Input:

Memory Location Data


8000 DC
8001 AC

Output:

Memory Location Data


8050 93
8051 D0

Questions:

Q.1 What pins are associated with Read/Write control logic block?

Q.2 Explain how the different ports and control words are selected for 8255.

40
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

Q.3 Discuss the control word format in the BSR mode.

Q.4 In how many interrupt modes can 8259 operate and which command word is
Utilized for this?.

Teacher Signature

41
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

PRACTICAL NO: 15

Aim: Write an 8085 ALP to convert BCD to binary number.

Code:

LXI SP,80FFH // Initialize stack pointer

LXI H, 802BH // Pointer to the IN-BUFFER

LXI B, 802CH // Pointer to the OUT-BUFFER

MOV A, M // Move the contents of 802BH to A

CALL BCDBIN // Subroutine to convert a BCD number to HEX

STAX B // Store Acc to memory location pointed by BC

HLT // Terminate the program

BCDBIN: PUSH B // Saving B

MOV B, A // Copy A to B

ANI 0FH // Mask of the most significant four bits

MOV C, A // Copy A to C

MOV A, B // Copy B to A

ANI F0H // Mask of the least significant four bits

RRC // Rotate accumulator right 4 times

RRC
42
SPCE - BAKROL
MICROPROCESSOR AND INTERFACING
(3160712)

RRC

RRC

MOV D, A // Load the count value to the Reg. D

XRA A // Clear the contents of the accumulator

MVI E, 0AH // Initialize Reg. E with 0AH

SUM: ADD E // Add the contents of Reg. E to A

DCR D // Decrement the count by 1 until 0 is reached

JNZ SUM

ADD C // Add the contents of Reg. C to A

POP B // Restoring B

RET // Returning control to the calling program

Input:

Memory Location Data


802B 52

Output:

Memory Location Data


802C 34

Teacher Signature
43
SPCE - BAKROL

You might also like