222
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING EE P62 Microprocessors Laboratory LABORATORY MANUAL ACADEMIC YEAR 2012-2013

MP8085 Lab Manual

Embed Size (px)

DESCRIPTION

Microprocessor 8085 Lab Manual

Citation preview

Page 1: MP8085 Lab Manual

SRI MANAKULA VINAYAGAR ENGINEERING

COLLEGE

DEPARTMENT OF ELECTRICAL AND

ELECTRONICS ENGINEERING

EE P62 Microprocessors Laboratory

LABORATORY MANUAL

ACADEMIC YEAR 2012-2013

Prepared

By

Page 2: MP8085 Lab Manual

C.Kalaivani

2

Page 3: MP8085 Lab Manual

INDEX

S.No. Date Name of the ExperimentPage No.

Marks Remarks

3

Page 4: MP8085 Lab Manual

S.No. Date Name of the ExperimentPage No.

Marks Remarks

4

Page 5: MP8085 Lab Manual

8085 ARCHITECTURE:

5

Page 6: MP8085 Lab Manual

6

Page 7: MP8085 Lab Manual

STUDY OF MICROPROCESSOR KIT

AIM:

To study the entire structure parts and application of 8085 microprocessor

trainer kit.

BASIC FEATURE:

24 TTL lines

Hardware single stepping and software

Single stepping of user program EB-2

Rs 232-c compatible serial port

Bus expansion for inter facing VbMb series of for add-ox cards and

24TTL input-output times.

HARDWARE SPECIFICATION:

1. Processor clock features:

Intel 8085A at 6.144MHz.

2.Memory:

Monitor EPROM - 0000 to 1FFF

EPROM expansions - 2000 to 3FFF & C000 to FFFF

System RAM - 4000 to 5FFF

Monitor data area - 4000 to 40FF

User RAM data area - 4100 to 5FFF

Ram expansion - 6000 to BFFF

2. INPUT/OUTPUT:

7

Page 8: MP8085 Lab Manual

Parallel:

48TTL I/O lines using two no.s of 8255

Series:

One no.of Rs 232C compatible serial interfaces using 8251A

VSARI

Timer :

3-channel 16 bit programmable timer using 8253 .

channel - 0 : Banel rate clock generater for 8251 A 5 .

USARI .

Channel - 1 : Single stepping user program

Channel - 2 : Hardware single stepping user

programming .

4. DISPLAY :

6 – digit , 0.3”, 7 – segment RED ( E1 )

display with filter .

4 - digit - address display

2 - digit - data display

5 . DISPLAY KEYBOARD :

21 keys ( soft keys including command keys and

hexadecimal keys )

6.POWER SUPPLY :

5V @ 1A

5V @ 500 ma - EB1

+ 12 V @ 200 ma

8

Page 9: MP8085 Lab Manual

- EB2

- 12 V @ 100 ma

7 . POWER SUPPLY CONNECTION : ( EXTERNAL )

EB2

i/p - 230 v AC @ 50 HZ

o/p - 5v @ 3A

EB1

230 V AC @ 50 HZ

5V @ 600 mA .

SOFTWARE SPECIFICATION :

Moniter program - 8 K

Hex key function

1. Hex key .

2. Register key

3. Command key .

21 KEYS :

16 keys - hex , command , register keys

remaining are stored alone keys .

KEY :

1 . Hex keys ‘0’ , 1 ,2 , …. F

2 . SUB - substituting the memory contents .

when ‘NEXT’ key is pressed , immediately

press after this key it makes the user program .

( user RAM 4100 )

3 . Register key ‘E’

Examine 8085 register keys .

9

Page 10: MP8085 Lab Manual

TW - Writes data from memory on to the audio tape .

TR - Retries data from an audio tape to memory .

BLOC - Block serch for a byte .

FILL - Fill a block of RAM memory with desired data.

SER - Transmit / receive data to/ from the serial port .

F2 – Function key.

GO – Start running a particular program.

SNG – Single step a program instruction by instruction

PL – Register key PCL.

PH - Register key PCH.

PC – program counter.

H –high

L – low

F3 – Function key

F[0] – Input a byte from a port.

F[1] - Output a byte from a port.

F3 with SNG –For hardware single steeping

Sl –Register key SPL

Sh - Register key SPL.

Bc-check a particular block for blank.

Sp –Stack pointer

MOV –Move a block of memory to another block

CMP-Compare 2 memory blocks

INS –Insert a byte with memory

DEL- Delete a byte with memory

10

Page 11: MP8085 Lab Manual

INPUT OUTPUT ALLOCATION TABLE:

USER DEVELOPMENT

2nd parallel port (8255)

1st parallel port (8255)

8253

HARDWARE SINGLE

STEP CONTROL

KEYBOARD/DISPLAY

CONTROLLER

JUMPER KEYS:

J3 &J4 –RAM

J5 –EPROM

11

Page 12: MP8085 Lab Manual

BATTERY BACK UP:

3.6V @ 60mA Nickel cadmium battery is used which

provides power to RAM during power –OFF and gets charged

during power -ON. The data in RAM can be retained to a

maximum of 12 hours if the battery has been charged to its

maximum extent.

1.SUBSTITUTE MEMORY COMMAND :

Used to examine the contents of selected memory location and modify its content

if desired . Reset - sub - add - next - data - …. - INT INT - press

INT to terminate the sub command .

Pressing the NEXT after entry of desired data will put the entered data

to memory location desired them .

2. REGISTER COMMAND :

To examine the register content . Reset - reg - b - 45 - NEXT - ….

- INT

3. GO AND EXECUTE COMMAND :

GO - used to run a program . This command transfer to control of 8085

MPU , from keypad moniter to user program . GO - address - EXEC

4. GO AND EXECUTE COMMAND WITH BREAK POINT :

12

Page 13: MP8085 Lab Manual

This command execute a block of program whose start address are

specified . It is equivalent to pressing INTR key while the program is

being executed .

GO - starting address - NEXT - break point address - EXEC - content

will be displayed - reg - b ( or ) - content will be displayed

5. SINGLE STEP:

This command helps the user to execute programs in steps ( ie ., )

instruction by instruction

Useful while debugging SNG - address - NEXT

6. FILL COMMAND :

FILL - starting address - NEXT - final address - data - INT

This command moves permits a block of RAM memory to be filled with

desired data type .

7. BLOCK MOVE COMMAND :

This command moves the content of a specified block of memory to

another block of memory whose starting address is specified .

MOV - starting add - NEXT - ending add - NEXT - destination add -

NEXT - INT

8. COMPARE COMMAND :

This command compares the contents of two blocks of memory

locations and display address whose contents are not identical

13

Page 14: MP8085 Lab Manual

CMP - starting add - NEXT - ending add - NEXT - destination address

- NEXT - INT

9. INSERT COMMAND :

This command inserts the specified bytes in desired memory location

INS - ending add - NEXT - insert add - NEXT - data - NEXT - INT

10. DELETE COMMAND :

This command delete byte from memory . DEL - block start address -

NEXT - block and address - NEXT - program end address - NEXT

The block starting from ( block and address + 1 ) to the program end

address will be moved to the block starting address from block start

address .

11. INPUT COMMAND :

This command inputs data from desired port .

F3 - 0 - port add - NEXT - data - NEXT - INT .

12. OUTPUT COMMAND :

This command outputs data to the desired port .

F3 - 1 - port add - NEXT - data - NEXT - INT

13. BLOCK SEARCH COMMAND:

This command search a block of memory for a particular

14

Page 15: MP8085 Lab Manual

byte . BLOC - starting add - NEXT - end add -b NEXT - byte - NEXT -

INT

14. BLACK CHECK COMMAND :

To check a block of memory for location that do not contain FF .

BC - starting address - NEXT - ending address - NEXT

Brief instruction to 8085 microprocessor:

A microprocessor is a multipurpose kit

programmable clock drivers, register based electronic device

called memory storage that reads binary instruction code from

memory & accept binary data as input & processes those data

according to those instructions & provides result as output.

The 8085 is a microprocessor with 8 bit length

its instruction set is designed by using various combination of

these 8 bits. The 8085 is an improved version of earlier

processor 8080A.

The process of data manipulation &

communication is determined by the logic design of the

Microprocessor called the architecture.

The various function performed by the

microprocessor can be classified into three categories.

1. Microprocessor initiated operation

2. Internal operation

3. Peripheral operation

8085 microprocessor is capable of

addressing 64 K of memory. It is 40 pins package. It is

a dual pin package of very large scale integration

15

Page 16: MP8085 Lab Manual

technology using TTL & comprises of 1130,000

transistor.

8085 microprocessor consists of a

1. 16 bit address bus.

2. 8 bit data bus.

The sped of 8085 microprocessor is 3.07 MHz.

SIGNAL:

ADDRESS BUS:

The 8085 has 8 signal lines. A15-A8 which are

unidirectional & are used as higher order address bus.

MULTIPLEXED ADDRESS/DATA BUS:

The signals AD7-AD0 are bidirectional. They are

used for both lower order address bus as well as data

bus which is separated using a latch.

CONTROL & STATUS SIGNALS;

The signals read & write are control signal and io/m,

S0,S1 are status signal. ALT is a special signal that

indicates if the AD7-AD0 is a data /address lines.

TIMING & CONTROL UNIT:

This unit synchronizes all the microprocessor operation

with the clock & generates the control signal necessary for

the communication between microprocessor and

peripherals .

A RITHMETIC AND LOGIC UNIT :

ALU performs the computing function .It includes

the accumulator and temporary register held data

16

Page 17: MP8085 Lab Manual

during the calculations . Accumulator stores the

result obtained . It is a 8 bit register .

FLAGS :

SIGN FLAGS :

The flag is reset if the result in the accumulator

is negative . If it is reset to zero the result is positive .

ZEROFLAG :

The flag is set if the result is zero else result is

not zero .

AUXILLIARY CARRY :

If it is set , if the carry exists for D3 digits to be

passed to the D4 digit . Otherwise the AC flag is result to

zero .

PARITY FLAG :

It is set if there are even nos of ones in the result else

the flag is reset .

REGISTERS :

There are 6 general purpose register storing 8 bit of

data . They are combined in pair to store 16 bits of data .

There are two temporary registers W & Z . They are

internal registers and not available to the user .

PROGRAM COUNTER :

This 16 bit of register deals with the sequencing of

execution . It is a memory pointer to memory location

from which the next byte is to be fetched .

STACK POINTER :

17

Page 18: MP8085 Lab Manual

It is also a 16 bit registers which is a memory pointes

to the memory location called stack . It defines where the

program has to continue after the call of a subroutine.

DISPLAY DRIVE:

The segment drive output of 8279 from a signal 8 bit

parallel output driving the display element segments . The

correspondence between the data bus segment outputs of

8279 and the display element is shown .

DISPLAY POSITION :

To display character in the address field 8279 must be

instructed to start from display positions O and to display

character in the data field . 8279 must be instructed to start

from display position by sending 94H to the command port

of 8279.

KEY BOARD:

Keyboard display interface is responsible for all the

operations. The keyboard is of a alphanumeric type. The

input is sent to the process through the keyboard. First is

the control keyboard which has control keys. The

hexadecimal keys are of 16 that is from 0 to 9 & from A to

F keys. Some of control keys are given.

RES:

This key allows to terminate any present activity and to

return to SDA to the initial state.

CRYSTAL OSCILATOR:

It is basically a tuned oscillator. The crystal is made

of quartz material and provides a high degree of frequency

18

Page 19: MP8085 Lab Manual

stability & accuracy. Therefore, the crystal oscillator is

used where frequency stability is needed.

INTERUPTS CONTROLLER:

It is a programmable interrupts managing device

specifying designed for use with the interrupt signal of

8085 microprocessor.

PROGRAMMABLE PERIPHERAL INTERFACE:

The 8255 has 3 parts A,B & C. The ports A&B are 8 bit

parallel ports. Port A can be programmed to work in any one of

the three operating modes as input or output port .

CONTROL LOGIC :

The control section has six lines . Their functions and

connections are as follows :

READ

This control signal enables the read operation when

the signal is low , the MPU reads data from a selected I/O

port of the 8255A

WRITE

This control signal enables the write operation when

the signal goes low , the MPU write into a selected IO port

or the control register.

RESET :

This is an active high signal , it clears the control

register and sets all ports in the input mode .

CS , AO AND A1 :

19

Page 20: MP8085 Lab Manual

These are devices select signals . CS is connected to a

decoded address , and AO& A1.. The CS signals in

the master chip select , AO& A1 specify one port or

the control register .

CONTROL WORD :

To communicate with peripherals through the 8255,

three steps are necessary

Determine the addresses of port A , B and C & of

the control register according to the chip select logic

and address lines AO & A1 .

Write a control word in the control register .

Write I/O instructions to communicate with

peripherals through ports A , B and C .

KEYBOARD DISPLAYINTERFACE ( 8279 )

The keyboard / display section of the MP’s 85.3 is

controlled by 8279 .

The 8279 is configured for the following operation .

Encode scan keyboard with 2 keys lock out

8 digits , 8 bits , left entry display .

KEYBOARD SECTION :

This section has eight lines ( RL0 – RL7 ) That can be

connected to eight columns of a key board .

SCAN SECTION :

The scan section has a scan counter and four scan

lines can ( SL0 – SL3 ) .These four scan lines can be

decoded using 4 to 16 decoder to generate 16 lines for

scanning .

20

Page 21: MP8085 Lab Manual

DISPLAY SECTION:

The display section has eight output lines divided unto

two groups A0-A3 & B0-B3. These lines can be used,

either a group of eight lines or two groups of four,in

conjuction with the scan lines for a multiplexed

display.

PROGRAMMING THE 8279:

The initialization commands can specify:

left or right entry & key rollover.

Clock frequency prescaler

Starting address &incrementing mode of

FIFO RAM

Blanking formate

BLOCK DIAGRAM OF 8253:

DATA BUS BUFFER:

This tri-state,8-bit,bidirectional buffer is connected buffer is

connected to the data bus of the MPU.

CONTROL LOGIC:

The control section has five signals:

Read

Write

Chip select

A0-A1

In the peripheral I/O mode,the read &write signal are

peripheral I/O mode, connected to IOR respectively.

CONTROL WORD REGISTER:

21

Page 22: MP8085 Lab Manual

This register is accessed when lines A0&A1 are at logic1.It is

used to write a common word which specifies the counter to be

used its mode and either a read or a write operation.

8251A(USART)

The function requirements for the software approach are

summarized below:

An input port & an output port are required for interfacing .In

data transmission, the MPU converts a parallel word into a

stream of serial ports.

READ WRITE AND CONTROL LOGIC:

This selection includes R/W control logic six input signals,

