KEMBAR78
Microprocessors LAB Manual BBEC | PDF | Assembly Language | Computer Engineering
0% found this document useful (0 votes)
28 views51 pages

Microprocessors LAB Manual BBEC

Uploaded by

shahilshah902
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 views51 pages

Microprocessors LAB Manual BBEC

Uploaded by

shahilshah902
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/ 51

MICROPROCESSORS

LAB MANUAL

EE181513
B.Tech 5th Semester

DEPARTMENT OF ELECTRICAL ENGINEERING


BINESWAR BRAHMA ENGINEERING COLLEGE, KOKRAJHAR, ASSAM
8085 Microprocessor Lab Manual

Software/Simulator based
(using Anshuman 8085 microprocessor xpo-85 kit)

Page 1
8085 Microprocessor Lab Manual

Contents

Name of the Experiment


Sl. No. a) Software/Simulator based(using Anshuman 8085 Page No.
microprocessor xpo-8085 kit)

Addition and subtraction of two 8-bit numbers with programs based


1. on different addressing modes of 8085. 4

Addition and subtraction of two 16-bit numbers (Using 2’s


2. complement method, also programs which access numbers from 9
specified memory locations.)

Multiplication of two 8-bit numbers using the method of successive


3. 14
addition and Shift & add.

Division of two 8-bit numbers using the method of successive


4. 16
subtraction and shift & subtract.

5. Block transfer, Block Exchange & Block Reverse of data bytes. 18

6. Finding the smallest and largest element in a block of data. 23

Arranging the elements of a block of data in ascending and descending


7. 25
order.

Converting 2 digit numbers to their equivalents.


8. 27
a) BCD to HEX and b) HEX to BCD

9. Generation of Fibonacci Series. 29

10. Finding Square of given number using look up table. 30

Page 2
8085 Microprocessor Lab Manual

PROCEDURE:

1. To write program in XPO-85 Anshuman 8085 Microprocessor Kit


ANSHUMAN
S
Enter
Enter
Program starting address
Write program

2. Execution Steps
Esc
G
Enter
Enter
Program starting address
Enter
S
Enter
Press any key 2 times
Enter
Enter
Register Name

Page 3
8085 Microprocessor Lab Manual

ADDITION AND SUBTRACTION OF TWO 8-BIT NUMBERS


WITH PROGRAMS BASED ON DIFFERENT ADDRESSING MODES

Experiment 1

AIM: To write an assembly language program to add two 8-bit numbers using different Addressing
Modes
APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

1). Immediate Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 3E, 20 MVI A, 20 H Move Immediate data 10 H in A reg.
7002 06, 10 ADI 10 H Add Immediate data 10 H with A reg. content
7004 CF RST 1 Terminate the program

RESULT:

Input: Output:

A reg. = 20 H A reg. = 30 H
&
Immediate data = 10 H

2). Register Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 3E, 20 MVI A, 30 H Move Immediate data 10 H in A reg.
7002 06, 10 MVI B, 10 H Add Immediate data 10 H with A reg. content
7004 80 ADD B Add contents of A & B reg.
7005 CF RST 1 Terminate the program

RESULT:

Input: Output:

A reg. = 30 H A reg. = 40 H
&
B reg. = 10 H

Page 4
8085 Microprocessor Lab Manual

3). Indirect Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
Loads Immediate data into HL pair from 7501
7000 21, 01, 75 LXI H, 7501 H
H memory location (1st no.)
7003 7E MOV A, M Copy the content from HL specified memory

location
Increment HL by 1. Points to the next memory
7004 23 INX H
location 7502 H for 2nd no.
7005 86 ADD M Add 1st no. with 2nd no.
Increment HL by 1. Points to the next memory
7006 23 INX M
location 7503 H to store result of addition
7007 77 MOV M, A Move the result of addition to 7503 H
7008 CF RST 1 Terminate the program

RESULT:

Input: Output:

7501 H : 30 H 7503 H : 40 H
&
7502 H : 10 H

Page 5
8085 Microprocessor Lab Manual

4). Direct Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
Load A reg. directly the contents of 7500 H
7000 3A, 00, 75 LDA 7500 H
(1st no.)
7003 47 MOV B, A Move 1st no. from A reg. to B reg.
Load A reg. directly the contents of 7500 H
7004 3A, 01, 75 LDA 7501 H
(2nd no.)
7007 80 ADD B Add 1st no. with 2nd no.
7008 32, 02, 75 STA 7502 H Store the result of addition at 7502 H directly
700B CF RST 1 Terminate the program

RESULT:

Input: Output:

7500 H : 30 H 7502 H : 40 H
&
7501 H : 10 H

Page 6
8085 Microprocessor Lab Manual

Experiment 2
AIM: To write an assembly language program to subtract two 8-bit numbers using different
Addressing Modes.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

1). Immediate Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 3E, 20 MVI A, 20 H Move Immediate data 10 H in A reg.
Subtract Immediate data 10 H with A reg.
7002 D6, 10 SUI 10 H
content
7004 CF RST 1 Terminate the program

RESULT:

Input: Output:

A reg. = 20 H A reg. = 10 H
&
Immediate data = 10 H

2). Register Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 3E, 20 MVI A, 30 H Move Immediate data 10 H in A reg.
7002 06, 10 MVI B, 10 H Add Immediate data 10 H with A reg. content
7004 90 SUB B Subtract contents of A & B reg.
7005 CF RST 1 Terminate the program

RESULT:

Input: Output:

A reg. = 30 H A reg. = 20 H
&
B reg. = 10 H

Page 7
8085 Microprocessor Lab Manual

3). Indirect Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
Loads Immediate data into HL pair from 7501
7000 21, 01, 75 LXI H, 7501 H
H memory location (1st no.)
Copy the content from HL specified memory
7003 7E MOV A, M
location
Increment HL by 1. Points to the next memory
7004 23 INX H
location 7502 H for 2nd no.

7005 96 SUB M Subtract 1st no. with 2nd no.


Increment HL by 1. Points to the next memory
7006 23 INX M
location 7503 H to store result of addition
7007 77 MOV M, A Move the result of addition to 7503 H
7008 CF RST 1 Terminate the program

RESULT:

Input: Output:

7501 H : 30 H 7503 H : 20 H
&
7502 H : 10 H

4). Direct Addressing Mode:

