Sie sind auf Seite 1von 30

LIST OF EXPERIMENTS

1(a). Addition of two 8-bit numbers (without carry).

1(b). Addition of two 8-bit numbers (with carry).

2(a). Subtraction of two 8-bit No’s.

2(b). Subtraction of two 16-bit No’s.

3. Multiplication of two 8-bit No’s.

4. Division of two 8-bit numbers.

5. Finding the largest number from an array.

6. Finding the smallest number from an array.

7. Interfacing of LED’s with 8085 (MPU) through 8255 (PPI).

8. Using 8086 write a well-documented program for copying 12


bytes from source to destination.

9. Using 8086 write a program to find the sum of given ten


numbers.

10. Interfacing of seven segment display with 8085 through 8255


(PPI).
EXPERIMENT NO.-1(a)

AIM:- Addition of two 8- bit numbers (without carry).

► Write a program to add two numbers stored at memory addresses 2040 H,


2050H. The sum should be stored at location 2060 H.

REQUIRMENT:- 8085 Microprocessor Programming kit, instruction coding sheet.

THEORY:-

Let:-
(2040 H) = 14 H
(2050 H) = 89 H
Result = 14 H + 89 H = 9DH.

(2040 H) →A
A →B
(2050 H) → A
A+B → A
A → (2060 H)

PROCEDURE:-

Start

st
Get the 1 no.

nd
Get the 2 no.

Add two no.


Store the result

End

Program:-
Memory Hex code Label Mnemonics Remarks
location

RESULT AND INFERENCE:-

PRECAUTION:-Take memory location according to model of kit.

EXPERIMENT NO.-1(b)
AIM:- Addition of two 8-bit numbers (with carry).

► Write a program to add data bytes FFH & FFH. The result is greater than 8 bits.

REQUIRMENT:- 8085 microprocessor kit, coding sheet.

THEORY:- In this program we will study the carry on addition of two 8-bit no’s.
microprocessor gets the carry bit status to accumulator .

FFH → A
FFH →C
A+C→A
A → E (result)
A = OOH
A+CY =A
A → D (carry)

PROCEDURE:-

Start

Load A & C register


With FFH

A+C=A

A=C
A=OOH

D=OOH

A+CY=A

A→D

End
Program:-

Memory Hex code Label Mnemonics Remarks


location

RESULT AND INFERENCE:-

PRECAUTIONS:- Take memory location according to model of kit.

EXPERIMENT NO.- 2(a)


AIM:- Subtraction of two 8-bit nos.

►Write a program to subtract the contents of memory location 2040H from contents
of memory location 2050H and store the result in memory location 2060H.

REQUIREMENTS:-8085 micro-processor kit, instructions coding sheet.

THEORY:- Microprocessor perform subtraction by using 2’s complement method.

Let:-

(2040H) = 51H
(2041H) = 19H

Result = 51H - 19H = 38H


01010001 = 51H
00011001 = 19H
2’s complement of 19H is
11100111
01010001 = 51H
_____________________
10011000 = 38H. CY = 0

If CY =1, result is –ve and is in 2’s complement form and if CY = 0


Result is +ve.

PROCEDURE:-

Start

Get the 1st number

Get the 2nd number

Subtract 2nd number from 1st number

Store the result

End
Program:-

Memory Hex code Label Mnemonics Remarks


location

RESULT AND INFERENCE:-

PRECAUTIONS:- Take memory location according to model of kit.

]
EXPERIMENT NO.-2(b)

AIM:- Subtraction of two 16-bit no’s.

► Write a program to perform 16-bit subtraction on data stored in following


format and store the result as specified.

C200H LSB data1


C201H MSB data1
C202H LSB data2
C203H MSB data2
C204H LSB Result
C205H MSB Result

REQUIREMENTS:- 8085 Microprocessor programming kit, instruction coding


sheet.

THEORY:- 16-bit subtraction cannot be performed directly. 1st subtract lower byte
of 2nd number from lower byte of 1st number then, subtract higher byte of 2nd number
and borrow from the previous subtraction.
( C200H ) – ( C2002H ) = ( C204H )
( C201H ) – ( C203H ) = ( C205H ).

PROCEDURE:-

Start

Get the 1st data in DE


register pair.

Get the 2nd data in HC


register pair.

Subtract lower byte of 2nd


number from lower byte of
1st number.

Store the result at location


C204H

Subtract higher byte of 2nd number


and brow from the previous
subtraction
Store the result at location
C205H

End

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTION:- Take memory locations according to model o


EXPRIMENT NO.- 3

AIM:- Multiplication of two 8-bit no’s.