control logic and these buffer register

Data register

Control register

Status register

INPUT SIGNALS:

CHIP SELECT:

When this signal goes low, the 8251A is selected by the MPU for

communication.

CONTROL DATA:

When this signal is high, the control register or the status register

is addressed.

READ:

When this signal goes low, the microprocessor either reads a status

from the status register accepts data from the data buffer.

RESET

A high on this input resets the 8251A & forces it into idle mode.

22

Page 23: MP8085 Lab Manual

CLOCK:

This is the clock input usally connected to the system clock. This

clock does not control either the transmission or the reception

rate.

DATA BUFFER:

This bidirectional register can be addressed as an input port and an

output port when the C/D pin .

TRANSMITTER CLOCK:

This input signal controls the rate at which bits are transmitted by

the USART. The clock frequency can be 1,16 or 64 times the band.

RECEIVER DATA

Bits are received serially in this line and converted into a parallel

byte in the receiver input register.

RECEVIER CLOCK:

This is a clock signal the convert the rate at which bits are received

by the USART. The asynchronous mode, the clock can be set to

1,16 or 64 timer the band.

POWER SUPPLY:

5V, 3A

+12V, 250mA

-12V, 100mA

30V, 100mA

BATTERY OPTION:

23

Page 24: MP8085 Lab Manual

Holder is backed up by an optional battery, holder is provided for

two A A type cells with quick charges circuit . User may use Ni –

cd or dry cells. Carie must be taken to remove the discharged cells

RESULT :

Thus the entire structure , port 2IC of the microprocessor kit has

been studied .

24

Page 25: MP8085 Lab Manual

25

Page 26: MP8085 Lab Manual

26

Page 27: MP8085 Lab Manual

27

Page 28: MP8085 Lab Manual

Exp.No:1.a Simple Arithmetic Operations

Date:

Aim: To write assembly language programs for Intel 8085 microprocessor to perform the following

functions;

(a) 8 bit addition with carry

(b) 8 bit addition without carry

(c) 8 bit subtraction with carry

(d) 8 bit subtraction without carry

(e) 8 bit multiplication and

(f) 8 bit by 8 bit division.

To check the above programs by executing using 8085 trainer.

Apparatus Required:

1.8085 Trainer

2. Operation Code sheet

(a) 8 bit addition with carryAlgorithm:

STEP 1: Start program.

STEP 2: Loading the first data to an Accumulator.

STEP 3: moving the data from Accumulator to one Register.

STEP 4: Again loading the second data to an Accumulator.

STEP 5: Moving the data immediately to one Register to check whether if there is

any carry are not.

STEP 6: Then adding the two data first and second value.

STEP 7: If there are no carry then the loop will jump to the statement which it process.

STEP 8: End the program.

28

Page 29: MP8085 Lab Manual

29

START

Load the accumulator

Increment the value of D

Add A to B

Move data to register C

Move accumulator to B

Load the accumulator

Move accumulator to C

Move data to accumulator

Decrement value of D

Move the content of D to C

Store the accumulator

If zero

A

A

STOP

IfCarry

1

1

Store the accumulator

NO

NO

YES

NO

YES

NO

YES

NO NO

NO

FLOW CHART:

Page 30: MP8085 Lab Manual

source code:

ADDRESS LABEL MNEMONICS OPCODE COMMENT

8100

8103

8106

8107

8109

810B

810E

810F

8112

8113

8116

LOOP

LDA 9001

MOV B, A

LDA 9002

ADD B

MVI D, 00

JNC LOOP

INR D

STA 9010

MOV A, D

STA 9011

HLT

3A, 01, 90

47

3A, 02, 90

80

16,00

D2, 0F, 81

14

32,10,90

7A

32,11,90

76

Load the first 8 bit data in the accumulator

Move the 8 bit data in the accumulator to register B

Load the second 8 bit data in the accumulator

Add the two 8 bit datas.

Initialize a register for carry

Jump to store the result if there is no carry

Else increment the carry register

Store the result in memory.

Move the carry in the register D to accumulator.

Store carry bit in memory.

Stop the program.

30

Page 31: MP8085 Lab Manual

Input and output:

Before Execution After Execution

31

Address Data9000 8C9001 9E9002 009003 00

Address Data9000 8C9001 9E9002 2A9003 01

Page 32: MP8085 Lab Manual

(b) 8 bit addition without carry

Algorithm:

STEP 1: Start program.

STEP 2: Loading the first data to an Accumulator.

STEP 3: moving the data from Accumulator to one Register.

STEP 4: Again loading the second data to an Accumulator.

STEP 5: Moving the data immediately to one Register to check whether if there is

any carry are not.

STEP 6: Then adding the two data first and second value.

STEP 7: If there are no carry then the loop will jump to the statement which it process.

STEP 8: End the program.

Program code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8004

8007

8008

800B

LDA 9000

MOV B, A

LDA 9001

ADD B

STA 9002

HLT

3A 00 90

47

3A 01 90

80

32 02 90

76

Load first 8-bit data to accumulator.

Move the 8-bit number to B register.

Load second 8-bit data to accumulator.

Add the two 8 bit data.

Store the result in memory.

Stop the program

32

Page 33: MP8085 Lab Manual

Input and output:

Before Execution After Execution

33

Address Data9000 2A9001 5B9002 00

Address Data9000 2A9001 5B9002 85

Page 34: MP8085 Lab Manual

(c) 8 bit subtraction with borrow

Algorithm:

STEP 1: Start the program.

STEP 2: Loading the first data value to accumulator.

STEP 3: Loading the second data value to the accumulator.

STEP 4: Then clear one Register as zero.

STEP 5: Subtract the value second data from first data value.

STEP 6: Jump with no carry is the result is not having carry, then gotostep8.

STEP 7: Increment the value of third Register as 1.

STEP 8: Go to step 6.

STEP 9: Moving third register value to accumulator.

STEP 10: Then store the subtracted value in one address.

STEP 11: End of the program.

34

Page 35: MP8085 Lab Manual

35

START

Load the accumulator

Add B with accumulator

Subtract B form accumulator

Move accumulator to B

Load the accumulator

Move data to register C

Increment the value of C

Store the accumulator

Move C to accumulator

A

A

STOP

Ifcarry

Store the accumulator

Decrement the value of D

YES

NO

NO

NO

FLOW CHART:

Page 36: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8002

8005

8006

8009

800A

800D

800E

800F

8011

8014

8015

8018

LOOP

MVI D, 00

LDA 9000

MOV B, A

LDA 9001

SUB B

JNC LOOP

INR D

CMA

ADI 01

STA 9000

MOV A, D

STA 9003

HLT

16 00

3A 00 90

47

3A 01 90

90

D2 80 11

14

2F

C6 01

32 00 90

7A

32 03 90

76

Initialize a register for borrow

Load the accumulator with minuend

Move the 8 bit data in the accumulator to register B.

Load the subtrahend data in the accumulator.

Subtract the two 8 bit numbers.

Jump to LOOP if no carry is set.

Increment the accumulator content to obtain 2’s

Complement the accumulator content.

Increment by 01

Store the result in address.

Move the borrow bit in the register D to the accumulator.

Store the borrow in memory.

Stop the program

36

Page 37: MP8085 Lab Manual

INPUT & OUTPUT

Before Execution After Execution

37

Address Data9000 049001 069002 009003 00

Address Data9000 049001 069002 0E9003 01

Page 38: MP8085 Lab Manual

(d) 8 bit subtraction without borrow

Algorithm:

STEP 1: Start the program.

STEP 2: Loading the first data value to accumulator.

STEP 3: Loading the second data value to the accumulator.

STEP 4: Then clear one Register as zero.

STEP 5: Subtract the value second data from first data value.

STEP 6: Jump with no carry is the result is not having carry, then gotostep8.

STEP 7: Increment the value of third Register as 1.

STEP 8: Go to step 6.

STEP 9: Moving third register value to accumulator.

STEP 10: Then store the subtracted value in one address.

STEP 11: End of the program

Program code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8004

8007

8008

LDA 9000

MOV B, A

LDA 9001

SUB B

STA 9002

3A 00 90

47

3A 01 90

90

32 02 90

Load the first subtrahend data in the accumulator.

Move the 8-bit data to B register.

Load the minuend data to the accumulator.

Subtract the two 8 bit numbers.

Store the result in memory.

38

Page 39: MP8085 Lab Manual

800B HLT 76 Stop the Program

Input and output:

Before Execution After Execution

39

Address Data9000 099001 059002 00

Address Data9000 099001 059002 04

Page 40: MP8085 Lab Manual

(e) 8 bit multiplication

Algorithm:

STEP1: Start the program.

STEP 2: Load the first data to the accumulator.

STEP 3: Move the first data from Accumulator to one register.

STEP 4: Load the second data value to accumulator.

STEP 5: Then keep the Accumulator value as zero.

STEP 6: And then again keep another one register as zero.

STEP 7: Add the first value to the accumulator.

STEP 8: In above step if there is no carry then go to step 10.

STEP 9: Increment the value of third register.

STEP 10: Decrement the value of second Register.

STEP 11: Go to step 7.

STEP 12: Store the result value in one address.

STEP 13: Move the data from third register to accumulator.

STEP 14: Store the above data value to one address.

STEP 15: End of the program.

40

FLOW CHART:

Page 41: MP8085 Lab Manual

Programcode:ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8004

8007

8008

8009

800B

800C

800F

8010

8011

8014

8017

8018

801B

LOOP1

LOOP

LDA 9000

MOV B, A

LDA 9001

MOV C, A

MVI A, 00

MVI D, 00

ADD B

JNC LOOP

INR D

DCR C

JNZ LOOP1

STA 9002

MOV A, D

STA 9003

HLT

3A 00 90

47

3A 01 90

4F

3E 00

16 00

80

D2 10 80

14

0D

C2 0B 80

32 02 90

7A

32 03 90

76

Load the first 8-bit number in accumulator.

Move the 8-bit number to B register.

Load the second 8-bit number in accumulator.

Move the second 8-bit number to C register.

Clear the contents of A register.

Clear the contents of D register.

Add the first 8-bit number to accumulator.

Jump, decrement the count C if no carry.

Else increment carries register by 1.

Decrement counter register.

Add the number again if count is not zero.

Store the result in address.

Move the carry to accumulator.

Store the carry in address.

Stop the program.

41

Page 42: MP8085 Lab Manual

42

FLOW CHART:

STARTsssstS STOP

Move data to register C

Add B with accumulator

Store the accumulator

Increment the value of C

Store the accumulator

STARTbbb START

Load the accumulator

Move accumulator to B

Load the accumlator

Move C to accumulator

Ifcarry

NO

NO

YES

NO

Page 43: MP8085 Lab Manual

INPUT & OUTPUT

Before Execution After Execution

43

Address Data9000 049001 069002 189003 00

Address Data9000 049001 069002 189003 00

Page 44: MP8085 Lab Manual

Algorithm:

STEP 1: Start the program.

STEP 2: Load the accumulator from a specified address.

STEP 3: Move the content of accumulator to register B.

STEP 4: Then again load the accumulator from a specified address.

STEP 5: Move immediately the content of register C to zero.

STEP 6: Then increment the content of register B.

STEP 7: Then subtract the content of register B from the accumulator.

STEP 8: Then check for carry.

STEP 9: If carry is not present then add the content of B with the accumulator.

STEP10: If carry is present the content of register c is increased and the process

repeated.

STEP 11: Then decrement the content of register C.

STEP12: Store the content of accumulator to a address.

STEP 13: Then move the content of register C to accumulator A.

STEP 14: Then store the content of accumulator in address.

STEP 15: Stop the program.

Program code:

44

Page 45: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8002

8005

8006

8009

800A

800B

800E

800F

8010

8013

8014

8017

LOOP

MVI D, 00

LDA 9000

MOV B, A

LDA 9001

SUB B

INR D

JNC LOOP

ADD B

DCR D

STA 9002

MOV A, D

STA 9003

HLT

16 00

3A 00 90

47

3A 01 90

90

14

D2 09 80

80

15

32 02 90

7A

32 03 90

76

Clear the contents of C register to store quotient.

Load the first 8-bit number into accumulator.

Move the 8-bit number to B register.

Load the second 8-bit number into accumulator.

Subtract 8 bit data from accumulator.

Increment quotient register by 1

Subtract repeatedly till carry is set.

Add the content of B register.

Decrement the quotient by 1.

Store the remainder in address.

Move the quotient in C register to accumulator.

Store the quotient to address.

End of program.

INPUT & OUTPUT

Before Execution After Execution

45

Address Data9000 029001 089002 009003 00

Address Data9000 029001 089002 009003 04

Page 46: MP8085 Lab Manual

Result:Thus assembly language programs are written for Intel 8085 microprocessor to perform

the following functions;

(a) 8 bit addition with carry

(b) 8 bit addition without carry

(c) 8 bit subtraction with carry

(d) 8 bit subtraction without carry

(e) 8 bit multiplication and

(f) 8 bit division.

46

Page 47: MP8085 Lab Manual

47

Page 48: MP8085 Lab Manual

Exp.No:1.b Simple Arithmetic Operations

Date:

Aim:To write assembly language programs for Intel 8085 microprocessor to perform the

following functions;

(a) 16 bit addition

(b) 16 bit subtraction

(c) 16 bit multiplication and

(d) 16 bit division.

To check the above programs by executing using 8085 trainer.

Apparatus Required:

1.8085 Trainer

2. Operation Code sheet

(a) 16 bit addition

Algorithm:

STEP 1: Start the program.STEP 2: Move the immediate data to the E register.STEP 3: Load the accumulator from the specified address.STEP 4: Move the content of accumulator to register C.STEP 5: Load the accumulator from specified address .STEP 6: Move the content of accumulator to B register .STEP 7: Load the accumulator from the specified address.STEP 8: Move the content of accumulator to register L.STEP 9: Load the accumulator from specified address .STEP 10: Move the content of accumulator to H register . STEP 11: Move the content of C register to accumulator.STEP 12: Add L register to the content of accumulator.STEP 13: Store the accumulator in specified address.STEP 14: Move the content of B register to accumulator.STEP 15: Add register H to the content of accumulator in to carry.STEP 16: Store the accumulator in specified address.STEP 17: Jump on no carry to LOOP.STEP 28: Increment the register E.STEP 19: Move the content of E register to accumulator.STEP 20: Store the content of accumulator.STEP 21: Stop the program.

48

Page 49: MP8085 Lab Manual

49

Move data to E register

Load the accumulator

Load the accumulator

Move accumulator to C

Move accumulator to B

Load the accumulator

Move accumulator to C

Load the accumulator

Move accumulator to H

Increment the value of D

Move the value of E to accumulator