Memor
y Opcode Mnemonics & Operands Comments
Address
Load A reg. directly the contents of 7500 H
7000 3A, 00, 75 LDA 7500 H
(1st no.)
7003 47 MOV B, A Move 1st no. from A reg. to B reg.
Load A reg. directly the contents of 7500 H
7004 3A, 01, 75 LDA 7501 H
(2nd no.)
7007 90 SUB B Subtract 1st no. with 2nd no.
7008 32, 02, 75 STA 7502 H Store the result of addition at 7502 H directly
700B CF RST 1 Terminate the program

RESULT:

Input: Output:

7500 H : 30 H 7502 H : 20 H
&
7501 H : 10 H

Page 8
8085 Microprocessor Lab Manual

ADDITION AND SUBTRACTION OF TWO 16-BIT NUMBERS


(Numbers are stored at specified memory location)
Experiment 3
AIM: To write an assembly language program to add two 16-bit numbers (Numbers are stored at
specified memory location).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memo Opcode Mnemonics Comments


ry &
Operands
Address
Get 1st number in HL pair from memory
7000 2A, 01, 76 LHLD 7601 H location 7601 H

Exchange contents of DE and HL pair


7003 EB XCHG
Get 2nd number in HL pair from memory
7004 2A, 03, 76 LHLD 7603 H location 7603 H

Clear C reg. as C reg. is used to hold carry bit


7007 0E, 00 MVI C, 00 H
7009 19 DAD D HL + DE  HL
If no carry jump to loop (7012 H), if carry then
700A D2, 12, 70 JNC (loop) 7012 H move to next step

Increment C reg. (Carry is generated from


700D 0C INR C
addition of two 16-bit numbers)
Move carry from C reg. to A reg.
700E 79 MOV A, C
Store carry from A reg. directly at memory
700F 32, 00, 75 STA 7500 H location 7500 H

Store result of addition of two 16-bit numbers


loop: from HL pair directly at 7501 H & 7502 H
7012 22, 01, 75
SHLD 7501 H memory location

7015 CF RST 1 Terminate the program

Page 9
8085 Microprocessor Lab Manual

RESULT:

Input: 1 Output: 1
7601 H = LSB of 1st no. (11 H) 7500 H = Carry (00 H)
7602 H = MSB of 1st no. (11 H) 7501 H = LSB of Result (33 H)
7603 H = LSB of 2nd no. (22 H) 7502 H = MSB of Result (33 H)
7604 H = MSB of 2nd no. (22 H)
Input: 2 Output: 2
7601 H = LSB of 1st no. (11 H) 7500 H = Carry (01 H)
7602 H = MSB of 1st no. (91 H) 7501 H = LSB of Result (34 H)
7603 H = LSB of 2nd no. (23 H) 7502 H = MSB of Result (82 H)
7604 H = MSB of 2nd no. (81 H)

Page 10
8085 Microprocessor Lab Manual

Experiment 4
AIM: To write an assembly language program to subtract two 16-bit numbers (Numbers are stored at
specified memory location).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor Opcode Mnemonics & Comments


y Operands
Address
Get 1st number in HL pair from memory
7000 2A, 01, 76 LHLD 7601 H location 7601 H

Exchange contents of DE and HL pair


7003 EB XCHG
Get 2nd number in HL pair from memory
7004 2A, 03, 76 LHLD 7603 H location 7603 H

Get lower byte of 1st no.


7007 7B MOV A, E
7008 95 SUB L Subtract lower byte of 2nd no.
Store the result in L reg.
7009 6F MOV L, A
700A 7A MOV A, D Get higher byte of 1st no.
Subtract higher byte of 2nd no. with borrow
700B 96 SBB H
Store the result in H reg.
700C 67 MOV H, A
Store result of subtraction of two 16-bit
numbers from HL pair directly at 7605 H &
700D 22, 05, 76 SHLD 7605 H
7606 H memory location

7010 CF RST 1 Terminate the program

RESULT:

Input: Output:
7601 H = LSB of 1st no. (30 H) 7605 H = LSB of Result (20 H)
7602 H = MSB of 1st no. (40 H) 7606 H = MSB of Result (20 H)
7603 H = LSB of 2nd no. (10 H)
7604 H = MSB of 2nd no. (20 H)

Page 11
8085 Microprocessor Lab Manual

(OR)

ADDITION OF TWO 16-BIT NUMBERS


ASSEMBLY LANGUAGE PROGRAM:

Memor
Mnemonics &
y Opcode Comments
Operands
Address
7000 06, 12 MVI B, 12 H Move immediate data 12 H in B reg. (MSB of
1st no.)
Move immediate data 34 H in C reg. (LSB of 1st
7002 0E, 34 MVI C, 34 H
no.)
Move immediate data 43 H in D reg. (MSB of
7004 16, 43 MVI D, 43 H
2nd no.)
Move immediate data 21 H in E reg. (LSB of 2nd
7006 1E, 21 MVI E, 21 H
no.)
7008 7B MOV A, E Move LSB of 2nd no. to A reg.
7009 81 ADD C Add with LSB of 1st no.
700A 6F MOV L, A Store the LSB result from A reg. in L reg.
700B 7A MOV A, D Move MSB of 2nd no. to A reg.
700C 88 ADC B Add with carry MSB of 1st no.
700D 67 MOV H, A Store the MSB result from A reg. in H reg.
700E CF RST 1 Terminate the program

RESULT:

Input: Output:

1st no. = 1234 H (in BC reg. pair) Result = 5555 H (in HL reg. pair)
2nd no. = 4321 H (in DE reg. pair)

Page 12
8085 Microprocessor Lab Manual

SUBTRACTION OF TWO 16-BIT NUMBERS


ASSEMBLY LANGUAGE PROGRAM:

Memor
Mnemonics &
y Opcode Comments
Operands
Address
Move immediate data 12 H in B reg. (MSB of
7000 06, 43 MVI B, 43 H
1st no.)
Move immediate data 34 H in C reg. (LSB of 1st
7002 0E, 21 MVI C, 21 H
no.)
Move immediate data 43 H in D reg. (MSB of
7004 16, 12 MVI D, 12 H
2nd no.)
Move immediate data 21 H in E reg. (LSB of 2nd
7006 1E, 34 MVI E, 34 H
no.)
7008 7B MOV A, E Move LSB of 2nd no. to A reg.
7009 81 SUB C Subtract with LSB of 1st no.
700A 6F MOV L, A Store the LSB result from A reg. in L reg.
700B 7A MOV A, D Move MSB of 2nd no. to A reg.
700C 88 SBB B Subtract with borrow from MSB of 1st no.
700D 67 MOV H, A Store the MSB result from A reg. in H reg.
700E CF RST 1 Terminate the program

