45
Shankersinh Vaghela Bapu Institute of Technology, Gandhinagar Microprocessor and Interfacing (2141001) Laboratory Manual Enrollment No: Name: Department of Electronics & Communication Dec’18-April’19

Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

Shankersinh Vaghela Bapu Institute of

Technology, Gandhinagar

Microprocessor and Interfacing

(2141001)

Laboratory Manual

Enrollment No:

Name:

Department of Electronics & Communication

Dec’18-April’19

Page 2: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

Certificate

This is to certify that the Lab/term work carried out in the subject of

……………………………………………………… and recorded in this journal is

the bonafide work of Mr./Ms. ……………………………………………………

Enrollment No.…………………… Semester ………………… in the branch of

Electronics & Communication Engineering as the coursework requirement

for Bachelor of Engineering during the academic year ……………………….

Faculty in Charge HOD, EC

Page 3: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

Branch:- Electronics & Communication Year/Sem :- 2nd Year/ 4th Subject & Subject Code:- Microprocessor And Interfacing (2141001)

Sr.

No Topics Date

Grade Sign

01 Introduction to the Microprocessor 8085 Trainer

Kit.

02

To perform programs related to data transfer

instruction.

1. Write an ALP to Store 32H in accumulator

and store this data to all internal register.

2. Write an ALP to store 12h in accumulator

and store this data to memory location

2050h.

03

To perform programs related to data transfer

instruction.

1. Write an ALP to transfer a byte from

memory location 2000H to 3000H.

2. Write an ALP to transfer six bytes of data

from memory location 2000H to 2005H to

the memory location 3000H to 3005H.

3. Transfer the byte from memory location

2000H to the location 3000H using indirect

addressing mode.

04

To perform programs related to Arithmetic

instruction.

1. Load 56H in Accumulator and B7H in

Reg. C. Add these two numbers and store

answer at the memory location 2210 H

2. Store two numbers in memory locations

2000 H and 2001 H. Add these two

numbers and store result on memory

location 2002H (numbers are 59H and

77H).

05

To perform programs related to Arithmetic

instruction.

1. Load the accumulator by 45H and get

another number from memory location

2300H (F9H) and add the two numbers.

Store the result to location 2400H. Check

the carry flag.

2. Get two numbers from memory locations

SHANKERSINH VAGHELA BAPU INSTITUTE

OF TECHNOLOGY Table of Contents

Page 4: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

- 2 -

2000 H and 2001 H (59H and 77H).

Perform subtraction operation (59 – 77).

Store the result to location 2002H. Check

for carry flag.

3. Load a number 49H in reg. B and number

12H in reg. A. Perform subtraction and

store result to memory location 2200 H.

06

To perform programs related to Logical

instruction.

1. A memory location 2500H contains 50 H

data. Write an ALP to convert this data to

05h. Store the modified number to location

2300 H.

2. Load 93H in register A and 6CH in

register B and perform the EX-OR

operation with the numbers and store

result on memory location 2500H.(Note:

use only AND ,OR and compliment

operation).

07

To perform programs related to Logical

instruction.

1. A memory location 2500 H contains 88h

data. Mask the bits D2, D3, D6 and D7 of

the byte and store result on memory

location 2501H.

2. A memory location 2500H contains 70h

data. Find out the compliment of this

number with the help of only AND and OR

operation. Store result on memory location

2501H. (Verify by using compliment

instruction).

3. Write an ALP to set a number from

memory location 2040H and convert the

number to 2’s complement number and

store result in memory location 2041H.

08

To perform programs related to Rotate and

Branch instruction.

1. Write an ALP to find out the square root

of the given number. Store the result into

the B register.

2. Write an ALP to find out the square of the

given number. Store the result into the B

register.

09

To perform programs related to Rotate and

Branch instruction.

1. Write an ALP to find out 1’s and 0’s

present in the 8A H number

2. Write an ALP to load one 8bit number in

D register increment it until Overflow flag

is set.(Check the Overflow flag)

Page 5: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

- 3 -

3. Write an ALP to decrement the contain of

DE Register pair. Decrement it until lower

8 bit is set to 00.

10