Store the accumulator

A=A+H+CARRY

Move B to accumulator

Store the accumulator

A

E=E+1

Move accumulator to C

A

If nocarry

A=A+I

STOP

NO

NO

YES

NO

FLOW CHART:

Page 50: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8004

8007

8008

800B

800D

800F

8012

LHLD 9000

XCHG

LHLD 9002

DAD D

SHLD 9004

MVI A, 00

ACI 00

STA 9006

HLT

2A 00 90

EB

2A 02 90

19

22 04 90

3E 00

CE

32 06 90

76

Load the first 16 bit data to HL register pair.

Exchange the contents of HL and DE register pairs.

Load the second 16 bit data to HL register pair.

Add the two 16 bit numbers and store in HL.

Store the result in address.

Clear the contents of A register to store carry.

Add the carry bit if available, to accumulator with 00 H.

Store the carry bit in address.

End of program.

INPUT & OUTPUT

Before Execution After Execution

50

Address Data9000 AE9001 EB9002 AC9003 6B9004 009005 009006 009007 00

Address Data9000 AE9001 EB9002 AC9003 6B9004 569005 5B9006 019007 00

Page 51: MP8085 Lab Manual

(b) 16 bit subtraction

Algorithm:

STEP 1: Start the program.

STEP 2: Move the immediate data to the E register.

STEP 3: Load the accumulator from the specified address.

STEP 4: Move the content of accumulator to register C.

STEP 5: Load the accumulator from specified address .

STEP 6: Move the content of accumulator to B register .

STEP 7: Load the accumulator from the specified address.

STEP 8: Move the content of accumulator to register L.

STEP 9: Load the accumulator from specified address .

STEP 10: Move the content of accumulator to H register .

STEP 11: Move the content of C register to accumulator.

STEP 12: Subtract L register to the content of accumulator.

STEP 13: Store the accumulator in specified address.

STEP 14: Move the content of B register to accumulator.

STEP 15: Subtract register H to the content of accumulator with carry.

STEP 16: Store the accumulator in specified address.

STEP 17: Jump on no carry to LOOP.

STEP 28: Move immediate data to register E.

STEP 19: Move the content of E register to accumulator.

STEP 20: Store the content of accumulator.

STEP 21: Stop the program.

51

Page 52: MP8085 Lab Manual

52

Move data to E register

Load the accumulator

Load the accumulator

Move accumulator to C

Move accumulator to B

Load the accumulator

Move accumulator to L

Load the accumulator

Move accumulator to H

Store the accumulator

Move the value of E to accumulator

Store the accumulator

A= A-H-Carry

Move B to accumulator

Store the accumulator

Move accumulator to C

A

If nocarry

STARTbbbb START

Move E to accumulator

A=A-I

A

STOP

YES

NO NO

NO

FLOW CHART:

Page 53: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8004

8007

8008

8009

800A

800B

800C

800D

800F

8012

8013

8014

8015

8016

8017

8018

8019

JUMP

LHLD 9000

XCHG

LHLD 9002

MOV A, E

SUB L

MOV L, A

MOV A, D

SBB H

MOV H, A

MVI C, 00

JNC JUMP

MOV A, L

CMA

MOV L, A

MOV A, H

CMA

MOV H, A

INX H

INR C

2A 00 90

EB

2A 02 90

7B

95

6F

7A

9C

67

0E 00

D2 1A 80

7D

2F

6F

7C

2F

67

23

0C

Load the first 16 bit data to HL register pair.

Exchange the contents of HL and DE register pairs.

Load the second 16 bit data to HL register pair.

Move lower order bit to accumulator.

Subtract the lower order bit of second number.

Move the result in L register.

Move the higher order bit to accumulator.

Subtract the higher order bit of second number.

Store the result in H register.

Clear the C register for storing carry register.

Jump to storing the result if no carry.

Move the lower order bit to accumulator.

Complement accumulator.

Move the complemented bit to L register.

Move the higher order bit to accumulator.

Complement accumulator.

Move the complemented bit to H register.

Add one to the HL register pair.

Increment Carry register.

53

Page 54: MP8085 Lab Manual

801A

801B

801C

801D

SHLD 9005

MOV A, C

STA 9007

HLT

22 05 90

79

32 07 90

76

Store the result in address

Move the carry bit to accumulator.

Store the carry bit in address.

End of program

INPUT & OUTPUT

Before Execution After Execution

54

Address Data9000 789001 659002 519003 439004 009005 009006 009007 00

Address Data9000 789001 659002 519003 439004 279005 229006 009007 00

Page 55: MP8085 Lab Manual

(c) 16 bit multiplication

Algorithm:

STEP 1: Start the program.

STEP 2: Load the HL register pair from the specified address.

STEP 3: Copy the content of HL register pair to stack pointer.

STEP 4: Load the HL register pair from the specified address.

STEP 5: Exchange the content of HL register pair to DE register pair.

STEP 6: Move the immediate data to HL register pair.

STEP 7: Move the immediate data to BC register pair.

STEP 8: Add the stack pointer with HL register pair.

STEP 9: Jump on carry to loop.

STEP 10: Increment the register pair BC.

STEP 11: Jump on zero to step.

STEP 12: Store the HL register pair.

STEP 13: Move the content of register B to H.

STEP 14: Move the content of register C to L.

STEP 15: Store the HL register pair.

STEP 16: Stop the program.

55

Page 56: MP8085 Lab Manual

56

START

Load the HL reg pair

Increment the BC reg pair

Add SP to HL reg pair

Load immediate data to BC reg pair

Copy HL to stack pointer

Load the HL reg pair

Exchange the HL to DE

Load immediate data to HL reg pair

Decrement the DE reg pair

Store the HL reg pair

OR D with accumulator

If nozero

A

A

STOP

If nocarry

Move the value of H to B

Move E to accumulator

Move the value of C to L

Store HL reg pair

NO

NO

NO

NO

YES

NO

YES

NO

FLOW CHART:

Page 57: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8006

8007

800A

800B

800E

800F

8012

8013

8014

8015

8016

8019

801C

801D

801E

8021

LOOP

STEP

LXI B, 0000

LHLD 9000

XCHG

LHLD 9002

SPHL

LXI H, 0000

DAD SP

JNC STEP

INX B

DCX D

MOV A, E

ORA D

JNZ LOOP

SHLD 9004

MOV L, C

MOV H, B

SHLD 9006

HLT

01 00 00

2A 00 90

EB

2A 02 90

F9

23 00 00

39

D2 13 80

03

1B

7B

B2

D2 0E 80

22 04 90

69

60

22 06 90

76

Clear the contents of B register to store carry.

Load the first 16-bit number to accumulator.

Exchange the contents of HL and DE register pairs.

Load the second 16-bit number to accumulator.

Store the 16 bit data in SP.

Clear the contents of HL register pairs.

Add the contents of SP with HL register pair.

Jump to decrement the count if no carry

Else increment carry register.

Decrement counter

Move the lower order bit in E register to accumulator.

Perform OR with higher order bit in D register to check for zero count.

Add SP again to HL if count in not zero.

Store the result in address

Move the lower order carry bit to accumulator.

Move the higher order carry bit to accumulator.

Store the carry in address.

End of program.

57

Page 58: MP8085 Lab Manual

INPUT & OUTPUT

Before Execution After Execution

58

Address Data9000 119001 129002 119003 129004 009005 009006 009007 00

Address Data9000 119001 129002 119003 129004 219005 659006 469007 01

Page 59: MP8085 Lab Manual

(d) 16 bit division

Algorithm:

STEP 1: Load the immediate data to the register pair BC.

STEP 2: Load the HL register pair.

STEP 3: Move the content of H to accumulator.

STEP 4: Jump on zero to the result.

STEP 5: Exchange the content of HL register pair to DE register pair.

STEP 5: Load the HL register pair.

STEP 6: Move the content H to A.

STEP 7: Jump on zero to the result.

STEP 8 : Increment the register pair to BC.

STEP 9: Move the content of L to A.

STEP 10: Subtract E with the accumulator.

STEP 11: Move the content A to L register.

STEP 9: Move the content of H to A.

STEP 9: Subtract with borrow to D register.

STEP 11: Move the content A to H register.

STEP 9: Jump on carry to loop.

STEP 9: Add the content of two register pair.

STEP 12: Decrement the register pair BC.

STEP 13: Store the HL register pair directly.

STEP 14: Move the B to L register.

STEP 15: Move the C to H register.

STEP 16: Store the HL register pair.

STEP 17: Stop the program.

59

Page 60: MP8085 Lab Manual

60

Get immediate value of BC reg pair

Load the HL reg pair

OR L with accumulator

Move the value of H to accumulator

Increment the BC reg pair

OR L with accumulator

Exchange the HL content to DE pair

Load the HL reg pair

Move the value of H to accumulator

Move the value of B to H

Decrement the BC pair

Move accumulator to H

A=A-D-Carry

Move H to accumulator

Move accumulator to L

A

If no carry

STARTbbbb START

If zero

If zerocarry

Move L to accumulator

A =A-E

Store the HL reg pair content

Add DE to HL pair

Move the value of C to L

Store the HL reg pair content

STOP

YES

NO

YES

NO

YES

NO NO

NO

NO

NO

NO

NO

FLOW CHART:

Page 61: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8100

8103

8104

8105

8108

8109

810C

810D

810E

8111

8114

8115

8116

8117

8118

8119

LOOP

LHLD 9100

MOV A, L

ORA H

JZ STEP

XCHG

LHLD 9102

MOV A, L

ORA H

JZ STEP

LXI B, 0000

MOV A, L

SUB E

MOV L, A

MOV A, H

SBB D

MOV H, A

2A 00 91

7D

B4

CA 21 81

EB

2A 02 91

7D

B4

CA 21 81

01 00 00

7D

93

6F

7C

9A

67

Load the 16 bit divisor in HL register pair

Move the lower order bit to accumulator.

Perform OR operation with higher order bit to check if the divisor is zero

Jump to store the result if zero flag is set

Exchange the contents of HL and DE register pairs.

Load the 16 bit dividend into HL register pair.

Move the lower order bit to accumulator.

Perform OR operation with higher order bit to check for zero.

Jump to store the result if zero flag is set.

Clear the BC register pair for storing the quotient.

Move the lower order bit of dividend to accumulator.

Subtract the lower order bit of divisor.

Move the result to L register.

Move the higher order bit of dividend to accumulator.

Subtract the higher bit of divisor with borrow if present.

Move the result to H register.

61

Page 62: MP8085 Lab Manual

INPUT & OUTPUT

Before Execution After Execution

Result: Thus assembly language programs are written for Intel 8085 microprocessor to perform

the following functions;

(a) 16 bit addition

(b) 16 bit subtraction

(c) 16 bit multiplication and

(d) 16 bit division

62

Address Data9100 229101 229102 449103 449104 009105 009106 009107 00

Address Data9100 229101 229102 449103 449104 009105 009106 029107 00

Page 63: MP8085 Lab Manual

Exp.No:2 BCD Arithmetic Operations

Date:

Aim:To write assembly language programs for Intel 8085 microprocessor to perform the following

functions;

(a) BCD addition

(b) BCD subtraction

To check the above programs by executing using 8085 trainer.

Apparatus Required:

1.8085 Trainer

2. Operation Code sheet

(a) BCD addition

Algorithm:

STEP 1: Start the program

STEP 2: Load the data to Accumulator

STEP 3: Move immediate 00 to c reg

STEP 4: Add the B value to Accumulator

STEP 5: Decimal adjust Accumulator

STEP 6: Jump on no carry go to step 9

STEP 7: Increment the C register

STEP 8: Store the data to Accumulator

STEP 9: Move the data A to C

STEP 10: Store the data to Accumulator

STEP 11: Stop the program

63

Page 64: MP8085 Lab Manual

Program Code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8003

8004

8007

8009

800A

800B

800E

800F

8012

8013

8016

LOOP

LDA 9000

MOV B, A

LDA 9001

MVI C, 00

ADD B

DAA

JNC LOOP

INR C

STA 9002

MOV A, C

STA 9003

HLT

3A, 00,90

47

3A, 01,90

0E, 00

80

27

D2, 0F, 80

0C

32,02,90

79

32,03,90

76

Load the first BCD number into accumulatorMove the 8 bit BCD to B register.Load the second BCD number to accumulator.Clear the contents of C register to store carry. Add the two BCD numbers.Convert the unpacked BCD to packed BCD formJump to store the result if no carry.Increment carry register.

Store the result in address.

Move the Carry bit to accumulator.Store the carry bit in address.End of program.

64

Page 65: MP8085 Lab Manual

(b) BCD subtraction

Algorithm:

STEP 1: Start the program

STEP 2: Load the data to Accumulator

STEP 3: Move the data from A to B

STEP 4: Load the data to Accumulator

STEP 5: Move the data A to D

STEP 6: Move immediate data to A register

STEP 7: Subtract the D reg

STEP 8: Move immediate data to A register

STEP 9: Add the D register

STEP 10: Add the B register

STEP 11: Decimal adjust Accumulator

STEP 12: Store the data to Accumulator

STEP 13: Stop the program

65

Page 66: MP8085 Lab Manual

Result: Thus assembly language programs are written for Intel 8085 microprocessor to perform the following functions;

(a) Bcd addition

66

LOAD THE ACCUMULATOR WITH THE SUBTRAHEND

INCREMENT THE REGISTER E TO COUNT THE CARRY

MOVE THE ACCUMULATOR CONTENTTO B

LOAD THE ACCUMULATOR WITH MINUEND

STORE THE ACCUMULATOR

CONTENT TO MEMORY

MOVE THE ACCUMULATOR TO C REGISTER

DECIMAL ADJUST ACCUMULATOR TO CONVERT THE RESULT TO PACKED BCD

ADD REG C WITH ACCUMULATOR

MOVE THE RESULT TO REGISTERC

SUBTRACT REGISTER C FROM ACCUMULATOR

MOVE THE ACCUMULATOR WITH 99 TO FIND 99’S

COMPLEMENT.

CLEAR THE ‘E ‘FOR COUNT

STOP

START

CHECK FOR

CARRY

A

YES

NO

A

FLOW CHART:

Page 67: MP8085 Lab Manual

(b) Bcd subtraction

67

Page 68: MP8085 Lab Manual

Exp.No:3 Code Conversion

Date:

Aim:To write assembly language programs for Intel 8085 microprocessor to perform the

following functions;

(a) BCD to Binary

(b) Binary to BCD

(c) Binary to octal

(d) Octal to Binary.

To check the above programs by executing using 8085 trainer.

Apparatus Required:

1.8085 Trainer

2. Operation Code sheet

(a) BCD to Binary

Algorithm:

Step 1: Start the program