RESULT:

Input: Output:

1st no. = 4321 H (in BC reg. pair) Result = 3113 H (in HL reg. pair)
2nd no. = 1234 H (in DE reg. pair)

Page 13
8085 Microprocessor Lab Manual

MULTIPLICATION OF TWO 8-BIT NUMBERS


(USING SUCCESSIVE ADDITION METHOD)

Experiment 5
AIM: To write an assembly language program to multiply two 8-bit numbers (using Successive
Addition method).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
Move 1st number (Multiplicand) in C reg.
7000 0E, 25 MVI C, 25 H
Move 2nd number (Multiplier) in E reg.
7002 1E, 05 MVI E, 05 H
7004 06, 00 MVI B, 00H Clear B reg.

Initial Product in HL to 0000 H


7006 21, 00, 00 LXI H, 0000 H
UP:
7009 09 HL + BC  HL
DAD B
Decrement E reg.
700A 1D DCR E
C2, 09,
700B JNZ (UP) 7009 H Jump if not zero to 7009 H
70
Store the Product i.e.; HL contents at 7500 H
700E 22, 00, 75 SHLD 7500 H
7011 CF RST 1 Terminate the program

RESULT:

Input: Output:

C = 25 H (1st number; Multiplicand); HL = 00B9 H;


E = 05 H (2nd number; Multiplier); &
B = 00 H 7500 H = 00B9 H

Page 14
8085 Microprocessor Lab Manual

MULTIPLICATION OF TWO 8-BIT NUMBERS


(USING Shift & ADD METHOD)

AIM: To write an assembly language program to multiply two 8-bit numbers (using shift and add
method).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
Mnemonics &
y Opcode Comments
Operands
Address
Get 1st number i.e.; Multiplicand in HL pair
7000 2A, 01, 75 LHLD 7501 H
Exchange HL pair with DE pair
7003 EB XCHG
Get 2nd number i.e.; Multiplier in Acc. reg.
7004 3A, 03, 75 LDA 7503 H
Initial Product in HL to 0000 H
7007 21, 00, 00 LXI H, 0000 H
700A 0E, 08 MVI C, 08 H Count 08 H in C reg.
up:
700C 29 Shift partial product to left by 1-bit
DAD H
700D 17 RAL
Jump if no carry to 7012 H
700E D2, 12, 70 JNC (down) 7012 H
HL + DE  HL i.e.; Product = Product +
7011 19 DAD D Multiplicand

down: Decrement count by 1-bit


7012 0D
DCR C
Jump if no zero to 700C H
7013 C2, 0C, 70 JNZ (up) 700C H
Store result at 7505 H memory location
7016 22, 05, 75 SHLD 7505 H
7019 CF RST 1 Terminate the program

RESULT:

Input: Output:

7501 H = 25 H (1st number; Multiplicand); 7505 H = B9 H;


7503 H = 05 H (2nd number; Multiplier); 7506 H = 00 H

Page 15
8085 Microprocessor Lab Manual

Division OF TWO 8-BIT NUMBERS


(USING SUCCESSIVE SUBTRACTION METHOD)

Experiment 6
AIM: To write an assembly language program to divide two 8-bit numbers (using Successive
Subtraction method).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
Mnemonics &
y Opcode Comments
Operands
Address
Get 1st number (Divisor) in A reg.
7000 3A, 01, 75 LDA 7501 H
Copy divisor in B reg.
7003 47 MOV B, A
Get 2nd number (Dividend) in A reg.
7004 3A, 02, 75 LDA 7502 H
C reg. will hold Quotient so initializing it with
7007 0E, 00 MVI C, 00 H 00 H

7009 B8 CMP B Compare Dividend with Divisor


If carry jump to 7013 H
700A DA, 13, 70 JC (down)7013 H
up:
700D 90 A – B  A (Dividend – Divisor  A reg.)
SUB B
Increment C reg. by 1
700E 0C INR C
Is Dividend < Divisor (A < B)
700F B8 CMP B
If not then jump to 700D H
7010 D2, 0D, 70 JNC (up)700D H
down: Store A reg. content i.e.; Remainder at 7503 H
7013 32, 03, 75
STA 7503 H
Copy Quotient i.e.; C reg. content to A reg.
7016 79 MOV A, C
Store A reg. content i.e.; Quotient at 7504 H
7017 32, 03, 75 STA 7504 H
701A CF RST 1 Terminate the program

RESULT:

Input: Output:

7501 H = 25 H (1st number; Divisor); 7503 H = 02 H (Remainder)


7502 H = 05 H (2nd number; Dividend); 7504 H = 07 H (Quotient)

Page 16
8085 Microprocessor Lab Manual

DIVISION OF TWO 8-BIT NUMBERS


(USING Shift & SUBTRACT METHOD)

AIM: To write an assembly language program to divide two 8-bit numbers (using shift and subtract
method)

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
Mnemonics &
y Opcode Comments
Operands
Address
Get Dividend in HL pair directly from 7501H
7000 2A, 01, 75 LHLD 7501 H memory address

Get Divisor in A reg. directly from 7503H


7003 3A, 03, 75 LDA 7503 H memory address

Move divisor i.e.; A reg. content in B reg.


7006 47 MOV B, A
Count 08 H in C reg.
7007 0E, 08 MVI C, 08 H
up:
7009 29 Shift Dividend & Quotient left by 1-bit
DAD H
Get MSB of Dividend in A reg.
700A 7C MOV A, H
700B 90 SUB B Subtract Divisor from MSB of Dividend
Is MSB of Dividend > Divisor, if no go to 7011
700C DA, 11, 70 JC (down)7011 H H

Get MSB of Dividend in H reg.


700F 67 MOV H, A
Increment L reg. by 1
7010 2C INR L
down: Decrement C reg. by 1
7011 OD
DCR C
Is Count = 0?, If no go to 7009 H
7012 C2, 09, 70 JNZ (up)7009 H
Store Quotient at 7505 H & Remainder at 7506
7015 22, 05, 75 SHLD 7505 H H

7018 CF RST 1 Terminate the program

RESULT:

Input: Output:

7501 H = LSB of Dividend (25 H) 7505 H = Quotient (07 H)


7502 H = MSB of Dividend (00 H) 7506 H = Remainder (02 H)
7503 H = LSB of Divisor (05 H)
7504 H = MSB of Divisor (00 H)

Page 17
8085 Microprocessor Lab Manual

BLOCK TRANSFER OF DATA BYTES


(Without Overlapping)