► Write a program for multiplication of two 8-bit numbers using shift and add
method & check the results using successive addition methods.

REQUIRMENTS:- 8085 microprocessor programming kit, instruction coding sheet.

THEORY:- In 8085 no direct instructions are available for multiplication it can be


done by repetitive addition or shift and add method.
1. By repetitive addition method.
Let at memory location (2200H) = 03H
& (2201H) = B2H
Result = B2H + B2H + B2H = 216H

2. By shift and add method:-


Let at memory location (2200H) = OCH
& at (2201H) = 05H
Multiplicand Multiplier Result
1100 (1210) 0101 (510) 12*5 = 6010

Steps Product CY Multiplier Comments

A7 A6 A5 A4 A3 A2 A1 A0 CY B3 B2 B1 B0
0 0 0 0 0 0 0 0 0 0 1 0 1 Initial stage.
Step 1 0 0 0 0 0 0 0 0 0 1 0 1 0 Shift left by 1
0 0 0 0 0 0 0 0 0 1 0 1 0 Don’t add since cy=0
Step 2 0 0 0 0 0 0 0 0 1 0 1 0 0 Shift
0 0 0 0 1 1 0 0 1 0 1 0 0 Add multiplicand
since cy=1

Step 3 0 0 0 1 1 0 0 0 0 1 0 0 0 Shift left by 1


0 0 0 1 1 0 0 0 0 1 0 0 0 Don’t add since cy=0
Step 4 0 0 1 1 0 0 0 0 1 0 0 0 0 Shift left by1
0 0 1 1 1 1 0 0 1 0 0 0 0 Add multiplicand
since cy=1

PROCEDURE:-
Start

No.1→ DE
0000H = HL
No.2 → B
C= Counter

Shift Result left by one bit

B→A
Shift left by one bit

A→B

N
Is
CY = 1

Yes
HL + DE = HL

C–1=C

N
Is
C=0
?
Y

End

Program:-
Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTIONS:- Take memory location according to model of kit.

EXPERIMENT NO.- 4
AIM:- Division of two 8-bit numbers.

► Write a program to divide No.1 by No.2 store the result in B register and
reminder in C register. (Draw flow charts)

► Write a program to perform 8-bit division, store the result in H & L registers.
Use shift and subtract method.

REQUIREMENTS:- 8085 microprocessor programming kit, instruction coding


sheet.

THEORY:- Like multiplication in 8085 no direct instruction are available for


Division it can be done by Subtraction method:-

Suppose you want to divide 4 by 2, subtract 2 from 4


two time ie 4 - 2 =2 then 2 – 2 = 0
here no. of time you subtract is quotient.
1. Using shifting technique :-

Steps Dividend Quotient Comment


A7 A6 A5 A4 A3 A2 A1 A0 B3 B2 B1 B0
0 1 1 0 0 0 0 1 0 0 0 0 Initial stage
Step1 1 1 0 0 0 0 1 0 0 0 0 0 Shift left
0 1 0 1 0 0 1 0 0 0 0 1 MSB of dividend = MSB of
dividend – divisor and Quotient
= Quotient + 1 Since MSB of
dividend > divisor
Step2 1 0 1 0 0 1 0 0 0 0 1 0 Shift left
0 0 1 1 0 1 0 0 0 0 1 1 MSB of dividend = MSB of
dividend – divisor and Quotient
= quotient + 1 Since MSB of
dividend > divisor.

Step3 0 1 1 0 1 0 0 0 0 1 1 0 Shift left


0 1 1 0 1 0 0 0 0 1 1 0 No change since MSB of
dividend < divisor
Step4 0 1 1 0 0 0 0 0 1 1 0 1 MSB of dividend = MSB of
dividend – divisor and Quotient
= Quotient + 1Since MSB of
dividend > divisor.
PROCEDURE:-

Start

No.1→A
00→B
No.2→C

A–C=A

B+ 1=B

Compare C whit A

NO IS
CY=1

Yes
A→C

End

Program:-
Memory location Hex code Level Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTION:- Take memory locations according model of kit.

EXPERIMENT NO.- 5
AIM:- Finding the largest number from an array.

► Write a program to find the largest number in a given array of 16 elements.


The array is stored in memory from 9200H onwards. Store the result at the
end of the array.

REQUIRMENTS:- 8085 microprocessor programming kit, instruction coding sheet.

THEORY:- To find largest of given no. of a given string we compare all given no.
one by one. Suppose given no. is 2, 4, 3, 1, 0 1st we compare 2 & 4 (2 is in register
A & 4 is in Register B).
A < B so put B into (A) & Compare with next number i.e. 3 Here A > B so directly
compare 4 with 1 then 0.

PROCEDURE:-