To perform programs related to compare

instruction.

1. Write an ALP to load one number into the

B register and compare it with contain of

A register. If

A>B Contain of C register = 01 H

A=B Contain of C register = 00 H

A<B Contain of C register = 02 H

2. Write an ALP to find a maximum number

from 5 numbers located on memory

starting from 2100H onwards. Store the

number on location 2500H.

3. Write an ALP to generate the delay of 1

Second.

11

To perform programs related to stack instruction.

1. Write an ALP to store contains of PSW

and A register to the memory location

2250H and retrieve the data.

2. Write an ALP to store contains of BC pair

to memory location 2520H and 2521H.

Transfer the data of this two memory

location to 2500H and 2501H.

3. Write an ALP to generate 1 second delay.

Write one separate subroutine for delay.

(Use : Call And RET instruction)

Page 6: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 1

EXPERIMENT- 1

Date: / /20

AIM: Introduction to the Microprocessor 8085 Trainer Kit.

Configuration of Microprocessor 8085 Trainer Kit

1 SYSTEM OVERVIEW

MICROPROCESSOR 8085 TRAINER KIT is a single board computer based on 8085 CPU

designed especially for training and development applications.

It is equally useful for a novice as well as development engineers for studying the 8085 CPU

and developing various product based on the 8085.

1.1. SYSTEM HARDWARE OVERVIEW

CENTRAL PROCESSING UNIT

MICROPROCESSOR 8085 TRAINER KIT is based on the 8085 high performance CPU

operating at 3.07 MHz clock frequency and at 6.14 oscillator frequency.

MEMORY

MICRO-85 LCD Kit provides 8K bytes of CMOS RAM using 6264 chip and 16K bytes of

Powerful Monitor EPROM. This Kit has the facility for expanding RAM/ROM in the

expansion socket. Total on board memory can be expanded up to 64K bytes.

I/O DEVICES

The I/O chip used in µicro-85 Kit is 8255. The functional role of all these chips is given

below:

8255 (Programmable Peripheral Interface)

8255 is a programmable peripheral interface (PPI) designed to use with 8085

Microprocessor. This basically acts as a general purpose I/O device to interface peripheral

equipments to the system bus. It is not necessary to have an external logic to interface with

peripheral devices since the functional configuration of 8255 is programmed by the system

software. It has got three Input/Output ports of 8 lines each (PORT-A, PORT-B & PORT-C).

Port C can be divided into two ports of 4 lines each named as Port C upper and Port C lower.

Any Input/Output combination of Port A, Port B, Port C upper and lower can be defined

using the appropriate software commands.

Page 7: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 2

KEYBOARD DESCRIPTION

The MICRO-85 Kit has 28 keys and 6 LED to communicate with the outside world

LIST OF KEYBOARD COMMANDS

EXMEM Examine/Modify Memory

EXREG Examine/Modify Register

S Single Step

G Go

. Dot

INS Insert

DEL Delete

F Fill

NEXT Next

PRE Previous

RESET Reset

INT Interrupt

2. SYSYEM MEMORY MAPPING

µicro-85 LCD Kit provides 8K byte of RAM and 16K byte of of EPROM. The total onboard

memory can be expanded to 64K bytes. There are three memory sockets (28 Pin Each)

provided on the board. Each socket can be defined to have any address between 0000-FFFF.

There are three memory sockets namely MEM0, MEM1 & MEM2.

MEM0 is defined as Monitor Program having 16K Bytes of Powerful Monitor Program is

Embedded in the 27C512 EPROM. For the system operation the monitor should start from

address 0000. The Memory address is from `0000 to 1FFF' & E000 to FFFF.

MEM1 is defined as user RAM of 8K bytes (6264). The address is from `2000 to 3FFF' for

the user RAM. The monitor uses certain portion of this RAM for temporary use i.e. scratch

pad area. This area is from 2600 to 27FF. The user is advised not to use this area for

storing program.

MEM2 is defined as expansion for RAM of 32K bytes (62256). The address