Experiment 7
AIM: To write an assembly language program for block transfer of 10 data bytes (Without
Overlapping).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
HL is used as memory pointer for 1st block
7000 21, 00, 75 LXI H, 7500 H
whose starting address is 7500 H
DE is used as memory pointer for 2nd block
7003 11, 00, 76 LXI D, 7600 H
whose starting address is 7600 H
7006 0E, 0A MVI C, 0A H C reg. is used as a counter, which tells the
number of data bytes to be transferred
UP:
7008 7E Load the HL memory contents in A reg.
MOV A, M
Store the A reg. contents directly at the memory
7009 12 STAX D
address given by DE reg. pair
700A 23 INX H Increment HL memory address by 1
700B 13 INX D Increment DE memory address by 1
700C 0D DCR C Decrement the counter reg. C by 1
C2, 08, Is counter = 0? If no go to up else executed
700D JNZ UP(7008)
70 below instruction
7011 CF RST 1 Terminate the program

Result:

Starting address of 1st block or Source block: 7500 H.


Starting address of 2nd block or Destination block: 7600 H.
Block length = (10)10 = (0A)H

Page 18
8085 Microprocessor Lab Manual

Before Execution:

Memory Memory
Address Data Address Data

7500 H 00 7600 H 44
7501 H 01 7601 H 77
7502 H 02 7602 H 01
7503 H 03 7603 H 89
7504 H 04 7604 H 14
7505 H 05 7605 H 16
7506 H 06 7606 H 25
7507 H 07 7607 H 47
7508 H 08 7608 H 15
7509 H 09 7609 H 77

1st Block/ Source Block: 2nd Block/ Destination Block:

Page 19
8085 Microprocessor Lab Manual

After Execution:

1st Block/ Source Block: 2nd Block/ Destination Block:

Memory Memory
Address Data Address Data

7500 H 00 7600 H 00
7501 H 01 7601 H 01
7502 H 02 7602 H 02
7503 H 03 7603 H 03
7504 H 04 7604 H 04
7505 H 05 7605 H 05
7506 H 06 7606 H 06
7507 H 07 7607 H 07
7508 H 08 7608 H 08
7509 H 09 7609 H 09

Page 20
8085 Microprocessor Lab Manual

BLOCK TRANSFER OF DATA BYTES


(With Overlapping)

AIM: To write an assembly language program for block transfer of 10 data bytes (With Overlapping).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
HL is used as memory pointer for 1st block
7000 21, 00, 75 LXI H, 7500 H
whose starting address is 7500 H
DE is used as memory pointer for 2nd block
7003 11, 05, 75 LXI D, 7505 H
whose starting address is 7505 H
C reg. is used as a counter, which tells the
7006 0E, 0A MVI C, 0A H
number of data bytes to be transferred
UP:
7008 7E Load the HL memory contents in A reg.
MOV A, M
Store the A reg. contents directly at the memory
7009 12 STAX D
address given by DE reg. pair
700A 2B DCX H Decrement HL memory address by 1
700B 1B DCX D Decrement DE memory address by 1
700C 0D DCR C Decrement the counter reg. C by 1
C2, 08, Is counter = 0? If no go to up else executed
700D JNZ UP(7008)
70 below instruction
7011 CF RST 1 Terminate the program

Result:

Starting address of 1st block or Source block: 7500 H.


Starting address of 2nd block or Destination block: 7505 H.
Block length = (10)10 = (0A)H

Page 21
8085 Microprocessor Lab Manual

Before Execution:

1st Block/ Source Block: 2nd Block/ Destination Block:

Memory Memory
Address Data Address Data

7500 H 00 7505 H 44
7501 H 01 7506 H 77
7502 H 02 7507 H 01
7503 H 03 7508 H 89
7504 H 04 7509 H 14
7505 H 05 750A H 16
7506 H 06 750B H 25
7507 H 07 750C H 47

7508 H 08
SMSMPITR, AKLUJ 750D H 15
7509 H 09 750E H 77
8085 Microprocessor Lab Manual

After Execution:

1st Block/ Source Block: 2nd Block/ Destination Block:

Memory Memory
Address Data Address Data

7500 H 00 7505 H 00
7501 H 01 7506 H 01
7502 H 02 7507 H 02
7503 H 03 7508 H 03
7504 H 04 7509 H 04
7505 H 05 750A H 05
7506 H 06 750B H 06
7507 H 07 750C H 07
7508 H 08 750D H 08
7509 H 09 750E H 09

Page 19
8085 Microprocessor Lab Manual

BLOCK exchange OF DATA BYTES


AIM: To write an assembly language program for block exchange of 10 data bytes (With
Overlapping).

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
HL is used as memory pointer for 1st block
7000 21, 00, 75 LXI H, 7500 H whose starting address is 7500 H

DE is used as memory pointer for 2nd block


7003 11, 00, 76 LXI D, 7600 H whose starting address is 7505 H

7006 0E, 0A MVI C, 0A H C reg. is used as a counter, which tells the


number of data bytes to be transferred

UP: Load the A reg. contents directly from the


7008 1A memory address given by DE reg. pair
LDAX D
7009 46 MOV B, M Copy the content specified by HL to B reg.
Copy the content specified by A reg. to HL
700A 77 MOV M, A pointed memory location

700B 78 MOV A, B Copy the content specified by B reg. to A reg.


Store the A reg. contents directly at the memory
700C 12 STAX D address given by DE reg. pair

700D 23 INX H Increment HL memory address by 1


700E 13 INX D Increment DE memory address by 1
700F 0D DCR C Decrement the counter reg. C by 1
C2, 08, Is counter = 0? If no go to up else executed
7010 JNZ (UP) 7008 H below instruction
70
7013 CF RST 1 Terminate the program

Result:

Starting address of 1st block or Source block: 7500 H.


Starting address of 2nd block or Destination block: 7600 H.
Block length = (10)10 = (0A)H

Page 20
8085 Microprocessor Lab Manual

Before Execution:

1st Block/ Source Block: 2nd Block/ Destination Block:

Memory Memory
Address Data Address Data

7500 H 01 7600 H 11
7501 H 02 7601 H 12
7502 H 03 7602 H 13
7503 H 04 7603 H 14
7504 H 05 7604 H 15
7505 H 06 7605 H 16
7506 H 07 7606 H 17
7507 H 08 7607 H 18
7508 H 09 7608 H 19
7509 H 10 7609 H 20

Page 21
8085 Microprocessor Lab Manual

After Execution:

1st Block/ Source Block: 2nd Block/ Destination Block:

Memory Memory
Address Data Address Data

7500 H 11 7600 H 01
7501 H 12 7601 H 02
7502 H 13 7602 H 03
7503 H 14 7603 H 04
7504 H 15 7604 H 05
7505 H 16 7605 H 06
7506 H 17 7606 H 07
7507 H 18 7607 H 08
7508 H 19 7608 H 09
7509 H 20 7609 H 10

Page 22
8085 Microprocessor Lab Manual

BLOCK REVERSE OF DATA BYTES


AIM: To write an assembly language program for block reverse of 10 data bytes.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
B reg. is used as a counter, which tells the
7000 06, 0A MVI B, 0A H number of data bytes to be transferred

7002 21, 09, 76 LXI H, 7609 H HL is used as memory pointer for 1st block

whose starting address is 7609 H

DE is used as memory pointer for 2nd block


7005 11, 50, 76 LXI D, 7650 H whose starting address is 7650 H

UP: Load the A reg. contents directly from the


7008 7E memory address given by HL reg. pair
MOV A, M
Store the A reg. contents directly at the memory
7009 12 STAX D address given by DE reg. pair

700A 13 INX D Increment DE memory address by 1


700B 2B DCX H Decrement HL memory address by 1
700C 05 DCR B Decrement the counter reg. B by 1
C2, 08, Is counter = 0? If no go to up else executed
700D JNZ UP (7008 H) below instruction
70
7010 CF RST 1 Terminate the program

Result:

Starting address of 1st block or Source block: 7600 H.


Starting address of 2nd block or Destination block: 7650 H.
Block length = (10)10 = (0A)H

Page 23
8085 Microprocessor Lab Manual

Before Execution: After Execution:

1st Block/ Source Block: 2nd Block/ Destination Block:

Memory Memory
Address Data Address Data

7600 H 01 7650 H 10
7601 H 02 7651 H 09
7602 H 03 7652 H 08
7603 H 04 7653 H 07
7604 H 05 7654 H 06
7605 H 06 7655 H 05
7606 H 07 7656 H 04
SM7S6M
07PIHTR, AK0L8UJ 7657 H 03
7608 H 09 7658 H 02
7609 H 10 7659 H 01
8085 Microprocessor Lab Manual

Experiment 8
SMALLEST AND LARGEST NUMBER IN A BLOCK OF DATA
AIM: To write an assembly language program to find the smallest number in a block of data.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Set pointer for block/array
7003 46 MOV B, M Load the Count
Increment the memory pointer (points to next
7004 23 INX H
memory location for next number)
7005 7E MOV A, M Set 1st element as largest data
7006 05 DCR B Decrement the Count
loop: Increment the memory pointer (points to next
7007 23 memory location for next number)
INX H
7008 BE CMP M If A reg. < M go to ahead. If not the go to next
7009 DA, 0D, 70 JC ahead (700D H) step
700C 7E MOV A, M Set the new value as largest
ahead:
700D 05
DCR B Repeat comparisons till Count = 0
700E C2, 07, 70 JNZ loop (7007 H)
7011 32, STA 7600 H Store the largest value at 7600 H
7014 CF RST 1 Terminate the program

RESULT:

Input: Output:

05 H (7500 H) ---- Block/Array Size Result = 0A H (7600 H)


0A H (7501 H)----- 1st no.
F1 H (7502 H) ----- 2nd no.
1F H (7503 H) ---- 3rd no.
26 H (7504 H) ---- 4th no.
FE H (7505 H) ---- 5th no.

Page 23
8085 Microprocessor Lab Manual

LARGEST NUMBER IN A BLOCK OF DATA

AIM: To write an assembly language program to find the largest number in a block of data.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Set pointer for block/array
7003 46 MOV B, M Load the Count
Increment the memory pointer (points to next
7004 23 INX H
memory location for next number)
7005 7E MOV A, M Set 1st element as largest data
7006 05 DCR B Decrement the Count
loop: Increment the memory pointer (points to next
7007 23 memory location for next number)
INX H
7008 BE CMP M If A reg. > M go to ahead. If not the go to next
7009 D2, 0D, 70 JNC ahead (700D H) step
700C 7E MOV A, M Set the new value as largest
ahead:
700D 05
DCR B Repeat comparisons till Count = 0
700E C2, 07, 70 JNZ loop (7007 H)
7011 32, STA 7600 H Store the largest value at 7600 H
7014 CF RST 1 Terminate the program

RESULT:

Input: Output:

05 H (7500 H) ---- Block/Array Size Result = FE H (7600 H)


0A H (7501 H)----- 1st no.
F1 H (7502 H) ----- 2nd no.
1F H (7503 H) ---- 3rd no.
26 H (7504 H) ---- 4th no.
FE H (7505 H) ---- 5th no.

Page 24
8085 Microprocessor Lab Manual

Experiment 9

ARRANGE THE ELEMENTS OF A BLOCK OF DATA IN ASCENDING AND


DESCENDING ORDER

AIM: To write an assembly language program to arrange a block/array or data in ascending order.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Set pointer for block/array
7003 4E MOV C, M Load the Count at 7500 H into C reg.
7004 0D DCR C Decrement the Count
repeat: Copy it in D reg. (for bubble sort (N - 1) times
7005 51
MOV D, C required)
7006 21, 01, 75 LXI H, 7501 H Get the 1st value from 7501 H into H reg.
loop:
7009 7E Get the 1st value in A reg.
MOV A, M
Increment the memory pointer (points to next
700A 23 INX H
memory location for next number)
700B BE CMP M Compare it with the value at next location. If
A < M go to skip. If they are out order go to
700C DA, 14, 70 JC skip (7014 H)
next step
700F 46 MOV B, M
Exchange the contents of A reg. and M
7010 77 MOV M, A
7011 2B DCX H Decrement D reg. content by 1
7012 70 MOV M, B Move back the content of M from B reg.
Increment the memory pointer (points to next
7013 23 INX H
memory location for next number)
skip:
7014 15
DCR D Repeat comparisons till D = 0
7015 C2, 09, 70 JNZ loop (7009 H)
7018 0D DCR C
Repeat comparisons till C = 0
7019 C2, 05, 70 JNZ repeat (7005 H)
701C CF RST 1 Terminate the program

RESULT:
Input: Output:
05 H (7500 H) ---- Block/Array Size 05 H (7500 H) ----- Block/Array Size
05 H (7501 H) ---- 1st no. 01 H (7501 H) ----- 1st no.
04 H (7502 H) ---- 2nd no. 02 H (7502 H) ----- 1st no.
03 H (7503 H) ---- 3rd no. 03 H (7503 H) ----- 1st no.
02 H (7504 H) ---- 4th no. 04 H (7504 H) ----- 1st no.
01 H (7505 H) ---- 5th no. 05 H (7505 H) ----- 1st no.