Start

initialize HL pair with9200H


C = OFH
00H = A

M=B

Compare B with A

N IS
CY = 1

B=A

HL = HL + 1

C–1=C
IS N
Z=0

Y
A = ( 9210H)

End

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-


PRECAUTION:- Take memory locations according model of kit.

EXPERIMENT NO.- 6
AIM:- Finding the smallest number from an array.

► Write a program to find smallest number from an array of 16 elements the


array is stored in memory from 2300H onwards. Store the result at memory
location 2310H.

REQUIREMENT:- 8085 microprocessor programming kit, instruction coding sheet.

THEORY:- Same as largest no. we compare two number one by one but comparison
process is reverse.

]
PROCEDURE:-

Start

initialize HL pair with9200H


C = OFH
00H = A

M=B

Compare B with A

Y IS
CY = 1

B=A

HL = HL + 1

C–1=C
IS N
Z=0

Y
A = ( 9210H)

Program:- End

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-


PRECAUTION:- Take memory locations according to model of kit.

EXPERIMENT NO.- 7
AIM:- Interfacing of LED’s with 8085 MPU through 8255.

► Interface two LED’s using common anode & common cathode technique.
Design the circuit and draw the interface. Write a program to blink them,
alternatively, assume port address in I/O mapped I/O.

REQUIREMANT:- 8085 microprocessor programming kit, instructions coding


sheet.

THEORY:- The 8255A is a widely used, programmable, parallel input device. It


can be Programmed to transfer data under various conditions, from simple input to
intercept input. The 8255 can operate in 3 I/O modes (1) mode 0, (2) mode 1 and
(3) mode 2. It is a general purpose programmable input device used for parallel data
transfer. It has 24 I/O pins which can be grouped in three 8-bit parallel ports :
port A, part B & part C.

► For flashing two LEDs connect both LEDs to part A one at PA0 & other
to PA1.
► Connect anode of one LED to VCC & other to ground. i.e. known as
common anode & common cathode method.

PROCEDURE:-

Start

SP = FFFFH
A =80H

OUT CWR

A ← 03H

OUT port A

Wait for some time

A = 00H

Out port A
Wait for some time

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUSTIONS:- Take starting address, port address and control word address
according to model of kit.

EXPERIMENT NO.-8
AIM:- Using 8086 write a well documented program for copying 12 bytes from
source to destination.

REQUIREMENT:- 8086 programming kit, instructions coding sheet.

THEORY:- Let, Block 1 data is available from memory location block1, and
destination memory location be block 2. The number of bytes in block 1 is 10 i.e.
OAH. To start initialize counter CX register. Block 1 address be in SI register and
Block 2 address in DI register. Clear the direction flag. By using string Instruction
move the date from the memory pointed by SI register to memory pointed by DI
register. It is assumed that the data is to be moved within the same segment
therefore DS & ES are initialized to the same segment value.

PROCEDURE:-

Start

Initialize the DS & EX with


the segment address.

Initialize the SI & DI with the source


& destination address.

CX = count
DF = 0

String move the data from source to


destination till CX = 0
.

Terminate the program.

Program:-
Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTIONS:- Take memory location according to model of kit.

EXPERIMENT NO.- 9
AIM:- Using 8086 write a program to find the sum of given ten numbers.

REQUIREMENT:- 8086 microprocessor programming kit, Instructions coding


sheet.

THEORY:- For addition of ‘n’ numbers.


Initialize data segment register DI as pointer register CL or CX as a
counter, base pointer for array.

Then, sum = sum + pointer.


Pointer = pointer + 1
Count = count – 1
Now check for counter
If it is zero store sum at memory location ‘Result’ or repeat above.

PROCEURE:-

Start

Initialize segment register,


pointer, count & base
pointer for array.

Sum = pointer +1

Count = count - 1

No Is
Count
=0
?

Yes

“Result” = Sum.

End
Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTIONS:- Take memory location according to model of kit.

EXPERIMENT NO.- 10
AIM:- Interfacing of seven segment display with 8085 through 8255 (PPI).

REQUIREMANT:- 8085 microprocessor programming kit, instructions coding


sheet.

THEORY:- Take port A as output part. Connect PA0 – PA6 to different segment of
display. Output data 1 to PA0 – PA6 according to digit you want to
display. Take delay of 0.1 seconds call delay after one digit display.

PROCEDURE:-

Start

Initialize CW

Load data in ‘ A ‘ to glow digit ‘ 0‘

Out port A

Call delay

Load data to glow digit 8

Output port A

Call delay.

End

Program:-
Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTIONS:- Take port address and control word address according to


model of kit.

Das könnte Ihnen auch gefallen