Step 2: Load the contents of the accumulator from the sp.address

Step 3: Move the content of the accumulator to B reg

Step 4: Move the immediate data to C reg

Step 5: Logical AND with content of C reg

Step 6: Rotate the contents of the accumulator towards right four times

Step 7: Move the content of the accumulator toward D reg

68

Page 69: MP8085 Lab Manual

Step 8: Move immediate data to C reg

Step 9: Move the content of b reg to acc

Step 10: Logical and Operation with C reg

Step 11: Move the content of the accumulator to reg E

Step 12: Then Move immediate data to acc

Step 13: Then Move immediate data to reg C

Step 14: Start a loop

Step 15: Add the content of reg D to accumulator

Step 16: Decrement the content of reg C

Step 17: Jump on no zero to loop

Step 18: Add the content of reg E to acc

Step 19: Store the contents of the accumulator

Step 20: Stop the program

69

Page 70: MP8085 Lab Manual

70

FLOW CHART:

Page 71: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONIC OP CODE COMMENTS

8000

8002

8004

8007

8009

800A

800B

800E

800F

8012

8013

8014

8016

8017

8018

801B

JUMP

STEP

MVI E,0A

MVI C,04

LDA 9000

ANI F0

RRC

DCR C

JNZ JUMP

MOV B,A

LDA 9000

ANI 0F

MOV D,A

MVI A,00

ADD B

DCR E

JNZ STEP

ADD D

1E OA

OE 04

3A 00 90

E6 F0

0F

0D

C2 09 80

47

3A 00 90

E6 0F

57

3E 00

80

10

C2 16 80

82

Move 0A to E register to multiply the upper nibble of BCD number by 10.

Move 04 to C register to rotate the upper nibble four times.

Load the BCD number to acc.

Perform AND operation with 0F to separate upper nibble.

Rotate content to right side without carry.

Decrement the value of C register.

Rotate content to right side if copunt not zero.

Else move the upper nibble to reg B.

Load the original BCD number to acc.

Perform AND operation with F0 to separate lower nibble.

Move the lower nibble to D register.

Clear the contents of accumulator.

Add the upper nibble to BCD number to accumulator.

Decrement the E register value by 1.

Jump to add the upper nibble to accumulator if count not zero.

Add the lower nibble of BCD number with accumulator.

71

Page 72: MP8085 Lab Manual

801C

801F

STA 9001

HLT

32 01 90

76

Store the binary value in address.

Stop the program.

INPUT & OUTPUT Before Execution After Execution

72

Address Data9000 569001 00

Address Data9000 569001 38

Page 73: MP8085 Lab Manual

(b) Binary to BCD

Algorithm:

Step 1: Start the program

Step 2: Load the accumulator from the specified address

Step 3: Move the content of accumulator to reg B

Step 4: Move the immediate data present to D register

Step 5: Move the immediate data in accumulator to C register

Step 6: Subtract content of D from the accumulator

Step 7: Jump on carry to loop

Step 8: Move the content of B to accumulator

Step 9: Increment the content of C reg

Step 10: Subtract the content of D reg to accumulator

Step 11: Jump on necessary to loop

Step 12: Add the content of A to B reg

Step 13: Decrement the content of C reg

Step 14: Move the content of A to B reg

Step 15: Move the content of C to accumulator

Step 16: Stop the content of accumulator to sp.address

Step 17: Move the content of B reg to accumulator

Step 18: Move the immediate data to D reg

Step 19: Increment the content of C reg

Step 20: Subtract the content of D reg

Step 21: Jump on no carry to loop 2

73

Page 74: MP8085 Lab Manual

Step 22: Add the content of accumulator with D reg

Step 23: Decrement the content of C reg

Step 24: Store the content of accumulator

Step 25: Move the content of C reg to accumulator

Step 26: Store the content of acc in specified address.

Step 27: Stop the program.

74

FLOW CHART:

Page 75: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONIC OP CODE COMMENTS

8050

8052

8053

8056

8058

805B

805D

805E

8061

8063

8066

8068

8069

806C

806D

806E

HUND

TEN

UNIT

MVI E,00

NIV D,E

LDA 9050

CPI 9050

JC TEN

SUI 64

INR E

JMP HUND

CPI 0A

JC UNIT

SUI 0A

INR D

JMP TEN

MOV C,A

MOV A,D

RLC

1E OO

53

3A 50 90

FE 64

DA 61 80

D6 64

1C

C3 56 80

FE 0A

DA 6C 80

D6 0A

14

C3 61 80

4F

7A

07

Clear the contents of E register.

Clear the contents of D register.

Load the binary number to accumulator.

Check if binary number is less than 100.

Jump to check the ten’s place if carry is set.

Subtract 64 immediately from binary number.

Increment the value of hundreds digit.

Jump to check if number is less than hundred.

Check if the binary number is less than ten.

Jump to check the unit’s place if carry is set.

Subtract 0A immediately from binary number.

Increment the value of tens digit.

Jump to check again if number is less than 10.

Move content of accumulator with register C.

Move the number of ten’s to accumulator.

Rotate the content of acc to left without carry.

75

Page 76: MP8085 Lab Manual

806F

8070

8071

8072

8073

8076

8077

807A

RLC

RLC

RLC

ADD C

STA 9051

MOV A,E

STA 9052

HLT

07

07

07

81

32 51 90

7B

32 52 90

76

Rotate the content of acc to left without carry.

Rotate the content of acc to left without carry.

Rotate the content of acc to left without carry.

Add the unit’s place to the ten’s place.

Store the content of accumulator.

Move the content of register E with acc.

Store the content of accumulator.

Stop the program

INPUT & OUTPUT Before Execution After Execution

76

Address Data9000 459001 00

Address Data9000 459001 699002 00

Page 77: MP8085 Lab Manual

(c) Binary to Octal

Algorithm:

Step 1: Start the program

Step 2: Move the immediate data to the reg

Step 3: Move the content of reg B to accumulator

Step 4: Move the immediate data to reg C

Step 5: Logical and Operation with reg C

Step 6: Store the content of accumulator in sp.address

Step 7: Move the immediate to reg C

Step 8: Move the content of reg B to accumulator

Step 9: Logical and Operation with C reg

Step 10: Rotate the content of accumulator right three times

Step 11: Store the content of the accumulator

Step 12: Move the content of the reg B to accumulator

Step 13: Move the immediate data to reg C

Step 14: Rotate the content of accumulator left three

Step 15: Logical and Operation with reg C

Step 16: Store the content of accumulator

Step 17: Stop the program

77

Page 78: MP8085 Lab Manual

78

FLOW CHART:

Page 79: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONIC OP CODE COMMENTS

8000

8003

8004

8006

8009

800A

800C

800D

800E

800F

8012

8013

8015

8016

LDA 9000

MOV B,A

ANI 07

STA 9001

MOV A,B

ANI 38

RRC

RRC

RRC

STA 9002

MOV A,B

ANI C0

RLC

RLC

3A,00, 90

47

EB,07

32,01,90

78

E6,38

0F

0F

0F

32,02,90

78

E6,C0

07

07

Load the binary number to be converted into A register.

Move the original binary number to B register.

Perform AND Operation of acc with 07.

Store the first digit of octal number to address.

Move the original binary number to accumulator.

Perform AND operation of accumulator with 38.

Rotate content of accumulator to right side without carry.

Rotate content of accumulator to right side without carry.

Rotate content of accumulator to right without carry.

Store the second digit of octal number to memory address.

Move the original binary number to accumulator.

Perform AND operation of accumulator with C0.

Rotate the content of accumulator to left without carry.

Rotate the content of accumulator to left without carry.

79

Page 80: MP8085 Lab Manual

8017

801A

STA 9003

HLT

32,03,90

76

Store the third digit of octal number to memory address.

Stop the program .

INPUT & OUTPUT Before Execution After Execution

80

Address Data9000 579001 00

Address Data9000 79001 29002 1

Page 81: MP8085 Lab Manual

(d) Octal to Binary

Algorithm:

Step 1: Start the program

Step 2: Load the accumulator directly to a address

Step 3: Move the content from A to B

Step 4: Move immediate data on C reg as

Step 5: Increment the C reg

Step 6: Subtract the immediate data with accumulator

Step 7: Jump on no carry to loop

Step 8: Decrement the reg C

Step 9: Add immediate data with accumulator

Step10: Rotate the content of the accumulator towards left without carry

Step 11: Rotate the contents of the accumulator without carry

Step 12: Move the content from A to C reg

Step 13: Load the accumulator directly

Step 14: Rotate the contents of accumulator towards right without carry

Step 15: Rotate the contents of accumulator towards right without carry

Step 16: Perform OR operation between reg D and accumulator

Step 17: Perform OR operation between reg C and accumulator

Step 18: Stop the program

81

FLOW CHART:

Page 82: MP8085 Lab Manual

82

START

READ THEOCTAL NUMBER

PERFORM AND OPERATION WITH 07 & STORE IN C REGISTER

MOVE ORIGINAL OCTAL NUMBER TO ACCUMULATOR

PERFORM AND OPERATION 60H AND ROTATE ACCUMULATOR RIGHT

ONCE

ADD CONTENT OF D REGISTER & STORE IN ADDRESS

MOVE ORIGINAL NUMBER TO ACCUMULATOR

ADD CONTENT OF C REGISTER & STORE IN ADDRESS

PERFORM AND OPERATION WITH 10H AND ROTATE ACCUMULATOR

RIGHT ONCE

STOP

Page 83: MP8085 Lab Manual

INPUT & OUTPUT Before Execution After Execution

(e) Binary to Ascii

Algorithm:

Step 1: Start the program

Step 2: Load the contents of accumulator from the specified address

Step 3: Add the content of accumulator with immediate data

Step 4: Compare the content of accumulator with the immediate data

Step 5: Jump on no carry to loop

Step 6: Start a loop

Step 7: Store the contents of accumulator

83

Address Data9050 45

Address Data9050 459052 25

Page 84: MP8085 Lab Manual

Step 8: Stop the program

(f)Ascii to Binary

Algorithm:

84

FLOW CHART:

Page 85: MP8085 Lab Manual

Step 1: Start the program

Step 2: Load the content of the accumulator from the specified. address

Step 3: Subtract the content of accumulator from the immediate data

Step 4: Compare the content of accumulator with immediate data

Step 5: Jump on no carry to loop

Step 6: Subtract the content of the accumulator with the immediate data

Step 7: Start a loop

Step 8: Store the content of accumulator

Step 9: Stop the program

85

FLOW CHART:

Page 86: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

86

Page 87: MP8085 Lab Manual

8100

8103

8105

8107

810A

810C

810F

Loop

LDA 9100

SUI 30

CPI 0A

JC LOOP

SUI 07

STA 9101

HLT

3A 00 91

D6 30

FE 0A

DA 0C 81

D6 07

32 01 91

76

Load the ASCII value to accumulator.

Subtract 30 H immediately both for the Numbers 0-9 as well as characters A-F.Check if result is less than 0A H.

If the value is less than 0A i.e. if the Numerals are between 0-9 store the result in address.Else subtract 07 H immediately withAccumulator for characters A-F.

Store the corresponding binary value in address.Stop the program.

Program code:

87

Page 88: MP8085 Lab Manual

Result: Thus assembly language programs are written for Intel 8085 microprocessor to perform

the following functions;

(a) BCD to Binary

(b) Binary to BCD

(c) Binary to octal

(d) Octal to Binary

(e) Binary to Ascii

(f) Ascii to Binary

88

Page 89: MP8085 Lab Manual

Exp.No:4Generating series

89

Page 90: MP8085 Lab Manual

Date:

Aim: To interface the following peripherals with 8085 microprocessor and perform simple operations;

(a) Fibonacci series

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

Algorithm:

Step 1: Get the count up to which the series has to be generated and also the starting memory address where the series has to stored.

Step 2: Initialize the first and second values in registers.

Step 3: Store the content of accumulator in memory.

Step 4: Add the second number with the first number.

Step 5: Increment memory pointer.

Step 6: Interchange values in the register.

Step 7: Decrement count by 1

Step 8: Check for zero, if zero flag is set, go to next step. Else go to step 3.

Step 9: Stop execution.

90

Page 91: MP8085 Lab Manual

START

GET THE COUNT UPTO WHICH THE SERIES HAS TO BE GENERATED

LOAD THE STARTING MEMORY ADDRESS WHERE THE SERIES HAS TO BE STORED.

INITIALISE THE FIRST VALUE AS 00 AND SECOND VALUE AS 01 IN ANY REGISTER.

STORE THE CONTENT OF ACCUMULATOR TO MEMEORY POINTED BY THE REGISTER PAIR.

ADD THE SECOND NUMBER WITH THE FIRST NUMBER

INCREMENT THE MEMORY POINTER

INTERCHANGE THE VALUES IN REGISTER.

DECREMENT THE COUNT

CHECK FOR ZERO

STOP

YES

NO

91

FLOW CHART:

Page 92: MP8085 Lab Manual

ADDRESS LABEL MNEMONIC OPCODE COMMENTS

8000

8003

8005

8007

800A

800B

800C

800D

800E

800F

8010

8011

8012

8015

LOOP

LXI D,FA02

MVI B,00

MVI C,01

LDA FAOO

MOV H,A

MOV A,B

STAX D

INX D

ADD C

MOV B,C

MOV C,A

DCR H

JNZ LOOP

HLT

11 02 FA

06 00

0E 01

3A 00 00

67

78

12

13

81

41

4F

25

C2 0C 80

76

LoadDE pair immediately

Move immediate 00 to B register

Move immediate 01 to C register

Directly load accumulator

Move content of acc. To H register

Move content of B register to acc.

Store accumulator indirect

IncrementDE pair by 01

Add content of C register to acc.

Move content of C to B register

Move content of acc. To C register

Decrement H register by 01

Jump on no zero loop

Stop the program

program code:

92

Page 93: MP8085 Lab Manual

Result: Thus assembly language programs are written for Intel 8085 microprocessor to perform

the following functions;

(a) Fibonacci series

93

Page 94: MP8085 Lab Manual

Exp.No:5Sorting

Date:

Aim:To interface the following peripherals with 8085 microprocessor and perform simple

operations;

(a) Ascending

(b) Descending

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

(a)Ascending

Algorithm:

1. Start the program

2. Move immediate data to C register

3. Move the data C to B register.

4. Load HL register pair to accumulator.

5. Move the data M to D register

6. Jump on no carry.

7. Move the data M to D register.

8. Decrement the HL registers pair.

9. Increment the HL registers pair.

10. Decrement the B register.

11. Jump on no carry.

12. Decrement the C register.

13. Jump on no zero.

14. Stop the program.

94

Page 95: MP8085 Lab Manual