Page 25
8085 Microprocessor Lab Manual

ARRANGE THE ELEMENTS OF A BLOCK OF DATA IN DESCENDING


ORDER
AIM: To write an assembly language program to arrange a block/array or data in descending order.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Set pointer for block/array
7003 4E MOV C, M Load the Count at 7500 H into C reg.
7004 0D DCR C Decrement the Count
Copy it in D reg. (for bubble sort (N - 1) times
7005 51 repeat: MOV D, C
required)
7006 21, 01, 75 LXI H, 7501 H Get the 1st value from 7501 H into H reg.
7009 7E loop: MOV A, M Get the 1st value in A reg.
Increment the memory pointer (points to next
700A 23 INX H
memory location for next number)
700B BE CMP M Compare it with the value at next location. If
A > M go to skip. If they are out order go to
700C D2, 14, 70 JNC skip (7014 H)
next step
700F 46 MOV B, M
Exchange the contents of A reg. and M
7010 77 MOV M, A
7011 2B DCX H Decrement D reg. content by 1
7012 70 MOV M, B Move back the content of M from B reg.
Increment the memory pointer (points to next
7013 23 INX H
memory location for next number)
7014 15 skip: DCR D
Repeat comparisons till D = 0
7015 C2, 09, 70 JNZ loop (7009 H)
7018 0D DCR C Repeat comparisons till C = 0
7019 C2, 05, 70 JNZ repeat (7005 H)
701C CF RST 1 Terminate the program

RESULT:

Input: Output:

05 H (7500 H) ---- Block/Array Size 05 H (7500 H) ----- Block/Array Size


01 H (7501 H) ---- 1st no. 05 H (7501 H) ----- 1st no.
02 H (7502 H) ---- 2nd no. 04 H (7502 H) ----- 1st no.
03 H (7503 H) ---- 3rd no. 03 H (7503 H) ----- 1st no.
04 H (7504 H) ---- 4th no. 02 H (7504 H) ----- 1st no.
05 H (7505 H) ---- 5th no. 01 H (7505 H) ----- 1st no.

Page 26
8085 Microprocessor Lab Manual

Experiment 10

BCD TO HEX CONVERSION


AIM: To write an assembly language program to convert two BCD numbers in memory to the
equivalent HEX number.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Set pointer for block/array
Get MSD (Most Significant Digit) in A reg.
7003 7E MOV A, M
from M
7004 87 ADD A MSD X 2
7005 47 MOV B, A Store MSD X 2 in B reg.
7006 87 ADD A MSD X 4
7007 87 ADD A MSD X 8
7008 80 ADD B MSD X 10
7009 23 INX H Point to LSD (Least Significant Digit)
700A 86 ADD M Add to form HEX
700B 23 INX H Increment HL by 1
700C 77 MOV M, A Store the result at incremented location
700D CF RST 1 Terminate the program

RESULT:

Input: Output:

7500 H : 02 (MSD) 7502 H : 1D H


7501 H : 09 (LSD)

Page 27
8085 Microprocessor Lab Manual

HEX TO BCD CONVERSION


AIM: To write an assembly language program to convert given Hexa decimal number into equivalent
BCD number.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Initialize memory pointer
7003 16, 00 MVI D, 00 H Clear D reg. for MSB
7005 AF XRA A Clear A reg.
7006 4E MOV C, M Get HEX data
7007 C6, 01 loop2: ADI 01 H Count the number one by one
7009 27 DAA Adjust for BCD count
700A D2, 0E, 70 JNC loop1 (700E H)
700D 14 INR D Perform repeated addition for C number of
700E 0D loop1: DCR C times
700F C2, 07, 70 JNZ loop2 (7007 H)
7012 32, 01, 75 STA 7501 H Store the LSB
7015 7A MOV A, D
7016 32, 02, 75 STA 7502 H Store the MSB
7019 CF RST 1 Terminate the program

RESULT:

Input: Output:

7500 H : FF 7501 H : 55 (LSB)


7502 H : 02 (MSB)

Page 28
8085 Microprocessor Lab Manual

Experiment 11
FIBONACCI SERIES
AIM: To write an assembly language program to generate the Fibonacci series with given first two
terms.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 73 LXI H, 7300 H Load the HL register pair immediately
7003 46 MOV B, M Move the memory content in to B register
7004 23 INX H Increment the HL register pair
7005 4E MOV C, M Move the memory content in to C register
7006 05 DCR B Decrement the B register content
7007 23 INX H Increment the HL register pair
7008 7E MOV A, M Move the memory content in to accumulator
7009 05 DCR B Decrement the B register content
Up:
700A 57 Move the accumulator content to D register
MOV D, A
700B 81 ADD C Add the C register content with accumulator
700C 23 INX H Increment the HL register pair
700D 77 MOV M, A Move the accumulator content to memory
700E 4A MOV C, D Move the D register content to C register
700F 05 DCR B Decrement the B register content
7010 C2, 0A,C1 JNZ (Up) 700A H Jump if no zero to 700A H
7013 CF RST 1 Halt the execution

RESULT:

Memory Data
Address

Input Data: 7300 08 H; Number of input data


7301 00 H; 1st data (Input)
7302 01 H; 2nd data (Input)
Output Data: 7303 01 H; Series of Fibonacci (Output)
7304 02 H; Series of Fibonacci (Output)
7305 03 H; Series of Fibonacci (Output)
7306 05 H; Series of Fibonacci (Output)
7307 08 H; Series of Fibonacci (Output)
7308 0D H; Series of Fibonacci (Output)

Page 29
8085 Microprocessor Lab Manual

Experiment 12

SQUARE OF A GIVEN NUMBER USING LOOK UP TABLE

Aim: To find square of the number from 0 to 9 using Look up table (Table of Square)

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 76 LXI H, 7600 H Initialize Look up table address
3A, 00,
7003 LDA 7500 H Get the data
75
7006 FE, 0A CPI 0A H Check input > 9
DA,
7008 JC after (7011 H) If yes Error
11,70
700B 3E, FF MVI A, FF H Error Indication
700D 32, 01, 75 STA 7501 H Store the result at 7501 H memory address
7010 CF RST 1 Terminate the program
7011 4F after: MOV C, A Add the desired Address
7012 06, 00 MVI B, 00 H
7014 09 DAD B Get HL+BC & store result in HL
7015 7E MOV A, M
7016 32, 01, 75 STA 7501 H Store the result at 7501 H memory address
7019 CF RST 1 Terminate the program

LOOKUP TABLE:

Memory Square
Address

7600 00
7600 01
7601 04
7602 09
7603 16
7604 25
7605 36
7606 49
7607 64
7608 81

RESULT:

Input: 7500 H: 05 H
Output: 7501 H: 25 H (Square)

Input: 7500 H: 11 H
Output: 7501 H: FF H (Error Indication)

Page 30
8085 Microprocessor Lab Manual

SQUARE OF A GIVEN NUMBER USING LOOK UP TABLE


Aim: To find factorial of the given number.

APPARATUS: XPO-85 Microprocessor kit, 5V power supply, Keyboard.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 21, 00, 75 LXI H, 7500 H Load the no. in the Accumulator specified by
the memory location 7500 H.
7003 7E MOV A, M
Compare the no. with 01 H.
7004 FE, 01 CPI 01 H
If not equal go to L1.
7006 C2,0B,70 JNZ L1 (700B)
If no. = 01 H, then load A with 01 H that is the
7009 3E MVI A, 01 H
final answer.
Stop the program.
700A CF RST1
L1:
700B 56 Get the no. in D reg.
MOV D, M
Store the no. at B reg.
700C 46 MOV B, M
BACK:
700D 48 Get the no. in C reg.
MOV C, B
700E 0D DCR C Decrement the no. by 01 H.
700F 0D DCR C Decrement the no. by 01 H.
C2, If not equal to zero then go to BACK.
7010 JNZ BACK (700D)
0D,70
7013 CF RST 1 Terminate the program if equal to zero.
BACK1:
7014 82 Add the no. with D reg. contents.
ADD D
7015 0D DCR C Decrement the no. by o1 H again.
7016 C2, 14,70 JNZ BACK1 (7014) If not equal to zero then go to BACK1.
7019 05 DCR B If equal then decrement B reg. contents.
701A 57 MOV D, A Get addition value in D reg.
C2,
701B JNZ BACK (700D) If not equal to zero then go to BACK.
0D,70
701E CF RST1 If equal, then terminate the program.

RESULT:

Input: 7500 H: 05 H Output: A = 78 H (Factorial)

Page 31
8085 Microprocessor Lab Manual

Hardware Based
(Interfacing with 8085 P)

Contents

Name of the Experiment


Sl. No. Page No.
B) Hardware Based (Interfacing with 8085 P)

Program controlled data transfer using 8255 PPI.


A) To INPUT data bytes from peripheral port and to store them in
1. memory. 33
B) To OUTPUT data bytes from memory to peripheral port.

2. Interfacing 7 segment LED display using 8255A. 35

3. Interfacing of 8253 / 8254. 37

4. Interfacing display 38

Page 32
8085 Microprocessor Lab Manual

Experiment 13

Program controlled data transfer using 8255 PPI


a) To INPUT data bytes from peripheral port & to store them in memory

AIM: To write an assembly language program to input data bytes from peripheral port & to store
them in memory.

APPARATUS: XPO-85 Microprocessor kit, Scanning Technique kit, 5V power supply, Keyboard.

CONNECTIONS: Connect XPO-85 kit with Scanning Technique kit using RS-232 cable. Connect
one end of cable at lower 8255 chip of XPO-85 kit & another end of cable to the Scanning Technique
kit.

ASSEMBLY LANGUAGE PROGRAM:

Memor Opcode Mnemonics & Operands Comments


y
Address
7000 3E, 92 MVI A, 92 H Initialize Port A & Port B as input port in
7002 D3, 0B OUT CWR (0B H) Mode 0 & Port C as output port in Mode 0
Get 00 H in A reg. (As data read from input
device [ here input device is from 4 X 4
7004 3E, 00 MVI A, 00 H
Matrix Keyboard] so to know the data from it
A reg. is initialized with 00 H)
IN PORT B (09 Read a key from 4 X 4 Matrix Keyboard
7006 DB, 09
H) present in Scanning Technique kit.
Store A reg. content i.e., data read from input
7008 32, 00, 75 STA 7500 H
device at 7500 H memory location
700B CF RST 1 Terminate the program

RESULT:

Input:

Press any key from 4 X 4 Matrix Keyboard present in Scanning Technique kit.

Output:

A data is read. It can be observed in A reg. & at memory location 7500 H.

Page 33
8085 Microprocessor Lab Manual

Program controlled data transfer using 8255 PPI


b) To OUTPUT data bytes from memory to peripheral port.

Aim: To write an assembly language program to output data bytes from memory to peripheral
port.

APPARATUS: XPO-85 Microprocessor kit, Scanning Technique kit, 5V power supply, Keyboard.

CONNECTIONS: Connect XPO-85 kit with Scanning Technique kit using RS-232 cable. Connect
one end of cable at lower 8255 chip of XPO-85 kit & another end of cable to the Scanning Technique
kit.

ASSEMBLY LANGUAGE PROGRAM:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 3E, 92 MVI A, 82 H Initialize Port B as input port in Mode 0 &
7002 D3, 0B OUT CWR (0B H) Port A and Port C as output port in Mode 0
Initialize HL as memory pointer & it points
7004 21, 00, 76 LXI H, 7600 H
to 7600 H memory location
7006 7E MOV A, M Data is read from 7600 H memory location &
this data is given or outputted to the output
7008 D3, OA OUT PORT C (0A H) device (here output device is 8 X 8 LED
matrix display)
700B CF RST 1 Terminate the program

RESULT:

Input: Output:

1. At 7600 H location data present is 0FF H 1. All LEDs will OFF

2. At 7600 H location data present is 00 H 2. All LEDs will glow or ON

Conclusion:

Hence 8 X 8 LED Matrix Display is interfaced with 8085.

Page 34
8085 Microprocessor Lab Manual

Experiment 14

Interfacing 7 segment LED display using 8255A


Aim: To write an assembly language program to interface 7-segment LED display using
8255A.

Apparatus: XPO-85 Microprocessor kit, Scanning Technique kit, 5V power supply, Keyboard.

Connections: Connect XPO-85 kit with Scanning Technique kit using RS-232 cable. Connect one
end of cable at lower 8255 chip of XPO-85 kit & another end of cable to the Scanning Technique kit.

