Top Banner
39
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Microprocessor 8085 Manual
Page 2: Microprocessor 8085 Manual

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).

Page 3: Microprocessor 8085 Manual

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 HResult = 14 H + 89 H = 9DH.

(2040 H) AA B(2050 H) AA+B AA (2060 H)

PROCEDURE:-

Get the 1st no.

Store the result

Get the 2nd no.

Add two no.

Start

End

Page 4: Microprocessor 8085 Manual

Program:-

Memory location

Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

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

Page 5: Microprocessor 8085 Manual

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 →CA + C → AA → E (result)A = OOHA+CY =AA → D (carry)

PROCEDURE:-

Load A & C register With FFH

A+C=A

A=C A=OOH

D=OOH

A+CY=A

A→D

Start

End

Page 6: Microprocessor 8085 Manual

Program:-

Memory location

Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

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

Page 7: Microprocessor 8085 Manual

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:-

Get the 1st number

Get the 2nd number

Subtract 2nd number from 1st number

Store the result

Start

End

Page 8: Microprocessor 8085 Manual

Program:-

Memory location

Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

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

]

Page 9: Microprocessor 8085 Manual

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:-

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

Start

Page 10: Microprocessor 8085 Manual

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTION:- Take memory locations according to model o

Store the result at location C205H

End

Page 11: Microprocessor 8085 Manual

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) = B2HResult = B2H + B2H + B2H = 216H

2. By shift and add method:-

Let at memory location (2200H) = OCH & at (2201H) = 05HMultiplicand 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

Page 12: Microprocessor 8085 Manual

PROCEDURE:-

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

C= Counter

N Is

CY = 1

Yes

N Is

C = 0 ?

Y

Shift Result left by one bit

B → AShift left by one bit

A → B

HL + DE = HL

C – 1 = C

Start

End

Page 13: Microprocessor 8085 Manual

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

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

Page 14: Microprocessor 8085 Manual

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 CommentA7 A6 A5 A4 A3 A2 A1 A0 B3 B2 B1 B0

0 1 1 0 0 0 0 1 0 0 0 0 Initial stageStep1 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 left0 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 left0 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.

Page 15: Microprocessor 8085 Manual

PROCEDURE:-

No.1→A00→BNo.2→C

NO IS CY=1

Yes

A – C = A

B + 1 = B

Compare C whit A

A → C

Start

End

Page 16: Microprocessor 8085 Manual

Program:-

Memory location Hex code Level Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTION:- Take memory locations according model of kit.

EXPERIMENT NO.- 5

Page 17: Microprocessor 8085 Manual

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:-

initialize HL pair with9200H C = OFH

00H = A

N IS

CY = 1

Y

M = B

Compare B with A

B = A

HL = HL + 1

C – 1 = C

Start

Page 18: Microprocessor 8085 Manual

IS N Z = 0

Y

Program:-

Memory location Hex code Label Mnemonics Remarks

A = ( 9210H)

End

Page 19: Microprocessor 8085 Manual

RESULT AND INFERENCE:-

PRECAUTION:- Take memory locations according model of kit.

Page 20: Microprocessor 8085 Manual

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:-

initialize HL pair with9200H C = OFH

00H = A

Y IS

CY = 1

N

M = B

Compare B with A

B = A

HL = HL + 1

C – 1 = C

Start

Page 21: Microprocessor 8085 Manual

IS N Z = 0

Y

Program:-

Memory location Hex code Label Mnemonics Remarks

A = ( 9210H)

End

Page 22: Microprocessor 8085 Manual

RESULT AND INFERENCE:-

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

Page 23: Microprocessor 8085 Manual

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:-

SP = FFFFHA =80H

OUT CWR

A ← 03H

OUT port A

Wait for some time

A = 00H

Start

Page 24: Microprocessor 8085 Manual

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.

Out port A

Wait for some time

Page 25: Microprocessor 8085 Manual

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:-

Initialize the DS & EX withthe segment address.

Initialize the SI & DI with the source & destination address.

CX = countDF = 0

String move the data from source to destination till CX = 0 .

Terminate the program.

Start

Page 26: Microprocessor 8085 Manual

Program:-

Memory location Hex code Label Mnemonics Remarks

]

RESULT AND INFERENCE:-

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

Page 27: Microprocessor 8085 Manual

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:-

Initialize segment register, pointer, count & base pointer for array.

No Is Count = 0

?

Yes

Sum = pointer +1

Count = count - 1

Start

Page 28: Microprocessor 8085 Manual

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

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

EXPERIMENT NO.- 10

“Result” = Sum.

End

Page 29: Microprocessor 8085 Manual

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:-

Initialize CW

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

Out port A

Call delay

Load data to glow digit 8

Output port A

Start

Call delay.

End

Page 30: Microprocessor 8085 Manual

Program:-

Memory location Hex code Label Mnemonics Remarks

RESULT AND INFERENCE:-

PRECAUTIONS:- Take port address and control word address according to model of kit.