95

Page 96: MP8085 Lab Manual

96

START

LOAD THE STARTING ADDRESS OF THE BLOCK INTO REGISTER PAIR AND THAT OF A COUNT TO

A REGISTER

MOVE THE CONTENT OF MEMORY POINTED BY HL REGISTER TO ANY REGISTER

CHECK

FOR CARR

Y

INCREMENT THE MEMORY POINTER

MOVE THE CONTENT OF MEMORY POINTED BY HL REGISTER PAIR TO A

COMPARE THE CONTENTS OF REGISTER WITH ACCUMULATOR

INTERCHANGE THE COMPARED VALUES

DECREMENT THE COUNT REGISTER.

DECREMENT THE OUTER COUNT REGISTER.

CHECK

FOR ZERO

CHECK

FOR ZER

OSTOP

NO

YES

NO

YES

NOYES

FLOW CHART:

Page 97: MP8085 Lab Manual

Program code:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000MVI C, OA OE OA Move immediate data to C

register.

8002 LOOP1 MOV B, C 41 Move the data C to B register

8003LXI H, 9100 21 00 91 Load HL register pair to

accumulator

8006 LOOP MOV D, M 56 Move the data D to M register.

8007 INX H 23 Increment the H register pair

8008 MOV A, M 7E Move the data A to M register.

8009CMP D BA Compare D register to

accumulator.

800A JNC CONT D2 0F 80 Jump on no carry

800D MOV M, D 72 Move the data M to D register

800E DCX H 2B Decrement the HL register pair.

800FMOV M, A 17 Move the data M to

accumulator.

8010 INX H 23 Increment the HL register pair.

8011 CONT DCR B 05 Decrement the B register.

8012 JNZ LOOP C2 04 80 Jump on no zero.

8015 DCR C 0D Decrement the C register.

8016 JNZ LOOP1 C2 02 80 Jump on no zero.

8019 HLT 76 Stop the program.

97

Page 98: MP8085 Lab Manual

(b)Descending

Algorithm:1. Start the program.

2. Move the immediate data to c register.

3. Move the data C to B register.

4. Load HL register pair to accumulator.

5. Move the data D to M register.

6. Increment the H register pair.

7. Move the data A to M register.

8. Compare D register to Accumulator.

9. Jump on carry.

10. Move the data M to D register.

11. Decrement the HL register pair.

12. Increment the HL register pair.

13. Jump on no zero.

14. Decrement the C register.

15. Jump on no zero.

16. Stop the program.

98

Page 99: MP8085 Lab Manual

99

START

LOAD THE STARTING ADDRESS OF THE BLOCK INTO REGISTER PAIR AND COUNT TO A

REGISTER

MOVE THE CONTENT OF MEMORY POINTED BY HL REGISTER TO ANY REGISTER

CHECK

FOR CARR

Y

INCREMENT THE MEMORY POINTER

MOVE THE CONTENT OF MEMORY POINTED BY HL REGISTER PAIR TO A

COMPARE THE CONTENTS OF REGISTER WITH ACCUMULATOR

INTERCHANGE THE COMPARED VALUES

DECREMENT THE COUNT REGISTER.

DECREMENT THE OUTER COUNT REGISTER.

CHECK

FOR ZERO

CHECK

FOR ZER

OSTOP

YES

NO

NO

YES

NOYES

FLOW CHART:

Page 100: MP8085 Lab Manual

Program code:ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000MVI C, OA OE OA Move immediate data to C

register.

8002 LOOP1 MOV B, C 41 Move the data C to B register

8003LXI H, 9100 21 00 91 Load HL register pair to

accumulator

8006LOOP MOV D, M 56 Move the data D to M

register.

8007 INX H 23 Increment the H register pair

8008MOV A, M 7E Move the data A to M

register.

8009CMP D BA Compare D register to

accumulator.

800A JNC CONT D2 0F 80 Jump on no carry

800D MOV M, D 72 Move the data M to D register

800EDCX H 2B Decrement the HL register

pair.

800FMOV M, A 17 Move the data M to

accumulator.

8010INX H 23 Increment the HL register

pair.

8011 CONT DCR B 05 Decrement the B register.

8012 JNZ LOOP C2 04 80 Jump on no zero.

8015 DCR C 0D Decrement the C register.

8016 JNZ LOOP1 C2 02 80 Jump on no zero.

8019 HLT 76 Stop the program.

100

Page 101: MP8085 Lab Manual

Result: Thus assembly language programs are written for Intel 8085 microprocessor to perform the

following functions;

(a) Ascending

(b) Descending

101

Page 102: MP8085 Lab Manual

102

Page 103: MP8085 Lab Manual

Exp.No:6Message Display

Date:

Aim:

To develop an assembly language program to perform the running & blinking operations

of LED’s.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

Algorithm:

BLINKING OF LED’S

Step 1: Load the control word to the accumulator to indicate that 8255 is in I/O mode and port A

is enabled.

Step 2: Send the control word to the control port of 8255.

Step 3: Load the accumulator with ‘FF” to make all the LED’s glow.

Step 4: Send the accumulator content to the port A of 8255.

Step 5: Call the delay program to have time delay between change in output state.

Step 6: Complement the accumulator content to change the state of output.

Step 7: Repeat the step 4 to 6 to obtain continuous blinking of LED’s.

MOVING LED’S

Step 1: Load the control word to the accumulator to indicate that 8255 is in I/O mode and port A

is enabled.

Step 2: Send the control word to the control port of 8255.

Step 3: Load the accumulator with high value for the bit whose corresponding LED has to glow.

For making the left most LED to glow load the accumulator with 80.

Step 4: Send the accumulator content to the port A of 8255.

Step 5: Call the delay program to have time delay between change in output state.

103

Page 104: MP8085 Lab Manual

Step 6: Rotate the accumulator content left to right without carry according to the sequence

required.

DELAY:

STEP 1: Load the outer loop count to any register.

STEP 2: Load the first inner loop count.

STEP 3: Load the second inner loop count.

STEP 4: Decrement the second inner loop count.

STEP 5: Check for zero. If zero is reached go to next step else go to step 4.

STEP 6: Decrement the first inner loop count.

STEP 7: Check for zero, if zero is reached go to next step else go to step 3.

STEP 8: Decrement the outer loop count.

STEP 9: Check for zero. If Zero is set go to next step else go to step 2.

STEP 10: Return to main program.

104

Page 105: MP8085 Lab Manual

START

LOAD THE COUNT TO REGISTER PAIR

DECREMENT THE COUNT

CHECK

FOR ZERO

RETURN

NO

YES

FLOW CHART:

DELAY:

105

Page 106: MP8085 Lab Manual

106

START

LOAD THE NUMBER OF CHARACTERS REQUIRED TO ANY REGISTER.

LOAD THE DISPLAY FIELD ADDRESS TO REGISTER.

HAVE THE FIELD ADDRESS IN ACCUMULATOR AND MOVE IT TO CONTROL

REGISTER ADDRESS OF 8279

COPY THE DISPLAY CONTROL WORD FROM MEMORY TO ACCUMULATOR.

MOVE THE DISPLAY CONTROL WORD TO DATA REGISTER ADDRESS OF 8279

INCREMENT THE MEMORY POINTER

DECREMENT THE DISPLAY FIELD ADDRESS AND NUMBER OF CHARACTERS REQUIRED

CHECK FOR

ZERO

RETURN

NO

YES

DISPLAY:

Page 107: MP8085 Lab Manual

CLEAR:

107

START

LOAD THE NUMBER OF CHARACTERS REQUIRED TO ANY REGISTER.

LOAD THE DISPLAY FIELD ADDRESS TO REGISTER.

HAVE THE FIELD ADDRESS IN ACCUMULATOR AND MOVE IT TO CONTROL

REGISTER ADDRESS OF 8279

MOVE IMMEDIATELY THE DISPLAY CONTROL WORD AS ‘FF’ TO GET OFF STATE

MOVE THE DISPLAY CONTROL WORD TO DATA REGISTER ADDRESS OF 8279

INCREMENT THE MEMORY POINTER

DECREMENT THE DISPLAY FIELD ADDRESS AND NUMBER OF CHARACTERS

REQUIRED

CHECK FOR

ZERO

RETURN

NO

YES

Page 108: MP8085 Lab Manual

MAIN PROGRAM:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000LOOP

LXI H, 9100210091

Load the starting address where the message display control words are stored.

8003 CALL DISPLAYCD 00 90

CALL the subroutine DISPLAY to display the characters.

8006 CALL DELAYCD 00 81

CALL the subroutine DELAY to display the characters for a particular time.

8009 CALL CLEARCD0092

CALL the function CLEAR to clear the display.

800C CALL DELAYCD0081

CALL the function DELAY to display blank for particular time.

800E JMP LOOPC30080

Jump unconditionally to LOOP to have continuous flashing.

DISPLAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000DISPLAY

MVI C, 060E06

Move immediately the count required for number of characters required to ‘C’ register

9002 MVI B, 870687

Move immediately the starting field address of the display device to ‘B’ register

9004REPEAT

MOV A, B 78Copy the content of the ‘B’ register to accumulator.

9005 OUT D1D3D1

Move the accumulator content to 8279-control register address.

9007 MOV A, M 7E Move the display control word stored in memory to

108

Page 109: MP8085 Lab Manual

accumulator.

9008 OUT D0D3D0

Move the content of accumulator to display/keyboard interface data register

900A INX H 23Increment the memory pointer.

900B DCR B 05Decrement the display field address content.

900C DCR C 0DDecrement the count for number of characters required.

900D JNZ REPEATC20490

Check for Zero flag, if is not set goto REPEAT.

9010 RET C9 Return to main function.

CLEAR:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9200CLEAR

MVI C, 060E06

Move immediately the count required for number of characters required to ‘C’ register

9202 MVI B, 870687

Move immediately the starting field address of the display device to ‘B’ register

9204REPEAT

MOV A, B 78Copy the content of the ‘B’ register to accumulator.

9205 OUT D1D3D1

Move the accumulator content to 8279-control register address.

9207 MVI A, FF 3EFF

Move immediately ‘FF’ to make all the segments

109

Page 110: MP8085 Lab Manual

dark.

9209 OUT D0D3D0

Move the content of accumulator to display/keyboard interface data register

920B INX H 23Increment the memory pointer.

920C DCR B 05Decrement the display field address content.

920D DCR C 0DDecrement the count for number of characters required.

920E JNZ REPEATC20492

Check for Zero flag, if is not set go REPEAT.

9211 RET C9 Return to main function.

110

Page 111: MP8085 Lab Manual

Exp.No:7Digital Clock

Date:

Aim:

To develop an assembly language program to create digital clock display using LED

display.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

STEP 1: Initialize the hour register with 00H.

STEP 2: Store the content of hour register to input address of UPDAD – ‘FFF7’

STEP 3: Call the function ‘UPDAD’ to display the hour value.

111

Page 112: MP8085 Lab Manual

STEP 4: Initialize the minute register with 00 H.

STEP 5: Store the content of minute register to input address ‘FFF8’ of UPDAD.

STEP 6: Call the function ‘UPDAD’ to display the minute value.

STEP 7: Initialize the second register as 00 H.

STEP 8: Store the content of seconds register to input address ‘FFF9’ UPDDT.

STEP 9: Call the function ‘UPDDT’ to display the seconds value.

STEP 10: Call the delay subroutine.

STEP 11: Increment the content of seconds register.

STEP 12: Check if seconds = 60, if yes go to next step else go to step 8

STEP 13: Increment the content of minute register.

STEP 14: Check if minute = 60, if yes go to next step else go to step 5.

STEP 15: Increment the hours register content.

STEP 16: Check if hours = 24. If yes go to next step, else go to 2.

STEP 17: Go to step 1.

DELAY:

STEP 1: Load the outer loop count to any register.

STEP 2: Load the first inner loop count.

STEP 3: Load the second inner loop count.

STEP 4: Decrement the second inner loop count.

STEP 5: Check for zero. If zero is reached go to next step else go to step 4.

STEP 6: Decrement the first inner loop count.

STEP 7: Check for zero, if zero is reached go to next step else go to step 3.

STEP 8: Decrement the outer loop count.

STEP 9: Check for zero. If Zero is set go to next step else go to step 2.

STEP 10: Return to main program.

112

Page 113: MP8085 Lab Manual

113

Page 114: MP8085 Lab Manual

114

START

STORE THE CONTENT OF HOUR REGISTER TO INPUT ADDRESS FFF7 OF ‘UPDAD’

STORE THE CONTENT OF MINUTE REGISTER TO THE INPUT ADDRESS FFF8 OF ‘UPDAD’

INITIALIZE THE MINUTE REGISTER COUNTER WITH 00

INITIALIZE THE HOUR REGISTER COUNTER WITH 00

INITIALIZE THE SECONDS REGESITER COUNT AS 00

STORE THE CONTENT OF SECOND REGISTER TO INPUT ADDRESS FFF9 OF ‘UPDDT’

A

CALL THE FUNCTION ‘UPDAD’ TO DISPLAY THE MINUTE

CALL THE FUNCTION ‘UPDAD’ TO DISPLAY THE HOUR

CALL THE FUNCTION ‘UPDDT’ TO DISPLAY THE SECONDS

CALL THE FUNCTION ‘DEALY’

E

D

C

B

FLOW CHART:

Page 115: MP8085 Lab Manual

115

A

INCREMENT THE CONTENT OF SECONDS REGISTER

CHECK FOR

60

INCREMENT THE CONTENT OF MINUTE COUNT REGISTER

CHECK FOR

60

INCREMENT THE CONTENT OF HOUR COUNT REGISTER

CHECK FOR 24

B

C

D

NO

YES

NO

YES

NO

YES

E

Page 116: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000LOOP 3

MVI D, 001600

Clear the ‘D’ register for having the hour count.

8002 LOOP2 MOV A, D 7AMove the hour count to the accumulator.

8003 STA FFF832F8FF

Store the hour value in the input address of ‘UPDAD’ utility subroutine

8006 CALL 06BCCDBC06

CALL the function ‘UPDAD’ to display the hour value.

8009 MVI C, 00 0E00

Clear the minute count register C.

800B LOOP 1 MOV A, C 79Copy the minute count to the accumulator.

800C STA FFF732F7FF

Store the minute value in the input address of ‘UPDAD’ utility subroutine

800F CALL 06BCCDBC06

CALL the function UPDAD to display the minute value.

8012 MVI B, 00 0600

Clear the seconds count register contents.

8014 LOOP MOV A, B 78Copy the content of the seconds register to accumulator.

8015 STA FFF9 32F9FF

Store the second’s value in the input address of ‘UPDDT’ utility subroutine.

8018 CALL 06D3CDD306

CALL the function ‘UPDDT’ to display the second’s value.

801B CALL DELAYCD0090

CALL the delay function to have a 1 second delay in seconds count.

801E LDA FFF93AF9FF

Load the accumulator with the previous count of second’s register.

116

Page 117: MP8085 Lab Manual

8021 ADI 01 C601

Add immediate 01 to accumulator to increment the count.

8023 DAA 27Decimal adjust the accumulator to convert the count to packed BCD.

8024 MOV B, A 47Copy the accumulator to seconds register.

8025 CPI 60 FE60

Compare the count with terminal count 60 to start the minutes count.

8027 JNZ LOOPC21480

Check for zero flag; if it is not set goto increment the second again

802A LDA FFF73AF7FF

If 60 is reached in seconds count, load the previous count of minute to accumulator.

802D ADI 01 C601

Add immediately the content by 01 to increment the minute.

802F DAA 27Decimal adjust the accumulator to convert the count to packed BCD.

8030 MOV C, A 4FCopy the content of minute register to accumulator.

8031 CPI 60 FE60

Compare it with 60 the terminal count.

8033 JNZ LOOP 1C2OB80

If 60 is not reached goto LOOP1 seconds initialization step.

8036 LDA FFF83AF8FF

If 60 is reached in minute count, Load the previous value of hour to accumulator.

8039 ADI 01 C601

Add immediately the content by 01 to increment the hour.

803B DAA 27Decimal adjust the accumulator to convert the count to packed BCD.

803C MOV D, A 57Copy the content of hour register to accumulator.

803D CPI 24FE24

Compare immediate it with 24 the terminal count.

803F JNZ LOOP 2 C2 Check for zero flag, if it is not

117

Page 118: MP8085 Lab Manual

0280

set goto minute initialization step.

8042 JMP LOOPC30080

Jump unconditionally to hour initialization step i.e. clear the count and restart the clock.

1 SECOND DELAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000 MVI D, 021602

Move the outer count required to the ‘D’ register.

9002LOOP 1

LXI B, FFFF01FFFF

Load the inner loop count to the ‘BC’ register pair.

9005LOOP

DCX B 0BDecrement the inner loop count.

9006 MOV A C 79Move the content of ‘C” register to accumulator.

9007 ORA B B0OR the content of ‘B’ register with Accumulator content.

9008 JNZ LOOPC20590

Check for the Zero flag if it is not set goto LOOP.

900B DCR D 15Decrement the outer loop count.

900C JNZ LOOP 1 C2 02 90Check for Zero flag, if it is not set goto LOOP 1 (the initialization of inner loop)

900F RET C9Return to calling main program.

118

Page 119: MP8085 Lab Manual

Exp.No:8Counter

Date:

Aim:

To develop an assembly language program to perform the counter operation.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

119

Page 120: MP8085 Lab Manual

FLOW CHART:

120

LOAD THE INITIAL COUNT OF THE COUNTER TO THE ACCUMULATOR.

START

STORE THE CONTENT OF ACCUMULATOR TO INPUT ADDRESS FFF9 OF ‘UPDDT’.

CALL THE FUNCTION ‘UPDDT’ TO DISPLAY THE COUNT.

CALL THE FUNCTION DELAY TO HAVE THE REQUIRED TIME DELAY BETWEEN THE COUNTS.

INCREMENT THE COUNT i.e. THE ACCUMULATOR CONTENT.

CHECK

FOR TC

NO

YES

Page 121: MP8085 Lab Manual

DELAY:

121

START

LOAD THE OUTER LOOP COUNT TO ANY REGISTER

CHECK FORZE

RO

RETURN

LOAD THE INNER LOOP COUNT TO ANOTHER REGISTER

DECREMENT THE OUTER LOOP COUNT

CHECK FOR ZERO

DECREMENT THE INNER LOOP COUNT

NO

YES

NO

YES

Page 122: MP8085 Lab Manual

PROGRAM:

MOD 9 COUNTER

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000LOOP 1

MVI A, 003E00

Move immediately the value 00 to accumulator to initialize the count.

8002 LOOP STA FFF932F9FF

Store the content of accumulator to input address of UPDDT.

8005 CALL 06D3CDD306

CALL the function update data field (UPDDT) to display the count in data field LED.

8008 CALL DELAYCD0090

CALL the function delay to have a 1-second delay between the counts.

800B LDA FFF93AF9FF

Load the accumulator with previous count value from the memory.

800E ADI 01C601

Add 01 to the accumulator content.

8010 CPI 0AFE0A

Compare the terminal count 0A with the accumulator content.

8012 JNZ LOOPC20280

If the terminal count is not reached continue to display the count.

8015 JMP LOOP 1C30080

Else, jump unconditionally to LOOP to reinitialize the count

1 SECOND DELAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000 MVI D, 021602

Move the outer count required to the ‘D’ register.

9002 LOOP1 LXI B FFFF01FFFF

Load the inner loop count to the ‘BC’ register pair.

9005 DCX B 0B Decrement the inner loop

122

Page 123: MP8085 Lab Manual

LOOPcount.

9006 MOV A C 79Move the content of ‘C” register to accumulator.

9007 ORA B B0OR the content of ‘B’ register with Accumulator content.

9008 JNZ LOOPC20590

Check for the Zero flag if it is not set go to LOOP.

900B DCR D 15Decrement the outer loop count.

900C JNZ LOOP 1 C2 02 90Check for Zero flag, if it is not set go to LOOP 1 (the initialization of inner loop)

900F RET C9 Return to main program.

Exp.No:9Digital Calculator

Date:

Aim:

To develop an assembly language program to simulate a digital calculator using 8085 Microprocessor.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

STEP 1: Load the accumulator with the hex equivalent to choose the operation to be performed.

STEP 2: Compare whether the loaded value is equivalent to addition operation, is so go to step 4, else go to next step.

STEP 3: Compare whether the loaded value is equivalent to subtraction operation, if so go to step 6, else exit the program.

123

Page 124: MP8085 Lab Manual

STEP 4: Load the numbers to be added into the registers from the memory.

STEP 5: Add the two numbers. Convert them into packed BCD and store in the input address of UPDAD & UPDDT and go to step 8

STEP 6: Load the numbers to be added into the registers from the memory.

STEP 7: Perform BCD subtraction and store in the input address of UPDAD & UPDDT STEP 8: Call the utility subroutines ‘UPDAD’ and ‘UPDDT’ to display the result.

STEP 9: Stop execution

124

Page 125: MP8085 Lab Manual

125

LOAD THE ACCUMULATOR WITH HEX EQUIVALENT OF THE OPERATION TO BE

PERFORMED.

COMPARE THE LOADED VALUE WITH ADDITION EQUIVALENT.

CHECK FOR

ZERO

COMPARE THE LOADED VALUE WITH SUBTRACTION EQUIVALENT.

CHECK FOR

ZERO

PERFORM THE BCD ADDITION OF ENTERED NUMBERS WITH CARRY

STORE THE RESULTS IN MEMORY TO BE DISPLAYED IN LED DISPLAY.

PERFORM THE BCD SUBTRACTION OF ENTERED NUMBERS WITH CARRY

A

B

START

FLOW CHART:

YES

NO

YES

NO

A

STORE THE RESULT IN MEMEORY

MOVE THE STORED RESULTS TO REGISTERS AND STORE THEM TO THE INPUT ADDRESS

OF ‘DATA UPDATE’ AND ‘ADDRESS UPDATE ‘SUBROUTINES

CALL THE ‘UPDAD’ AND ‘UPDDT’ SUBROUTINES TO DISPLAY THE

VALUES.

STOP

B

Page 126: MP8085 Lab Manual

PROGRAM:

ADDRESS LABEL MNEMONIC OPCODE COMMENTS

8000 LDA 90003A0090

Load the accumulator with hex equivalent to choose the operation to be performed.

8003 CPI 0BFE0B

Compare whether the loaded value is equivalent to that of addition operation.

8005 JZ ADDCA1080

Check for zero flag, if it is set goto loop ADD to perform addition.

8008 CPI 0CFE0C

Compare whether the loaded value is equivalent to that of subtraction operation.

800A JZ SUBCA2B80

Check for zero flag, if it is set goto loop SUB to perform subtraction.

800D JMP ENDC36980

If no related hex equivalent is loaded jump unconditionally to END.

8010ADD

MVI A, 003E00

Clear the content of accumulator to load the numbers

8012 LDA 91003A0091

Load the first number to be added from memory to accumulator.

8015 MOV B, A 47Copy the number to ‘B’ register

8016 LDA 91013A0191

Load the second number to be added from memory to accumulator.

8019 MVI C, 000E00

Clear the content of ‘C’ register to hold the carry.

801B ADD B 80 Add the numbers.

801C DAA 27Decimal adjust the accumulator to convert the answer into packed BCD.

801D JNC LOOP 1D22180

Check for the carry flag, if it is not set goto LOOP 1.

8020 INR C 0CElse increment the content of ‘C’ register to hold the carry.

126

Page 127: MP8085 Lab Manual

ADDRESS LABEL MNEMONIC OPCODECOMMENTS

8021LOOP 1

STA 9102320291

Store the result of addition to the memory

8024 MOV A, C 79Copy the content of carry register to accumulator.

8025 STA 9103320391

Store the carry in memory.

8028JMP

DISPLAY

C35280

Jump unconditionally to DISPLAY to display the result.

802BSUB

MVI A, 003E00

Clear the content of accumulator to load the values.

802D MVI D, 001600

Clear the ‘D’ register to hold the borrow value.

802F LDA 91003A0091

Load the minuend into the accumulator from the memory.

8032 MOV C, A 4FCopy the minuend accumulator to ‘C’ register.

8033 LDA 91013A0191

Load the subtrahend into the accumulator from memory.

8036 MOV B, A 47Copy the subtrahend value to ‘B’ register.

8037 MVI A, 993E99

Move immediately ‘99’ to accumulator to perform 99’s complement.

8039 SUB B 90Subtract the subtrahend value from ‘99’.

803A ADI 01C601

Add 01 to the subtracted value to obtain 100’s complement.

803D ADD C 81Add the minuend value to the 100’s complement value.

803E DAA 27Decimal adjust the accumulator to obtain packed BCD of the resultant.

803F JC OUT 1DA4B80

Check for the carry (borrow). If it is set go to loop OUT 1.

8042 MOV B, A 47Copy the content of accumulator to ‘B’ register.

127

Page 128: MP8085 Lab Manual

ADDRESS LABEL MNEMONIC OPCODE COMMENTS

8043 MVI A, 993E99

Move immediately ‘99’ to accumulator to perform 99’s complement.

8045 SUB B 90Subtract the subtrahend value from ‘99’.

8046 ADI 01C601

Add 01 to the subtracted value to obtain 100’s complement

8048 DAA 27Decimal adjust the accumulator to obtain packed BCD of the resultant.

8049 MVI D, 011601

Move immediately ‘01’ to D register to indicate borrow.

804BOUT 1

STA 9102320291

Store the subtracted value to memory.

804E MOV A, D 7AMove the borrow value to accumulator.

804F STA 9104320391

Store the carry (borrow) to the memory.

8052DISPLAY

LDA 91023A0291

Load the accumulator with the stored value of resultant of operation performed.

8055 STA FFF932F9FF

Store the resultant in the input address location of ‘UPDDT’ utility subroutine.

8058 CALL 06D3CDD306

CALL the function ‘UPDDT’ to display the result in data field LED.

805B LDA 91033A0391

Load the accumulator with the stored value of carry of operation performed.

805E STA FFF732F7FF

Store the carry to the input address of ‘UPDAD’ utility subroutine.

8061 MVI A, 003E00

Clear the accumulator content.

8063 STA FFF832F8FF

Store the accumulator content to the input address of ‘UPDAD’ utility subroutine..

8066 CALL 06BC CD CALL the function ‘UPDAD’

128

Page 129: MP8085 Lab Manual

BC06

to display the result in the address field LED’s.

8069 HLT 76 Stop execution.

Exp.No:10Square Wave Generation

129

Page 130: MP8085 Lab Manual

Date:

Aim:

To develop an assembly language program to produce a square wave output using

Output lines of 8255

SOD lines of 8085 microprocessor..

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

USING 8255

Step 1: Load the appropriate control word to accumulator and more it to control part of 8255

Step 2: Load the appropriate control word to the generating logical high in accumulator.

Step 3: Move the content the accumulator to output port of 8255.

Step 4: Call the delay sub routine to generate a time delay between different states.

Step 5: Complement accumulator content to get logical LOW.

Step 6: Go to step 3.

USING 8085 SOD LINES

Step 1: Load the appropriate control word to the accumulator having HIGH values for SOD.

Step 2: Using SIM instruction, move the control word to output line of 8085.

Step 3: Call the delay subroutine to generate time delay between states.

Step 4: Load the control word to accumulator for having low values for SOD.

Step 5: Calculate the delay subroutine to generate time delay between states.

Step 6: Go to step 1.DELAY

130

Page 131: MP8085 Lab Manual

Step 1: Load the outer loop count to any register.

Step 2: Load the first inner loop count.

Step 3: Load the second inner loop count.

Step 4: Decrement the second inner loop count.

Step 5: Check for zero. If zero is set, go to next step. Else, goto step 3.Step 6: Decrement the outer loop count.

Step 7: Check for zero. If zero is set, go to next step. Else, goto step 2.

Step 8: Return to main program.

FLOW CHART:

131

Page 132: MP8085 Lab Manual

USING 8255:

132

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROLPORT

OF 8255

LOAD THE INITIAL CONTROL WORD TO GENERATE LOGICAL HIGH IN THE ACCUMULATOR

MOVE THE CONTENT OF ACCUMULATOR TO ANY OUTPUTPORT OF 8255

COMPLEMENT THE CONTENT OF ACCUMULATOR TO CHANGE THE STATE OF OUTPUT

CALL THE FUNCTION DELAY

Page 133: MP8085 Lab Manual

USING 8085 SOD LINES:

133

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR HAVING HIGH VALUE FOR SOD

USE THE SIM INSTRUCTION TO MOVE THE ACCUMULATOR CONTENT TO OUTPUTPORT OF

8085

CALL THE FUNCTION DELAY

LOAD THE CONTROL WORD TO THE ACCUMULATOR HAVING LOW VALUE FOR SOD

CALL THE FUNCTION DELAY

Page 134: MP8085 Lab Manual

DELAY:

SQUARE WAVE GENERATION

134

LOAD THE OUTER LOOP COUNT TO ANY REGISTER

LOAD THE INNER LOOP 1 COUNT

LOAD THE INNER LOOP 2 COUNT

DECREMENT THE INNER LOOP 2 COUNT

CHECK

FOR ZERO

DECREMENT THE INNER LOOP 1 COUNT

CHECK

FOR ZERO

DECREMENT THE OUTER LOOP COUNT

CHECK FOR ZERO

NO

YES

NO

YES

NO

YES

RETURN

START

Page 135: MP8085 Lab Manual

PROGRAM:

USING 8255 PORTS

ADDRESS LABEL MNEMONICS ODCODE COMMENTS

8000 MVI A, 803E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3C3F3

Move the control word to the control port .

8004 MVI A, FF3EFF

Move FF immediately to the accumulator to activate all the lines of the selected port of 8255.

8006LOOP

OUT F0D3F0

Move the accumulator content to port A of 8255.

8008 CALL DELAYCD0090

CALL the delay program to generate a pulse of required width.

800B CMA 2FComplement the accumulator content to change the output state.

800C JMP LOOPC30680

Jump unconditionally to obtain continuous square waveform.

USING SOD LINES OF 8085

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000LOOP

MVI A, C03EC0

Move the control word immediately to the accumulator to enable a high output from the serial output data pin of 8085.

8002 SIM 30Invoke the SIM instruction to have a high output at SOD.

8003 CALL DELAYCD0090

CALL the delay program to generate the pulse of required width.

8006 MVI A, 403E40

Move the control word immediately to the accumulator to enable a low output from the serial output data pin of 8085.

8008 SIM 30Invoke the SIM instruction to have a low output at SOD.

8009 CALL DELAYCD0090

CALL the delay program to generate the time interval of required width.

135

Page 136: MP8085 Lab Manual

800C JMP LOOPC30080

Jump unconditionally to obtain a continuous square waveform.

10 ms DELAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000 MVI E, 0A1E0A

Move immediately the outer loop count 0A to the E register.

9002LOOP1

MVI C, FF0EFF

Move immediately the inner loop count FF to the C register.

9004LOOP

DCR C 0DDecrement the inner loop count i.e. C register content.

9005 JNZ LOOPC20490

Check for Zero flag, if it is not set goto Loop. Otherwise goto next step.

9008 DCR E 1DDecrement the outer loop count i.e. the E register content.

9009 JNZ LOOP1C20990

Check for Zero flag, if it is not set goto LOOP1. Otherwise goto next step.

900C RET C9Return to the main function.

Exp.No:11 Traffic Light interface

136

Page 137: MP8085 Lab Manual

Date:

Aim:

To develop an assembly language program for traffic light control using programmable peripheral interface 8255.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

MAIN PROGRAM

STEP 1: Load the control word to accumulator, to indicate that the 8255 is in I/O mode.

STEP 2: Send the control word to the control port of 8255.

STEP 3: Call the subroutine NORTH.

STEP 4: Call the subroutine EAST.

STEP 5: Call the subroutine SOUTH.

STEP 6: Call the subroutine WEST.

STEP 7: Repeat the steps from step 3 to step 6 to control the signal.

SUB- ROUTINES

NORTH:

STEP 1: Get the output control word for the schedule I of traffic lights.

STEP 2: Move the control word to the output port of the 8255.

STEP 3: Call delay program for 3 sec to change from amber to red and amber to green.

STEP 4: Get the output control word for the schedule II and move to the output port of the 8255.

STEP 5: Call the delay subroutine for generating a time delay of 30 sec between the schedules.

STEP 6: Return to main program.

EAST:

137

Page 138: MP8085 Lab Manual

STEP 1: Get the output control word for the schedule III of traffic lights.

STEP 2: Move the control word to the output port of the 8255.

STEP 3: Call delay program for 3 sec to change from amber to red and amber to green.

STEP 4: Get the output control word for the schedule IV and move to the output port of the

8255.

STEP 5: Call the delay subroutine for generating a time delay of 30 sec between the schedules.

STEP 6: Return to main program.

SOUTH:

STEP 1: Get the output control word for the schedule V of traffic lights.

STEP 2: Move the control word to the output port of the 8255.

STEP 3: Call delay program for 3 sec to change from amber to red and amber to green.

STEP 4: Get the output control word for the schedule VI and move to the output port of the

8255.

STEP 5: Call the delay subroutine for generating a time delay of 30 sec between the schedules.

STEP 6: Return to main program.

WEST:

STEP 1: Get the output control word for the schedule VII of traffic lights.

STEP 2: Move the control word to the output port of the 8255.

STEP 3: Call delay program for 3 sec to change from amber to red and amber to green.

STEP 4: Get the output control word for the schedule VIII and move to the output port of the

8255.

STEP 5: Call the delay subroutine for generating a time delay of 30 sec between the schedules.

STEP 6: Return to main program.

FLOW CHART:

138

Page 139: MP8085 Lab Manual

START

CALL SUBROUTINE NORTH

CALL SUBROUTINE EAST

CALL SUBROUTINE SOUTH

CALL SUBROUTINE WEST

MAIN PROGRAM:

139

Page 140: MP8085 Lab Manual

EAST

OUTPUT THE CODE FOR SCHEDULE III

CALL DELAY 1

OUTPUT THE CODE FOR SCHEDULE IV

CALL DELAY 2

RETURN

NORTH

OUTPUT THE CODE FOR SCHEDULE I

CALL DELAY I

OUTPUT THE CODE FOR SCHEDULE II

CALL DELAY 2

RETURN

SUB-ROUTEINS:

140

Page 141: MP8085 Lab Manual

WEST

OUTPUT THE CODE FOR SCHEDULE VII

OUTPUT THE CODE FOR SCHEDULE VIII

CALL DELAY 2

RETURN

SOUTH

OUTPUT THE CODE FOR SCHEDULE V

CALL DELAY I

OUTPUT THE CODE FOR SCHEDULE VI

CALL DELAY 2

RETURN

CALL DELAY I

SWITCHING SHEDULE FOR TRAFFIC LIGHT

ON/OFF STATUS OF TRAFFIC LIGHTCONTROL

WORD

SCHEDULEPB3 PB2 PB1 PB0 PA7 PA6 PA5 PA4 PA3 PA2 PA1 PA0

PORT A PORT BWG WY WR SG SY SR EG EY ER NG NY NR

I 0 1 0 0 0 1 0 0 1 0 1 0 4A 04

II 0 0 1 0 0 1 0 0 1 1 0 0 4C 02

III 0 0 1 0 0 1 0 1 0 0 1 0 52 02

IV 0 0 1 0 0 1 1 0 0 0 0 1 61 02

V 0 0 1 0 1 0 0 1 0 0 0 1 91 02

VI 0 0 1 1 0 0 0 0 1 0 0 1 09 03

VII 0 1 0 0 1 0 0 0 1 0 0 1 89 04

VIII 1 0 0 0 0 1 0 0 1 0 0 1 49 08

MAIN PROGRAM:

141

Page 142: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000

8002

8004

8007

800A

800D

8010

LOOP

MVI A, 80

OUT F3

CALL NORTH

CALL EAST

CALL SOUTH

CALL WEST

JMP LOOP

3E 80

D3 F3

CD 30 80

CD 50 80

CD 70 80

CD 90 80

C3 04 80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.Send the control word through port A.

Call the subroutine for North direction.

Call the subroutine for East direction.

Call the subroutine for South direction.

Call the subroutine for West direction.

Repeat the subroutine calls unconditionally.

NORTH:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8030

8032

8034

8036

8038

803B

803D

803F

MVI A, 4A

OUT F0

MVI A, 04

OUT F1

CALL DELAY 1

MVI A, 4C

OUT F0

MVI A, 02

3E 4A

D3 F0

3E 04

D3 F1

CD 00 90

3E 4C

D3 F0

3E 02

Move the appropriate control word to accumulator.Send the control word through port A.Move the appropriate control word to accumulatorSend the control word through port B.Call the 3 sec delay for Amber light control.Move the appropriate control word to accumulator.Send the control word through port A.Move the control word to accumulator.

142

Page 143: MP8085 Lab Manual

8041

8043

8046

OUT F1

CALL DELAY 2

RET

D3 F1

CD 50 90

C9

Send the control word through port B.Call the 30 sec delay for green signal control.Return to main program.

EAST:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

143

Page 144: MP8085 Lab Manual

8050

8052

8054

8056

8058

805B

805D

805F

8061

8063

8066

MVI A, 52

OUT F0

MVI A, 02

OUT YY

CALL DELAY1

MVI A, 61

OUT F0

MVI A, 02

OUT F1

CALL DELAY 2

RET

3E 52

D3 F0

3E 02

D3 F1

CD 00 90

3E 61

D3 F0

3E 02

D3 F1

CD 50 90

C9

Move the appropriate control word to accumulator.Send the control word through port A.Move the appropriate control word to accumulatorSend the control word through port B.Call the 3 sec delay for Amber light control.Move the appropriate control word to accumulator.Send the control word through port A.Move the control word to accumulator.Send the control word through port B.Call the 30 sec delay for green signal control.Return to main program.

WEST:

144

Page 145: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8090

8092

8094

8096

8098

809B

809D

809F

80A1

80A3

80A6

MVI A, 89

OUT F0

MVI A, 04

OUT F1

CALL DELAY 1

MVI A, 49

OUT F0

MVI A, 08

OUT F1

CALL DELAY 2

RET

3E 89

D3 F0

3E 04

D3 F1

CD 00 90

3E 49

D3 F0

3E 08

D3 F1

CD 50 90

C9

Move the appropriate control word to accumulator.Send the control word through port A.Move the appropriate control word to accumulatorSend the control word through port B.Call the 3 sec delay for Amber light control.Move the appropriate control word to accumulator.Send the control word through port A.Move the control word to accumulator.Send the control word through port B.Call the 30 sec delay for green signal control.Return to main program.

SOUTH:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

145

Page 146: MP8085 Lab Manual

8070

8072

8074

8076

8078

807B

807D

807F

8081

8083

8086

MVI A, 89

OUT F0

MVI A, 02

OUT F1

CALL DELAY 1

MVI A, 09

OUT F0

MVI A, 03

OUT F1

CALL DELAY 2

RET

3E 91

D3 F0

3E 02

D3 F1

CD 00 90

3E 09

D3 F0

3E 03

D3 F1

CD 50 90

C9

Move the appropriate control word to accumulator.Send the control word through port A.Move the appropriate control word to accumulatorSend the control word through port B.Call the 3 sec delay for Amber light control.Move the appropriate control word to accumulator.Send the control word through port A.Move the control word to accumulator.Send the control word through port B.Call the 30 sec delay for green signal control.Return to main program.

DELAY PROGRAM FOR 3 SECONDS

146

Page 147: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000

9002

9004

9006

9008

9009

900C

900D

9010

9011

9014

9015

9018

LOOP3

LOOP2

LOOP1

LOOP

MVI H, 03

MVI C, 03

MVI D, FF

MVI E, FF

DCR E

JNZ LOOP

DCR D

JNZ LOOP1

DCR C

JNZ LOOP 2

DCR H

JNZ LOOP 3

RET

26 03

0E 03

16 FF

1E FF

1D

C2 08 90

15

C2 06 90

0D

C2 04 90

25

C2 02 90

C9

Initialize counter value to 03 H

Initialize counter value to 03 H

Load FF H to D register immediately.Load FF H to E register immediately.Decrement counter E by 1.

Move to next counter if count is zero.Decrement counter D by 1

Jump to counter E if count not zero.

Decrement counter C by 1.

Jump to counter D if count not zero.

Decrement counter H by 1.

Jump to LOOP 3 if count not zero.

Return to main program.

DELAY PROGRAM FOR 30 SECONDS

147

Page 148: MP8085 Lab Manual

ADDRESS LABLE MNEMOCIS OPCODE COMMENTS

9050

9052

9054

9056

9058

9059

905C

905D

9060

9061

9064

9065

9068

LOOP3

LOOP2

LOOP1

LOOP

MVI H, 1E

MVI C, 03

MVI D, FF

MVI E, FF

DCR E

JNZ LOOP

DCR D

JNZ LOOP 1

DCR C

JNZ LOOP 2

DCR H

JNZ LOOP 3

RET

26 1E

0E 03

16 FF

1E FF

1D

C2 58 90

15

C2 56 90

0D

C2 54 90

25

C2 52 90

C9

Initialize counter value to 1E H

Initialize counter value to 03 H

Load FF H to D register immediately.Load FF H to E register immediately.Decrement counter E by 1.

Move to next counter if count is zero.Decrement counter D by 1

Jump to counter E if count not zero.

Decrement counter C by 1.

Jump to counter D if count not zero.

Decrement counter H by 1.

Jump to counter C if count not zero.

Return to main program.

Exp.No:12Stepper Motor Interface

Date:

148

Page 149: MP8085 Lab Manual

Aim:

To interface a stepper motor with the 8085 microprocessor to control the speed using the programmable peripheral interface 8255.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

CLOCKWISE ROTATION:

STEP 1: Load the control word to accumulator and move it to the control port of 8255 to operate in

I/O mode.

STEP 2: Load the initial excitation word to accumulator.

STEP 3: Move the accumulator content to the output lines of 8255.

STEP 4: Call the delay function.

STEP 5: Rotate the accumulator right to excite the next pair of coils in clockwise direction.

STEP 6: Go to step 3.

ANTICLOCKWISE ROTATION:

STEP 1: Load the control word to accumulator and move it to the control port of 8255 to operate in

I/O mode.

STEP 2: Load the initial excitation word to accumulator.

STEP 3: Move the accumulator content to the output lines of 8255.

STEP 4: Call the delay function.

STEP 5: Rotate the accumulator left to excite the next pair of coils in clockwise direction.

STEP 6: Go to step 3.

DELAY:

STEP 1: Load the outer loop count to any register.

STEP 2: Load the first inner loop count.

149

Page 150: MP8085 Lab Manual

STEP 3: Load the second inner loop count.

STEP 4: Decrement the second inner loop count.

STEP 5: Check for zero. If zero is reached go to next step else go to step 4.

STEP 6: Decrement the first inner loop count.

STEP 7: Check for zero, if zero is reached go to next step else go to step 3.

STEP 8: Decrement the outer loop count.

STEP 9: Check for zero. If Zero is set go to next step else go to step 2.

STEP 10: Return to main program.

FLOW CHART:

CLOCKWISE ROTATION:

150

Page 151: MP8085 Lab Manual

ANTI-CLOCKWISE ROTATION:

151

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROL PORT

OF 8255

LOAD THE INITIAL EXCITATION WORD TO THE ACCUMULATOR

MOVE THE CONTENT OF ACCUMULATOR TO OUTPUT PORT OF 8255

ROTATE THE ACCUMULATOR RIGHT TO EXCITE NEXT PAIR OF COILS IN CLOCKWISE DIRECTION.

CALL THE FUNCTION DELAY

Page 152: MP8085 Lab Manual

DELAY:

152

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROL PORT

OF 8255

LOAD THE INITIAL EXCITATION WORD TO THE ACCUMULATOR

MOVE THE CONTENT OF ACCUMULATOR TO OUTPUT PORT ADDRESS OF 8255

ROTATE THE ACCUMULATOR LEFT TO EXCITE NEXT PAIR OF COILS IN ANTICLOCKWISE DIRECTION.

CALL THE FUNCTION DELAY

Page 153: MP8085 Lab Manual

PROGRAM:

153

LOAD THE OUTER LOOP COUNT TO ANY REGISTER

LOAD THE INNER LOOP 1 COUNT TO A REGISTER

LOAD THE INNER LOOP 2 COUNT TO A REGISTER

DECREMENT THE INNER LOOP 2 COUNT

CHECK

FOR ZERO

DECREMENT THE INNER LOOP 1 COUNT

CHECK

FOR ZERO

DECREMENT THE OUTER LOOP COUNT

CHECK FOR ZERO

RETURN

NO

YES

NO

YES

NO

YES

START

Page 154: MP8085 Lab Manual

CLOCKWISE ROTATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000 MVI A, 80 3E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3D3F3

Move the accumulator content to the control port.

8004 MVI A, 88 3E88

Move 88 immediately to the accumulator to activate A and A’ poles of the motor through 8255 selected port.

8006LOOP

OUT F0D3F0

Move the accumulator content to port A of 8255.

8008 CALL DELAYCD0090

CALL the delay program to generate time delay before the excitation of next pair of coils

800B RRC 0FRotate accumulator content right without carry to excite next pair of coils.

800C JMP LOOPC30686

Jump unconditionally to obtain continuous rotation.

ANTI-CLOCKWISE ROTATION

154

Page 155: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000 MVI A, 803E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3D3F3

Move the control word to the control port .

8004 MVI A, 88 3E88

Move 88 immediately to the accumulator to activate A and A’ poles of the motor through 8255 selected port.

8006LOOP

OUT F0D3F0

Move the accumulator content to port A of 8255.

8008 CALL DELAYCD0090

CALL the delay program to generate time delay before excitation of next pair of coils.

800B RLC 0FRotate accumulator content left without carry to excite next pair of coils.

800C JMP LOOPC30686

Jump unconditionally to obtain continues rotation.

DELAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000 MVI E, 0A1E0A

Move immediately the outer loop count 0A to the E register.

9002LOOP1

MVI C, FF0EFF

Move immediately the inner loop count FF to the C register.

9004LOOP

DCR C 0DDecrement the inner loop count i.e. C register content.

9005 JNZ LOOPC20490

Check for Zero flag, if it is not set goto Loop.

9008 DCR E 1DDecrement the outer loop count i.e. the E register content.

9009 JNZ LOOP1 C2 Check for Zero flag, if it is

155

Page 156: MP8085 Lab Manual

0990

not set goto LOOP1.

900C RET C9Return to the main function.

Exp.No:13ADC/DAC Interface

156

Page 157: MP8085 Lab Manual

Date:

Aim:

To interface a digital to analog converter (DAC) to 8085 microprocessor using programmable peripheral interface 8255 to create

Square Waveform. Trapezoidal Waveform. Saw tooth Waveform.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

SQUARE WAVEFORM:

STEP 1: Move the control word to the control port to operate 8255 in I/O to the accumulator.

STEP 2: Send the accumulator content to the port of 8255.

STEP 3: Load the binary value corresponding to the maximum digital input to the accumulator.

STEP 4: Send the accumulator content to the port of 8255.

STEP 5: Call the delay program to generate time delay between states.

STEP 6: Complement the accumulator content to change the output state.

STEP 7: Go to step 4.

SAW TOOTH WAVEFORM:

STEP 1: Load the control word to the control port of 8255 to operate in I/O mode.

STEP 2: Load ‘00’ and move to output lines of 8255.

STEP 3: Move the content of accumulator to output port of 8255.

STEP 4: Increment the digital input value, i.e., the accumulator content till it becomes FF.

STEP 5: Compare with FF. Check for zero, if yes go to step 2 else step 3.

TRAPEZOIDAL WAVEFORM:

157

Page 158: MP8085 Lab Manual

STEP 1: Load the control word to accumulator and move to control port of 8255.

STEP 2: Move the initial digital to the accumulator and out to output port of 8255.

STEP 3: Increment the digital input value and move to output line of 8255.

STEP 4: Compare the digital input with ‘FF’. Check for zero, if zero is set go to next step, else

go to step 3.

STEP 5: Call delay to generate a constant output of required width.

STEP 6: Decrement the digital input value.

STEP 7: Move the value to the output line of 8255.

STEP 8: Check for zero, if zero is set go to step 2, else go to step 6.

DELAY:

STEP 1: Load the outer loop count to any register.

STEP 2: Load the first inner loop count.

STEP 3: Load the second inner loop count.

STEP 4: Decrement the second inner loop count.

STEP 5: Check for zero. If zero is reached go to next step else go to step 4.

STEP 6: Decrement the first inner loop count.

STEP 7: Check for zero, if zero is reached go to next step else go to step 3.

STEP 8: Decrement the outer loop count.

STEP 9: Check for zero. If Zero is set go to next step else go to step 2.

STEP 10: Return to main program.

FLOW CHART:

158

Page 159: MP8085 Lab Manual

SQUARE WAVE GENERATION:

SAW TOOTH:

159

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROL PORT

OF 8255

LOAD THE BINARY VALUE CORRESPONDING TO THE MAXIMUM DIGITAL INPUT TO THE

ACCMULATOR

MOVE THE CONTENT OF ACCUMULATOR TO ANY OUTPUT PORT OF 8255

COMPLEMENT THE CONTENT OF ACCUMULATOR TH SWITCH BETWEEN HIGH AND LOW STATES OF

OUTPUT WAVEFORM

CALL THE FUNCTION DELAY

Page 160: MP8085 Lab Manual

160

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROL PORT

OF 8255

LOAD ‘00’ TO THE ACCUMULATOR TO RESET ALL THE LINES OF 8255-SELECTED PORT.

MOVE THE CONTENT OF ACCUMULATOR TO ANY OUTPUT PORT ADDRESS OF 8255

INCREMENT THE DIGITAL INPUT VALUE. i.e. THE ACCUMULATOR CONTENT TILL IT BECOMES 00

CHECK FOR ZERO

NO

YES

Page 161: MP8085 Lab Manual

Delay:

161

START

CALL DELAY TO GENERATE A CONSTANT OUTPUT OF REQUIRED WIDTH.

DECREMENT THE DIGITAL INPUT VALUE TO GENERATE DECRESING SLOPE.

MOVE THE DIGITAL INPUT VALUE i.e. CONTENT OF ACCUMULATOR TO ANY OUTPUT PORT ADDRESS OF

8255

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROL PORT OF 8255

MOVE THE INITIAL DIGITAL VALUE TO ACCUMULATOR AND OUT THE CONTENT OF

ACCUMULATOR TO OUTPUT PORT OF 8255

INCREMENT THE DIGITAL VALUE INPUT. i.e. THE ACCUMULATOR CONTENT.

MOVE THE CORRESPONDING DIGITAL VALUE IN THE ACCUMULATOR TO THE OUTPUT PORT OF 8255

CHECK FOR ZERO

COMPARE THE INPUT DIGITAL VALUE WITH LARGEST POSIBLE DIGITAL VALUE. i.e. ‘FF’

CHECK FOR ZERO

NO

YES

NOYES

TRAPEZOIDAL:

START

Page 162: MP8085 Lab Manual

PROGRAM:

162

LOAD THE OUTER LOOP COUNT TO ANY REGISTER

LOAD THE INNER LOOP COUNT

DECREMENT THE INNER LOOP COUNT

CHECK

FOR ZERO

DECREMENT THE OUTER LOOP COUNT

CHECK FOR ZERO

RETURN

NO

YES

NO

YES

Page 163: MP8085 Lab Manual

SQUARE WAVE GENERATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000MVI A, 80

3E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3D3F3

Move the control word to the control port of 8255.

8004 MVI A, FF3EFF

Move FF immediately to the accumulator to activate all the lines of selected port of 8255.

8006LOOP

OUT F0D3F0

Move the accumulator content to port A address of 8255.

8008 CALL DELAYCD0090

CALL the delay program to have the pulse of required width.

800B CMA 2FComplement the accumulator content to change the output state.

800C JMP LOOPC30680

Jump unconditionally to LOOP to obtain continuous square waveform.

10 ms DELAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000 MVI E, 0A1E0A

Move immediately the outer loop count 0A to the E register.

9002LOOP1

MVI C, FF0EFF

Move immediately the inner loop count FF to the C register.

9004 LOOP DCR C 0DDecrement the inner loop count i.e. C register content.

9005 JNZ LOOPC20490

Check for Zero flag, if it is not set goto Loop.

9008 DCR E 1DDecrement the outer loop count i.e. the E register content.

163

Page 164: MP8085 Lab Manual

9009 JNZ LOOP1C20990

Check for Zero flag, if it is not set goto LOOP1.

900C RET C9Return to the main function.

SAW TOOTH WAVEFORM GENERATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000 MVI A, 803E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3D3F3

Move the control word to the control port.

8004 LOOP1

MVI A, 003E00

Move 00 immediately to the accumulator to have low value at all the lines of 8255 selected port.

8006 LOOP OUT F0D3F0

Move the accumulator content to port A of 8255.

8008 INR A 3CIncrement the content of accumulator.

8009 JNZ LOOPC20680

Check for Zero flag, if is set goto LOOP otherwise goto next instruction.

800C JMP LOOP1C30480

Jump unconditionally to LOOP 1 to obtain continues waveform.

TRAPEZOIDAL WAVEFORM GENERATION

164

Page 165: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000 MVI A, 803E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3D3F3

Move the control word to the control port.

8004LOOP

MVI A, 003E00

Move 00 immediately to the accumulator to have low value at all the lines of 8255 selected port.

8006 OUT F0D3F0

Move the accumulator content to port A of 8255.

8008 LOOP 1 INR A 3CIncrement the content of accumulator to have the increasing slope.

8009 OUT F0D3F0

Move the accumulator content to port A of 8255.

800B CPI FFFEFF

Compare immediate the content of accumulator with the highest output voltage digital equivalent i.e. FF

800D JNZ LOOP 1C20880

Check for Zero flag, if is set goto LOOP 1, otherwise goto next instruction

8010 CALL DELAYCD0090

CALL the delay to have the required width of the waveform.

8013 LOOP 2

DCR A 3D

Decrement the accumulator content to have the decreasing slope of waveform

8014 OUT F0D3F0

Move the accumulator content to port A of 8255.

8016 JNZ LOOP 2C21380

Check for Zero flag, if is set goto LOOP 2.

8019 JMP LOOPC30480

Jump unconditionally to LOOP 1 to obtain continuous waveform.

165

Page 166: MP8085 Lab Manual

Exp.No:14Seven Segment Display

166

Page 167: MP8085 Lab Manual

Date:

Aim:

To interface a seven segment LED to display a MOD 9 counter using 8085 Microprocessor.

Apparatus Required:

1. 8085 Trainer

2. Operation Code sheet

ALGORITHM:

MAIN PROGRAM:

STEP 1: Load the control word to the accumulator and move it to control port of 8255.STEP 2: More the value of initial count to accumulator and send to output port of 8255.STEP 3: Call delay subroutine to have a time delay between counts.STEP 4: Increment the count value.STEP 5: Compare the count value with the terminal count.STEP 6: Check for zero, if zero is reached go to step 2, else go to step 4.

DELAY:

STEP 1: Load the outer loop count to any register.STEP 2: Load the first inner loop count.STEP 3: Load the second inner loop count.STEP 4: Decrement the second inner loop count.STEP 5: Check for zero. If zero is reached go to next step else go to step 4.STEP 6: Decrement the first inner loop count.STEP 7: Check for zero, if zero is reached go to next step else go to step 3.STEP 8: Decrement the outer loop count.STEP 9: Check for zero. If Zero is set go to next step else go to step 2.STEP 10: Return to main program.

167

Page 168: MP8085 Lab Manual

PROGRAM:

168LOAD THE OUTER LOOP COUNT TO ANY REGISTER

LOAD THE INNER LOOP 1 COUNT TO A REGISTER

START

START

LOAD THE CONTROL WORD TO THE ACCUMULATOR AND MOVE IT TO CONTROLPORT

OF 8255

MOVE THE INITIAL COUNT TO ACCUMULATOR

MOVE THE CONTENT OF ACCUMULATOR TO OUTPUTPORT OF 8255

INCREMENT THE COUNT

CHECK FOR ZERO

NOYES

CALL DELAY TO HAVE TIME DELAY BETWEEN COUNTS.

COMPARE THE COUNT VALUE WITH THE TERMINAL COUNT.

FLOW CHART:

Page 169: MP8085 Lab Manual

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

8000 MVI A, 803E80

Move the control word immediately to the accumulator to indicate 8255 is in I/O mode.

8002 OUT F3D3F3

Move the control word to the control port.

8004 LOOP 1

MVI A, 003E00

Clear the accumulator to start count from initial value.

8006LOOP

OUT F0D3F0

Move the accumulator content to port A of 8255.

8008 CALL DELAYCD0090

CALL the DELAY program to have a time delay between each display.

800B ADI 01C601

Increment the count

800D DAA 27Decimal adjust the accumulator to have packed BCD output

800E CPI 0AFE0A

Compare with the terminal count.

8010 JNZ LOOPC20680

Check for zero flag, if it is not set display the corresponding BCD number.

8013 JMP LOOP1C30480

Jump unconditionally to LOOP 1 to initialize the count again.

169

Page 170: MP8085 Lab Manual

1 SECOND DELAY:

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

9000 MVI E, 0A1E0A

Move immediately the outer loop count 0A to the E register.

9002LOOP1

MVI C, FF 0EFF

Move immediately the inner loop count FF to the C register.

9004 LOOP DCR C 0DDecrement the inner loop count i.e. C register content.

9005 JNZ LOOPC20490

Check for Zero flag, if it is not set goto Loop. Otherwise goto next step.

9008 DCR E 1DDecrement the outer loop count i.e. the E register content.

9009 JNZ LOOP1C20990

Check for Zero flag, if it is not set goto LOOP1. Otherwise goto next step.

900C RET C9Return to the main function.

170

Page 171: MP8085 Lab Manual

RESULT:

Thus the program was executed and the seven segment LED interfaced successfully to display counter.

171

Page 172: MP8085 Lab Manual

172