Assembly Language Program:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 31, F0, 27 LXI SP, 27F0 H Initialize for Stack Pointer
7003 21, 2F, 70 LXI H, DSPLY (702F H) Pointer for Display
7006 3E, 82 MVI A, 82 H
Port A & Port C o/p & Port B as i/p
7008 D3, 0B OUT CWR
START:
700A 06, 08
MVI B, 08 H Count for Display
700C 0E, FE MVI C, 0FE H
NEXTDSP:
700E 3E, FF
MVI A, 0FF H Blank All Display
7010 D3, 08 OUT PORT A
7012 7E MOV A, M
Display Data
7013 D3, 08 OUT PORT A
7015 23 INX H Data for Next Display
7016 79 MOV A, C
Select Seven Segment Display
7017 D3, 0A OUT PORT C
7019 37 STC Set Carry = 1
701A 17 RAL
Select Next Segment
701B 4F MOV C, A
701C 11, 55, 00 LXI D, 0055 H
Initialize DE pair for Delay Subroutine
701F CD, 15, 06 CALL DELAY
7022 CD, 72, 20 CALL TEST
7025 D2, 0C, 00 JNC CMDMOD
7028 05 DCR B All Segments are Displayed?
JNZ NEXTDSP (700E
7029 C2, 0E, 70 No, Go for Next Display
H)
702C C3, 0A, 70 JMP START (700A H) Yes, Display Again
DSPLY: Code For ‘A’ (LEDs are Active LOW
702F 88
DFB 88 H device)
7030 C8 DFB 0C8 H Code For ‘N’
7031 92 DFB 92 H Code For ‘S’
7032 89 DFB 89 H Code For ‘H’
7033 C1 DFB 0C1 H Code For ‘U’

Page 35
8085 Microprocessor Lab Manual
7034 AA DFB 0AA H Code For ‘M’
7035 88 DFB 88 H Code For ‘A’
7036 C8 DFB 0C8 H Code For ‘N’
END

Conclusion:

Hence 7-Segment LED Matrix Display is interfaced with 8085 and “ANSHUMAN” is displayed on it.

Page 36
8085 Microprocessor Lab Manual

Experiment 14
Interfacing of 8253 / 8254
Aim: To write an assembly language program to interface 8253 / 8254.

Apparatus: XPO-8085 Microprocessor kit, AD/DA – II kit, 5V power supply, Keyboard.

Assembly Language Program:

Memor
y Opcode Mnemonics & Operands Comments
Address
START:
7000 3E, B6
MVI A, 0B6 H Initialize the 8253 Counter 2 mode
7002 D3, 1B OUT CWR
7004 3E, 00 MVI A, 00 H Load LSB count of timer for 1KHz
7006 D3, 1A OUT PORT C Freq.
7008 3E, 01 MVI A, 01 H Load MSB count of timer for 1KHz
700A D3, 1A OUT CWR Freq.
700C 11, FF, FF LXI D, 0FFFF H Count value for delay
700F CD, 15, 06 CALL DELAY Delay routine
JMP START (7000
7012 C3, 00, 70 Execute all again
H)

RESULT:

On execution of the program a Square wave of 10 KHz is generated and this wave is observed using
CRO at pin 17 of 8253 or L24 on motherboard (XPO-85 kit) w.r.t. GND, a Square wave of 10KHz
can be measured.

Conclusion:

Hence 8253 / 8254 is interfaced with 8085.

Page 37
8085 Microprocessor Lab Manual

Experiment 15
Aim: To write an assembly language program to interface display for displaying alphabet ‘A’
on 8 X 8 LED matrix.

Apparatus: XPO-85 Microprocessor kit, Scanning Technique kit, 5V power supply, Keyboard.

Connections: Connect XPO-85 kit with Scanning Technique kit using RS-232 cable. Connect one
end of cable at lower 8255 chip of XPO-85 kit & another end of cable to the Scanning Technique kit.

Assembly Language Program:

Memor
y Opcode Mnemonics & Operands Comments
Address
7000 31, 0F, 27 LXI SP, 27F0 H Initialize for Stack Pointer
7003 21, 2F, 70 LXI H, LDSPLY Pointer for LED Display
7006 3E, 82 MVI A, 82 H
Port A & Port C as O/P & Port B as I/P
7008 D3, 0B OUT CWR
START:
700A 06, 08 Count for LED Display
MVI B, 08 H
700C 0E, 7F MVI C, 7F H
NXTLEDC:
700E 3E, FF
MVI A, 0FF H Blank All LEDs
7010 D3, 08 OUT PORT A
7012 7E MOV A, M
Display Data
7013 D3, 0A OUT PORT C
7015 23 INX H Data for Next LED Column
7016 79 MOV A, C
Select LED Column for Display
7017 D3, 08 OUT PORT A
7019 37 STC Set Carry = 1
701A 1F RAR Select Next Segment
701B 4F MOV C, A
701C 11, 55, 00 LXI D, 5500 H Initialize DE pair for Delay
701F CD, 15, 06 CALL DELAY Delay Subroutine
7022 CD, 72, 20 CALL TEST
7025 D2, 0C, 00 JNC CMDMOD
7028 05 DCR B
All the LEDs are Displayed?
7029 C2, 0E, 70 JNZ NXTLEDC No, Go for Next Display

702C C3, 0A, 70 JMP START Yes, Display Again


LDSPLY:
702F C0
DFB 0C0 H
7030 B7 DFB 0B7 H
7031 77 DFB 77 H
7032 77 DFB 77 H Codes for Displaying ‘A’ On LED
7033 77 DFB 77 H Matrix
7034 77 DFB 77 H
7035 B7 DFB 0B7 H
7036 C0 DFB 0C0 H
END

Page 38
8085 Microprocessor Lab Manual

Result:

On execution of the program alphabet “A” is displayed on 8 X 8 LED Matrix (LEDs are active low
device).

LED C0 B7 77 77 77 77 B7 77
1 2 3 4 5 6 7 8

LED 1 off off on on on on off off


LED 2 off on off off off off on off
LED 3 on off off off off off off on
LED 4 on off off off off off off on
LED 5 on on on on on on on on
LED 6 on off off off on off off on
LED 7 on off off off off off off on
LED 8 on off off off off off off on

Conclusion:
Hence 8 X 8 LED Matrix Display is interfaced with 8085.

Page 39
8085 Microprocessor Lab Manual

Page 40
8085 Microprocessor Lab Manual

Page 41
8085 Microprocessor Lab Manual

Page 42
8085 Microprocessor Lab Manual

Page 43
8085 Microprocessor Lab Manual

Page 44

You might also like