Vous êtes sur la page 1sur 12

Microprocessor and Peripheral Interfacing Lab Manual

Experiment No: 2(a) 17/01/2017

Aim: Write a program to add two 8-bit hex numbers which are stored at memory locations
2500H and 2501H and store the answer at 2502H. Store 00 if no carry and 01 otherwise at
memory location 2053.

Apparatus: 8085 Microprocessor Kit

Input Device: Keyboard

Flow Chart:

Start

A
Load H-L pair with address
Of first operands memory

Initialize register B with 00H


Move the first operand from
Memory to accumulator.

No If
Increment H-L pair to point CarrY
To next memory location.
Yes

Add second operand with data Increment register B


in Accumulator

Increment H-L pair to point


Increment H-L pair to point To next memory location.
To next memory location.

Move the data from register B


Move the final answer from to memory location pointed by
accumulator to the memory H-L pair.
location pointed by H-L pair

Stop
A

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Program:

Address Mnemonics Operand


2000 LXI H, 2050
2003 MOV A,M
2004 INX H
2005 ADD M
2006 INX H
2007 MOV M,A
2008 MVI B,00
200A JNC 200E
200D INR B
200E INX H
200F MOV M,B
2010 RST 5

With carry:

Input:

Address Value
2500 BC 1st
2501 DE 2nd

Output:

Output Value
2502 9A Result
2503 01 Carry

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Without Carry

Input:

Address Value
2500 01 1st value
2501 02 2nd value

Output:

Address Value
2503 03 Result
2504 00 carry

Result: We are able to add two 8-bit hex numbers using 8085 microprocessor using the
ADD operation and we also are able to store carry using JNC.

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Experiment No.:2(b)

Aim : Write a program to add two 16-bit hex numbers which are stored at memory
locations 2500 and 2502 and store the result at 2504.Store 00 if carry otherwise 01 at memory
location 2506.

Apparatus: 8085 Microprocessor Kit

Input Device: Keyboard

Flowchart:

Start
Initialize register B with 00H

Load H-L pair with data


from 2500H
No If
Carr
Exchange H-L pair
With D-E pair Yes

Increment register B

Load H-L pair with data


from 2502H
Store the result at
Location at 2504H

Add D-E pair with H-L pair


Move the carry to accumulator

A
Store the carry at location
2506H

Stop

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Program:

Address Mnemonics Operand


2000 LHLD 2050
2003 XCHG
2004 LHLD 2052
2007 DAD D
2008 MVI B,00
200A JNC 200E
200D INR B
200E SHLD 2054
2012 MOV A,B
2013 STA 2056
2016 RST 5

With Carry:

Input:

Address Value
2050 FF 1st
2051 FF
2052 FF 2nd
2053 FF
Output:

Address Value
2054 FE Result
2055 FF
2056 01 Carry

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Without carry:

Input:

Address Value
2500 22 1st
2501 11
2502 44 2nd
2503 33

Output:

Address Value
2503 66 Result
2504 44
2505 00 Carry

Result: We are able to add two 16-bit hex numbers using 8085 microprocessor directly by
using pair of registers at a time and also store the carry if generated.

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Experiment No: 3(a) 29/01/2016

Aim: Write a program to subtract two 8-bit hex numbers which are stored at memory
locations 2500 and 2501 and store the answer at 2502. Store 00 if no borrow and 01
otherwise at memory location 2503.

Apparatus: 8085 Microprocessor Kit

Input Device: Keyboard

Flowchart:

Start A

Load H-L pair with address Initialize register B with 00H


Of first operands memory

Move the first operand from No If


Memory to accumulator. Borrow?
B
Boor
Yes
Increment H-L pair to point
Increment register B
To next memory location.

Increment H-L pair to point


Add second operand with data To next memory location.
in Accumulator

Move the data from register B


Increment H-L pair to point to memory location pointed by
To next memory location. H-L pair.

Move the final answer from Stop


accumulator to the memory
location pointed by H-L pair

KRUPA DESAI U15EC007


A
Microprocessor and Peripheral Interfacing Lab Manual

Program:

Address MNEMONICS OPERAND


2000 LXI H, 2500
2003 MOV A,M
2004 INX H
2005 SUB M
2006 INX H
2007 MOV M,A
2008 MVI B,00
200A JNC 200E
200D INR B
200E INX H
2010 MOV M,B
2011 RST 5

With Borrow:

Input:

Address Value
2500 01H 1st
2501 02H 2nd

Output:

Output Value
2502 EEH Result
2503 01H Borrow

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Without Borrow:

Input:

Address Value
2501 03 1st
2502 01 2nd

Output:

Address Value
2503 02 Result
2504 00 Borrow

Result : We are able to subtract two 8-bit hex numbers using 8085 microprocessor using the
SUB operation and we also are able to store borrow using JNC.

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

EXPERIMENT: 3(B) 17/1/2017

Aim: Write a program to subtract two 16-bit hex numbers which are stored at memory
locations 2500 and 2502 and store the answer at 2504. Store 00 if no borrow and 01
otherwise at memory location 2506.

Apparatus: 8085 Microprocessor Kit

Input Device: Keyboard

Start
A

Load H-L pair with data Subtract the higher order of second
from 2500H number from higher order of first
number with borrow from previous
subtraction
Exchange H-L pair
With D-E pair
Move the result from
Accumulator to Register H

Load H-L pair with data


from 2502H

No If
Borrow?
Move the lower side from
register E to Accumulator
Yes

Increment register B
Subtract the lower order of
second number from lower
order of first number
Store the result from H-L pair
to memory

Move the result from


Accumulator to register L
Move the carry to Accumulator

Move the higher order of first


Store the carry at location 2056H
number from register D to
Accumulator

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Stop

Program:
Memory Location Mnemonics Operand
2000 LHLD 2500
2003 XCHG
2004 LHLD 2502
2007 MOV A,E
2008 SUB L
2009 MOV L,A
200A MOV A,D
200B SBB H
200C MOV H,A
200D MVI B,00
200F JNC 2013
2012 INR B
2013 SHLD 2504
2016 MOV A,B
2017 STA 2506
201A RST 5

Without Borrow

Input:
Address Value
2050 08H 1st
2051 02H
2052 03H 2nd
2053 00H

Output:

KRUPA DESAI U15EC007


Microprocessor and Peripheral Interfacing Lab Manual

Address Value
2054 05H Result
2055 02H
2056 00H Borrow

With Borrow

Input:
Address Value
2050 03 H 1st
2051 01H
2052 05 H 2nd
2053 02 H

Output:
Address Value
2054 FDH Result
2055 FEH
2056 01H Borrow

Result :We are able to subtract two 16-bit hex numbers using 8085 microprocessor directly
by using pair of registers at a time and also store the borrow if generated.

KRUPA DESAI U15EC007

Vous aimerez peut-être aussi