is from `6000 to DFFF'.

Page 8: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 3

3. APPLICATION OF MICROPROCESSOR TRAINER KIT

MICROPROCESSOR TRAINER KIT is the low cost learning and development system for

beginners as well as development engineers.

The powerful friendly FIRMWARE allows you to learn all applications of 8085 and its

support chips like 8255 PPI, 8155 PPI and Timer, 8279 programmable keyboard and display

controller, 8253 programmable timer and counter etc.

You can load, debug and finalize your program on the MICROPROCESSOR TRAINER KIT

and once the development is finalized it can also be used as an OEM board.

The areas of application on MICROPROCESSOR TRAINER KIT are as follows:-

1. Analog to Digital Converter Interface.

2. Digital to Analog Converter Interface.

3. Interfacing Hexadecimal Keyboard.

4. Simulation of an Elevator.

5. Temperature Controller Interface.

6. Stepper Motor Controller.

7. Traffic Light Control System.

8. DC Motor Controller.

9. Thumbwheel Interface.

Page 9: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 4

In all Experimental Laboratory, student will follow following procedural steps :

Step 1: Analyzing/Defining the Problem:

The first step in writing a program is to think very carefully about the problem

that you want the program to solve. In other words, ask yourself many times,

“what do I really want this program to do ? “ It is good idea to write down exactly

what you want the program to do and the order in which you want the program

to do it. At this point student should not write down program statements, should

write the operations in general terms.

Step 2: Designing the solution/Representing Program Operations:

The formula or sequence of operations used to solve a programming problem is often

called the algorithm of the program. Draw flowchart or use pseudo code to represent

program which you want to write to solve your problem. In EXPERIMENT it is better

to use flowchart.

Step 3: Implementing the Solution

3.1 Define your Constant, Variables & Pointers for the program.

3.2 Finding the right instruction:

After student prepare flowchart of a program, the next step is to determine the

instruction statements required to do each part of the program. Student has to

remember the complete instruction set for 8085.Each statement in flow chart could

be implemented using one or more instructions.

Standard program format for assembly language program:

Student should finally write the program in following format:

3.3 Constructing the machine codes from 8085 instructions:

Student will refer the table and manually convert its assembly language program into

machine code.

Step 4: Loading/Running the solution:

Student will use trainer kit to load his machine code program in RAM and run his

program. Student will use debugging tools availed in EXPERIMENT kit to find out the

software bugs in the program.

Step 5: Testing the Solution

Test the solution by observing the content of various registers and memory addresses.

This is the standard procedure for all EXPERIMENT experiments, hence not required

to write separate procedure for all experiments. Observe the following example.

Memory Address Label Mnemonics Label Hex Code Comments

2100 start: MVI A, 55 3E,55H ;Acc=55

LXI H, Set HL pointer for source XX50 memory LXI D, Set DE pointer for destination XX70 memory MVI B,10 Set B as a byte counter

Page 10: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 5

Example: Move a block of 8-bit numbers from one place to other place.

Data(H): 37, A2, F2, 82, 57, 5A, 7F, DA, E5, 8B, A7, C2, B8, 10, 19, 98

Step 1: By analyazing the problem statement, you require following things.

i) Block size (How many number of 8-bit numbers you want to move)

ii) Source Memory Pointer

iii) Destination Memory Pointer

Step 2: Desiging the solution/Representing Program Step 3: Implementing the Solution

Operations. (Flow Chart for block transfer) 3.1 Define your Constant, Variables

& Pointers

3.2 Finding the right instruction:

LXI H, Set HL pointer for source

XX50 memory

LXI D, Set DE pointer for destination

XX70 memory

MVI B,10 Set B as a byte counter

NEXT: Get data from source memory

MOV A,M

STAX D Store data in destination

memory

INX H H

INX D Get ready for next byte

DCR B

JNZ NEXT Go back to next byte if

counter is not equal to 0

Page 11: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 6

Step 3: Implementing the Solution

3.3 Constructing the machine codes from 8085 instructions:

Memory

Address

Label Mnemonics Label Hex code Comments

XX00 START LXI H, XX50H 21, 50, XX Set HL as Source Pointer

XX03 LXI D, XX70H 11, 70, XX Set DE as Destination Pointer

XX06 MVI B, 10H 06, 10 Set B to Count 16 Bytes

XX08 NEXT MOV A,M 7E Get Data byte from source memory

XX09 STAX D 12 Store data byte at destination

XX0A INX H 23 Point HL to next source location

XX0B INX D 13 Point DE to next destination

XX0C DCR B 5 One transfer is complete,

decrement count

XX0D JNZ NEXT C2, 08, XX If counter is not 0,

go back to transfer next byte

XX10 HLT 76 End of Program.

Step 4: Loading/Running the solution:

Steps to Enter the program in Kit:

· Press RESET Key

· Press EXMEM Key

· Enter Starting Program Address

· Press NEXT key

· Enter Hex Code & Press NEXT Key; repeat this step until last Hex code

· Press . (Dot) Key

Steps to run the program:

· Press RESET Key

· Press G Key

· Enter Starting Program Address

· Press . (Dot) Key to execute.

Steps to check registers content after running the code:

· Press RESET Key

· Press SHIFT & EXREG Key

· Press the A Key to check accumulator

· Press NEXT key to check all other register’s content.

Page 12: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 7

Step 5: Testing the Solution

After running the program content of the memory addresses:

After Execution

Memory Data

XX70 37

XX7F 98

Data: XX50 37

XX5F 98

Page 13: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 8

EXPERIMENT- 2

Date: / /20

AIM: To perform programs related to data transfer instruction.

1. Write an ALP to Store 32H in accumulator and store this data to all internal

register.

2. Write an ALP to store 12h in accumulator and store this data to memory location

2050h.

Instructions Used.

MVI Rs, #data

MOV Rs, Rd

LDA 16 bit address

STA 16 bit address

LXI Rp, 16 bit address

MOV Rs, M

MOV M, Rd

LDAX Rp

STAX Rp

Study the above instructions from the book. As per the common procedure specified in this

manual, perform the following programs.

Example program :-

Write an ALP (Assembly Language Program) to store 52H in accumulator and transfer this data

to memory location 2060H.

Observation:

Memory Address Assembly language

instructions

Hex Code

D000H MVI A,52H 3EH

D001H 52H

D002H LXI H,2060H 21H

D003H 60H

D004H 20H

D005H MOV M,A 77H

D006H HLT 76H

Page 14: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 9

Assignment Program:

1. Write an ALP to Store 32H in accumulator and store this data to all internal

register

Program:

Observation:

2. Write an ALP to store 12h in accumulator and store this data to memory location

2050h.

Program:

Page 15: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 10

Observation:

Conclusion:

Page 16: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 11

EXPERIMENT- 3

Date: / /20

AIM: To perform programs related to data transfer instruction.

1. Write an ALP to transfer a byte from memory location 2000H to 3000H.

2. Write an ALP to transfer six bytes of data from memory location 2000H to 2005H to

the memory location 3000H to 3005H.

3. Transfer the byte from memory location 2000H to the location 3000H using indirect

addressing mode.

Instructions Used:

MVI Rs, #data

MOV Rs, Rd

LDA 16 bit address

STA 16 bit address

LXI Rp, 16 bit address

MOV Rs, M

MOV M, Rd

LDAX Rp

STAX Rp

Assignment Program:

1. Write an ALP to transfer a byte from memory location 2000H to 3000H.

Program:

Page 17: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 12

Observation:

2. Write an ALP to transfer six bytes of data from memory location 2000H to 2005H to

the memory location 3000H to 3005H.

Program:

Observation:

3. Transfer the byte from memory location 2000H to the location 3000H using indirect

addressing mode.

Program:

Page 18: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 13

Observation:

Conclusion:

Page 19: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 14

EXPERIMENT- 4

Date: / /20

AIM: To perform programs related to Arithmetic instruction.

1. Load 56H in Accumulator and B7H in Reg. C. Add these two numbers and store

answer at the memory location 2210 H

2. Store two numbers in memory locations 2000 H and 2001 H. Add these two

numbers and store result on memory location 2002H (numbers are 59H and 77H).

Instructions Used.

MVI Rs, #data

LDA 16 bit address

STA 16 bit address

ADD Rs

SUB Rs

ADC Rs

SBB Rs

Study the above instructions from the book. As per the common procedure specified in this

manual, perform the following programs.

Example program :-

Write an ALP to load 73H in accumulator and F7H in register C. Add these two numbers and

store the answer at memory location 2200 H..

Memory Address Assembly language

instructions

Hex Code

D000H MVI A,73H 3EH

D001H 73H

D002H MVI C,F7H 0EH

D003H F7H

D004H ADD C 81H

D005H LXI H,2100H 21H

D006H 00H

D007H 21H

D008H MOV M,A 77H

D009H HLT 76H

Page 20: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 15

Observation:

Assignment Program:

1. Load 56H in Accumulator and B7H in Reg. C. Add these two numbers and store

answer at the memory location 2210 H.

Program:

Observation:

2. Store two numbers in memory locations 2000 H and 2001 H. Add these two

numbers and store result on memory location 2002H (numbers are 59H and 77H).

Program:

Page 21: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 16

Observation:

Conclusion:

Page 22: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 17

EXPERIMENT- 5

Date: / /20

AIM: To perform programs related to Arithmetic instruction.

1. Load the accumulator by 45H and get another number from memory location

2300H (F9H) and add the two numbers. Store the result to location 2400H. Check

the carry flag.

2. Get two numbers from memory locations 2000 H and 2001 H (59H and 77H).

Perform subtraction operation (59 – 77). Store the result to location 2002H. Check

for carry flag.

3. Load a number 49H in reg. B and number 12H in reg. A. Perform subtraction and

store result to memory location 2200 H.

Instructions Used.

MVI Rs, #data

LDA 16 bit address

STA 16 bit address

ADD Rs

SUB Rs

ADC Rs

SBB Rs

Assignment Program:

1. Load the accumulator by 45H and get another number from memory location

2300H (F9H) and add the two numbers. Store the result to location 2400H. Check

the carry flag.

Program:

Page 23: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 18

Observation:

2. Get two numbers from memory locations 2000 H and 2001 H (59H and 77H).

Perform subtraction operation (59 – 77). Store the result to location 2002H. Check

for carry flag.

Program:

Observation:

3. Load a number 49H in reg. B and number 12H in reg. A. Perform subtraction and

store result to memory location 2200 H.

Program:

Page 24: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 19

Observation:

Conclusion:

Page 25: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 20

EXPERIMENT- 6

Date: / /20

AIM: To perform programs related to Logical instruction.

1. A memory location 2500H contains 50 H data. Write an ALP to convert this data to

05h. Store the modified number to location 2300 H.

2. Load 93H in register A and 6CH in register B and perform the EX-OR operation

with the numbers and store result on memory location 2500H.(Note: use only AND

,OR and compliment operation).

Instructions Used.

MVI Rs, #data

LDA 16 bit address

STA 16 bit address

ANA Rs

ANI #8 bit data

ORA Rs

ORI #8 bit data

CMA

XRA Rs

Study the above instructions from the book. As per the common procedure specified in this

manual, perform the following programs.

Example program :-

Write an ALP to load 70H in accumulator and 5BH in register B. Perform Logical AND

operation on these two data and store the result at memory location 2500H.

Memory Address Assembly language

instructions

Hex Code

D000H MVI A,70H 3EH

D001H 70H

D002H MVI B,5BH 06H

D003H 5BH

D004H ANA B A0H

D005H LXI H,2500H 21H

D006H 00H

D007H 25H

D008H MOV M,A 77H

D009H HLT 76H

Page 26: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 21

Observation:

Assignment Program:

1. A memory location 2500H contains 50 H data. Write an ALP to convert this data

to 05h .Store the modified number to location 2300 H.

Program:

Observation:

2. Load 93H in register A and 6CH in register B and perform the EX-OR

operation with the numbers and store result on memory location 2500H.(Note:

use only AND ,OR and compliment operation).

Program:

Page 27: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 22

Observation:

Conclusion:

Page 28: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 23

EXPERIMENT- 7

Date: / /20

AIM: To perform programs related to Logical instruction.

1. A memory location 2500 H contains 88h data. Mask the bits D2, D3, D6 and D7 of

the byte and store result on memory location 2501H.

2. A memory location 2500H contains 70h data. Find out the compliment of this

number with the help of only AND and OR operation. Store result on memory

location 2501H. (Verify by using compliment instruction).

3. Write an ALP to set a number from memory location 2040H and convert the

number to 2’s complement number and store result in memory location 2041H.

Instructions Used.

MVI Rs, #data

LDA 16 bit address

STA 16 bit address

ANA Rs

ANI #8 bit data

ORA Rs

ORI #8 bit data

CMA

XRA Rs

Assignment Program:

1. A memory location 2500 H contains 88h data. Mask the bits D2, D3, D6 and D7 of

the byte and store result on memory location 2501H.

Program:

Page 29: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 24

Observation:

2. A memory location 2500H contains 70h data. Find out the compliment of this

number with the help of only AND and OR operation. Store result on memory

location 2501H. (Verify by using compliment instruction).

Program:

Observation:

3. Write an ALP to set a number from memory location 2040H and convert the

number to 2’s complement number and store result in memory location 2041H.

Program:

Page 30: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 25

Observation:

Conclusion:

Page 31: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 26

EXPERIMENT- 8

Date: / /20

AIM: To perform programs related to Rotate and Branch instruction.

1. Write an ALP to find out the square root of the given number. Store the result into

the B register.

2. Write an ALP to find out the square of the given number. Store the result into the B

register.

Instructions Used.

MVI Rs, #data LDAX Rp

MOV Rs, Rd STAX R

LXI Rp, 16 bit address JNZ 16 bit address

MOV Rs, M JNC 16 bit address

RAR ADD Rs

RAL ADC Rs

RRC INC R,

RLC DEC R

Study the above instructions from the book. As per the common procedure specified in this

manual, perform the following programs.

Example program :-

Write an ALP to transfer data from memory locations 2500H – 2505H to memory locations

2800H to 2805H.

Memory Address Assembly language

instructions

Hex Code

D000H LXI H,2500H 21H

D001H 00H

D002H 25H

D003H LXI D,2800H 11H

D004H 00H

D005H 28H

D006H MVI B,05H 06H

D007H 05H

D008H LOOP1 : MOV A,M 7EH

D009H STAX D 12H

Page 32: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 27

D00AH INX H 23H

D00BH INX D 13H

D00CH DCR B 05H

D00DH JNZ LOOP1 C2H

D00EH 08H

D00FH D0H

D010H HLT 76H

Observation:

Assignment Program:

1. Write an ALP to find out the square root of the given number. Store the result into

the B register.

Program:

Observation:

Page 33: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 28

2. Write an ALP to find out the square of the given number. Store the result into the B

register.

Program:

Observation:

Conclusion:

Page 34: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 29

EXPERIMENT- 9

Date: / /20

AIM: To perform programs related to Rotate and Branch instruction.

1. Write an ALP to find out 1’s and 0’s present in the 8A H number

2. Write an ALP to load one 8bit number in D register increment it until Overflow flag

is set.(Check the Overflow flag)

3. Write an ALP to decrement the contain of DE Register pair. Decrement it until

lower 8 bit is set to 00.

Instructions Used.

MVI Rs, #data LDAX Rp

MOV Rs, Rd STAX R

LXI Rp, 16 bit address JNZ 16 bit address

MOV Rs, M JNC 16 bit address

RAR ADD Rs

RAL ADC Rs

RRC INC R,

RLC DEC R

Assignment Program:

1. Write an ALP to find out 1’s and 0’s present in the 8A H number

Program:

Page 35: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 30

Observation:

2. Write an ALP to load one 8bit number in D register increment it until Overflow flag

is set.(Check the Overflow flag)

Program:

Observation:

3. Write an ALP to decrement the contain of DE Register pair. Decrement it until

lower 8 bit is set to 00.

Program:

Page 36: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 31

Observation:

Conclusion:

Page 37: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 32

EXPERIMENT- 10

Date: / /20

AIM: To perform programs related to compare instruction.

1. Write an ALP to load one number into the B register and compare it with contain of

A register. If

A>B Contain of C register = 01 H

A=B Contain of C register = 00 H

A<B Contain of C register = 02 H

2. Write an ALP to find a maximum number from 5 numbers located on memory

starting from 2100H onwards. Store the number on location 2500H.

3. Write an ALP to generate the delay of 1 Second.

Instructions Used.

MOV Rs, Rd

LXI Rp, 16 bit address

MVI SP, 16 bit address

MOV Rs, M

MOV M,Rs

LDAX Rp

STAX Rp

CMP R

CMP M

CPI # 8 bit data

JNZ 16 bit address

Study the above instructions from the book. As per the common procedure specified in this

manual, perform the following programs.

Example program :-

Write an ALP to compare two numbers stored in two memory locations 2050H and 2051H and

produce the result as below: If the data of location 2050H is less than the data of the location

2051H then store FFH at location 2052H else store 00H.

Memory Address Assembly language

instructions

Hex Code

D000H LXI H,2050H 21H

Page 38: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 33

D001H 50H

D002H 20H

D003H MOV A,M 7EH

D004H MOV B,A 47H

D005H INR L 2CH

D006H MOV A,M 7EH

D007H MOV C,A 4FH

D008H MOV A,B 78H

D009H CMP C B9H

D00AH JC LOOP1 DAH

D00BH 13H

D00CH D0H

D00DH MVI A,00H 3EH

D00EH 00H

D00FH STA 2052H 32H

D010H 52H

D011H 20H

D012H HLT 76H

D013H LOOP1 : MVI A,FFH 3EH

D014H FFH

D015H STA 2052H 32H

D016H 52H

D017H 20H

D018H HLT 76H

Observation:

Page 39: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 34

Assignment Program:

1. Write an ALP to load one number into the B register and compare it with contain of

A register. If

A>B Contain of C register = 01 H

A=B Contain of C register = 00 H

A<B Contain of C register = 02 H

Program:

Observation:

2. Write an ALP to find a maximum number from 5 numbers located on memory

starting from 2100H onwards. Store the number on location 2500H.

Program:

Page 40: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 35

Observation:

3. Write an ALP to generate the delay of 1 Second.

Program:

Page 41: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 36

Observation:

Conclusion:

Page 42: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 37

EXPERIMENT- 11

Date: / /20

AIM: To perform programs related to stack instruction.

1. Write an ALP to store contains of PSW and A register to the memory location

2250H and retrieve the data.

2. Write an ALP to store contains of BC pair to memory location 2520H and 2521H.

Transfer the data of this two memory location to 2500H and 2501H.

3. Write an ALP to generate 1 second delay. Write one separate subroutine for delay.

(Use : Call And RET instruction)

Instructions Used.

MOV Rs, Rd

MVI Rs, #data

LXI Rp, 16 bit address

PUSH

POP

CALL 16 BIT

RET

Study the above instructions from the book. As per the common procedure specified in this

manual, perform the following programs.

Example program :-

Write a ALP to alter the contents of flag register in 8085.

Memory Address Assembly language

instructions

Hex Code

D000H PUSH PSW F5H

D001H POP H E1H

D002H MOV A, L 7DH

D003H CMA 2FH

D004H MOV L, A 6FH

D005H PUSH H E5H

D006H POP PSW F1H

D007H HLT 76H

Page 43: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 38

Observation:

Assignment Program:

1. Write an ALP to store contains of PSW and A register to the memory location

2250H and retrieve the data.

Program:

Observation:

2. Write an ALP to store contains of BC pair to memory location 2520H and 2521H.

Transfer the data of this two memory location to 2500H and 2501H.

Program:

Page 44: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 39

Observation:

3. Write an ALP to generate 1 second delay. Write one separate subroutine for delay.

(Use : Call And RET instruction)

Program:

Page 45: Microprocessor and Interfacing (2141001) · Subject & Subject Code:- Microprocessor And Interfacing (2141001) Sr. No Topics Date Grade Sign 01 Introduction to the Microprocessor 8085

MICROPROCESSOR AND INTERFACING (2141001)

SVBIT/EC Dept 40

Observation:

Conclusion: