0% found this document useful (0 votes)
21 views

Microprosser Lab Manual Final (1)

Uploaded by

bad576034
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views

Microprosser Lab Manual Final (1)

Uploaded by

bad576034
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

MICROPROSSER &

MICROCONTROLLER
LAB MANUAL

ASANSOL ENGINEERING COLLEGE

ELECTRICAL ENGINEERING DEPARTMENT


INTRODUCTION:

A program is a sequence of instructions, which operate on with operands or data. The program may be
written in any one of available languages to achieve the objective of the user. When a programmer writes a
program for a particular problem, the following five steps are followed:
Step 1 Define the problem Before starting, it is required to understand the problem completely and
assume all initial conditions.
Step 2 Plan the solution Break the problem into a modular form and determine how the modules are
logically linked.

Step 3 Code the program Translate the logical solution of each module in an assembly or any
programming language which the microcomputer can understand.
Step 4 Test the program After writing the program, implement/test the program in a microcomputer system.

Step 5 Documentation All related matters must be documented, as we do not always remember the most
important steps that we took during development of the program.

The development of the program depends on the skill of the programmer as well as the complexity of
the problem. Generally, the program is fed into the microcomputer through input devices such as the
keyboard and is stored in the memory of the microcomputer. The 2025 microprocessor is able to understand
instructions, which are written in 0s and 1s. When the program is written using 0s and 1s, the program is
known as machine language program. But it is very difficult for a programmer to write a program in
machine language. The other way of writing a program is using mnemonic operation codes in hexadecimal,
octal or binary notations, which are known as assembly language. In assembly language, when a program is
executed, instructions are converted or translated into machine code. The translator which translates/converts
an assembly language program into a machine language is known as an assembler.

MACHINE LANGUAGE:

Programmers write instructions in various programming languages. Some programs are directly
understandable by the computer and other programs require intermediate translation steps. Nowadays
hundreds of computer languages are available to use in solving different problems. These programming
languages are classified into three general types as given below:

 Machine Languages
 Assembly Languages
 High-Level Languages

Machine language is the ‘natural language’ of computers. Machine-language programs are usually
written in binary code. Therefore, 0s and 1s are used in a machine-language program. Machine languages
are machine dependent, that is, a particular machine language can be used on only one type of computer. In
this language, a specific binary code is used for each instruction. For example, to copy data from register A to
B, the binary code 0100 0111 is used. Similarly, different binary codes are available in the 2025
microprocessor for different operations such as addition, subtraction, increment, decrement, rotate, and
compare. But it is very difficult to write machine level programs. The program can be simplified by
converting binary code to hexadecimal.

The Machine language has the following advantages:


1. This is suitable for small and simple programs.
2. This program execution is very fast and requires less computation time.
3. Generally, this language is suitable for prototype applications in the final product.
The disadvantages of machine-language programs are the following:
1. A program written in machine code is a set of binary numbers. Therefore, program writing is difficult
and time consumable.
2. It is also very difficult to understand the program, which is written in machine language or
hexadecimal form.
3. Since the program is always written in 0s and 1s, each bit has to be entered individually. Time taken
for data entry becomes very slow and tiresome.
4. There is always some possibility of errors in writing programs. Even a single bit error in any
instruction can generate unsatisfactory results.
5. Programs are long.

ASSEMBLY LANGUAGE:

To overcome the limitations of machine languages, assembly languages were developed. In such a
language, machine-level instructions are replaced by mnemonics. For example, ADD represents addition;
SUB represents subtraction, INC for increment, RAL for rotate left, and CMP for compare. These
instructions are known as mnemonics. A program written in mnemonics is called an assembly-language
program. It is easier for a programmer to write programs in assembly language compared to machine
language. It is also easier to understand an assembly language program. This program is microprocessor
specific.
The assembly language programs are translated to machine-level programs using a translator
program known as assembler as shown in Fig. 1.

Fig: 1 Assembler

The assembly language has the following advantages:


1. It is easy to write.
2. It is easy to understand.
3. Assembly-language programs produce faster results.
4. This is suitable for real-time control and industrial applications.
5. It requires less computations time.
The disadvantages of assembly language compared to high-level languages are given below:
1. The assembly language is microprocessor specific. The detailed knowledge of the particular
microprocessor is required to write a program. The programmer should know about registers and
instructions of the microprocessor.
2. An assembly-language program is not portable, as the program written for one microprocessor may
not be used in other processors.
3. Assembly-language program writing is difficult and time consuming compared to high-level
languages.
HIGH-LEVEL LANGUAGE:

The demerits of assembly languages are overcome by using high-level languages. The high-level
languages can improve the readability by using English words, which would make them easier to understand
and sort out any faults in the program. In addition, the high-level languages relieve the programmer of any
need to understand the internal architecture of the microprocessor. Ideally, the programmer should not
even need to know what processor is being used. For programs written in high-level languages, any type of
computer can be used easily. Therefore, the program should be totally portable. The programs written in
high-level languages are very easy and fast but a compiler is required to translate the high-level language into
machine codes, as the microprocessor can understand only the machine codes 1 or 0.
Fig: 2 Compilers
Translator translates a high-level programming language to the binary steps and makes the
program understandable for the computer. There are two general types of translators, namely, compiler and
interpreter. The compiler translates an entire program at one time and then executes it. The interpreter also
translates a program line at a time while executing. The difference between compiler and interpreter is given
below:

Compiler Interpreter

Compiled programs execute much faster. Interpreted programs are slower because
translation takes time.

Compilation is usually a multi-step process. Interpretation translates in one step.


Compilers do not require space in memory when Interpreters must be in memory while a program is
programs run. running.
It is costlier than an interpreter, and suitable for a It is cheaper, and suitable for a smaller system.
larger system.

Instructions written in high-level languages are called statements High-Level languages allow
programme to write instructions that look almost like everyday English language and contain commonly
used mathematical notations.
High-level languages are much more desirable from the programmer’s point of view. Translator
programs called compilers convert high-level language programs into machine language. FORTRAN, COBOL,
BASIC, PASCAL, ALGOL, PL/M, C/C++ and Java are among the most powerful and most widely used high-
level languages. The features of these high-level languages are discussed in this section.

Advantages of High-Level Language:


High-level languages have the following advantages:
1. In high-level languages, the programs are written using instructions and each instruction is very clear
for a specified operation.
2. Writing programs in high-level languages is very easy and fast. These languages are suitable for large
programs and for developing large projects.
3. Programs are portable in high-level languages and can be executed in any standard.
4. Complex mathematical computation is possible in these languages.
5. Report writing and documentation are simple in high-level languages.
6. The program is independent of the internal architecture of the microprocessor structure. The pro-
grams are problem oriented and can run in any standard computer.
Disadvantages of High-Level Languages:
High-level languages have the following disadvantages:
1. Each high-level language has a standard syntax and specified rules to write programs.
2. Each statement of a high-level language is equivalent to many instructions in machine language.
Therefore, the execution time of programs written in high-level languages is more and to reproduce
results, it also takes more time. So the high-level language speed is slow compared to assembly
language.
3. Hardware & software support s are required.
4. Large volume of data is to be processed in high-level language and programs in high-level language
require large memory so that memory utilization is less.
5. To translate a high-level language program into a machine language program, a compiler is required.
Sometimes, compilers are very costly.

INSTRUCTION FORMAT:

Each statement in an assembly-language program consists of the following fields: memory address,
machine codes, labels, mnemonics, operands and comments. The commonly used format of an instruction in
assembly language is given below:
Memory Machine Labels Mnemonics Operands Comments
address Codes

Memory Address This is the address of the memory location in which a program or a series of instructions are
stored.
Machine Codes Every instruction has a unique one-byte code called operation code. Instructions are
operated using data. Data may be of one byte or two bytes. Machine codes are the hexadecimal representation
of operation codes.

Labels It is assigned for the instruction in which it appears. The presence of a label in an instruction is
optional. When a label is present, it provides a symbolic name that can be used in branch instructions of the
instruction. If there is no label, then the colon must not be entered. A label may be of any length, from 1 to
35 characters. This appears in a program to identify the name of a memory location for storing data and other
purposes. This is used for conditional/unconditional jumping.
Mnemonics Each instruction has a specific mnemonic. The mnemonic states the operation which will be
executed.
Operands depend on the type of instruction. In a one-byte instruction, there is no operand. Only one operand
exists in two-byte instructions and a three-byte instruction has two operands which are separated by a comma.
Comments In this field, the general comments about the instructions are always incorporated to understand the
program easily. It is optional. The comment field contains any combination of characters. A comment may
appear on a line and the first character of the line must be a semicolon.

Steps to Insert and execute a program in M85-07 Trainer kit


Steps:-

 Power on the trainer.


 A message display on the display “-8085 LCD TRAINER KIT M85-0X.
 Now first press “Reset Key” button.
 Now press “1” key for menu “A =.ASSEMBLE MODE C= DISASSEMBLE MODE “.
 Now enter “A “starting add. Of the program. Then “ENTER “for example LXI H, 2009. (After resistor
press “SPACE” bar) then “ENTER” and the memory location automatically increment.
 Now just enter next data of program and continue the process till the last byte of program.
 Press entering input of program press “M” key from keyboard and input data add. Memory then
“enter” key. “GO” from keyboard then starting add. Of the program is 2000 then dot. > Key.
 To now to execute program p examine result observe the memory locations where data is
manipulated. Press “M address out data location and press “enter” data is displayed.
 If you want to write the program through Opcode just enter “M” then starting address of program
and after that press “ENTER” key from keyboard up to end address of the programmed and also give
the input data add of the program.
 A Press “GO” from keyboard then starting add of the program is 2000 then dot > key.
 To now to execute program examine result observe the memory locations where data is manipulated.
Press “M” address out data location and press “enter” data is displayed.
EXPERIMENT NO. : 01

ASSEMBLY LEVEL LANGUAGE PROGRAMS:

Simple Examples of Assembly-Language Programs:-


 Transfer data from accumulator to B register.
Mnemonics Opcode Comments
MOV B A 47 Copy the content of accumulator to B
register

 Load FFH in c register.


Mnemonics Opcode Comments
MVI C FFH 0E,FF Load FFH in C register immediately

 Load 22H & 67H in register B and C respectively.


Mnemonics Opcode Comments
Load register C with 67H & register B with
LXI B 22 67 01,67,22 22H

 Load H-L register pair by the data 2150H.


Mnemonics Opcode Comments
Load H-L register pair with 2150H
LXI H,2150H 21,50,21
 Load the content of memory location in the accumulator.
Mnemonics Opcode Comments
Load memory location address 2100 in H-L
LXI H,2100H 21,00,21 register pair

Copy content of memory location in


MOV A,M 7E
accumulator
 Store the content of the accumulator in 2001H location.
Mnemonics Opcode Comments
content of the accumulator store in 2001H
STA 2001H 32,01,20
location
 Transfer data store in memory location 9950h to the accumulator.
Mnemonics Opcode Comments
Move data to accumulator from
LDA 9950H 3A,50,99
memory location 9950H
 Load 45h data store in memory location 2500h and increment the content of memory location
Mnemonics Opcode Comments
Load memory location address 2500H in H-L
LXI H,2500 21,00,25
register pair
MVI M,45H 36,45 45H store in 2500H location

INR M 34 Content of memory location incremented by


one
EXPERIMENT NO. : 02

ADDITION OF TWO 8 BITS NUMBERS; SUM 8 BITS

The 1st number 49H is in memory location 2501H.

The 2nd number 56H is in memory location 2502H.

The result is to be stored in memory location 2503H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Get address of the 1st no. In H-L pair
2003 7E MOV A,M 1st no. In accumulator
2004 23 INX H Increment content of H-L pair
2005 86 ADD M Add 1st and 2nd no.
2006 32 03 25 STA 2503H Store sum in 2503H
2009 EF RST 5 Stop

DATA:

2501H-49H

2502H-56H

RESULT:

2503H-9FH

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Write the addressing modes of the following instructions: (a) MOV A, M (b) STA 2503H

2. Calculate the machine cycles & T-states, when the instruction INX H is executed

3. After executing of ADD M instruction for the above example, what will be the status of carry
flag?

4. Specify the Opcode & operand in the instruction LXI H, 2501H


EXPERIMENT NO. : 03

SUBTRACTION OF TWO 8 BITS NUMBERS

The 1st number 49H is in memory location 2501H.

The 2nd number 32H is in memory location 2502H.

The result is to be stored in memory location 2503H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Get address of the 1st no. In H-L
pair
2003 7E MOV A,M 1st no. In accumulator
2004 23 INX H Content of H-L pair increases from
2501H to 2502H
2005 96 SUB M Subtraction between 1st and 2nd
no.
2006 23 INX H Content of H-L pair becomes
2503H
2007 77 MOV M,A Store result in 2503H
2008 EF RST 5 Stop

DATA:

2501H-49H

2502H-32H

RESULT:

2503H-17H

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Write the addressing modes of the following instructions: (a) INX H (b) LXI H, 2501H

2. Calculate the machine cycles & T-states, when the instruction SUB M is executed.

3. What is the word length of the instruction LXI H, 2501H.

4. Define instruction cycle, machine cycles & T-states.


EXPERIMENT NO. : 04

ADDITION OF TWO 8 BITS NUMBERS; SUM 16 BITS

The 1st number 98H is in memory location 2501H.

The 2nd number 9AH is in memory location 2502H.

The result is to be stored in memory location 2503H and 2504H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Get address of the 1st no. In H-L
pair
2003 0E 00 MVI C,00 MSBs of sum in register c. value 00
2005 7E MOV A,M 1st no. In accumulator
2006 23 INX H Address of 2nd no. 2502H in H-L pair
2007 86 ADD M Sum of 1st and 2nd no.
2008 D2 0C 20 JNC LOOP Is carry? Go to label loop
200B 0C INR C Yes, increment C
200C 32 03 25 LOOP STA 2503H LSBs of sum in 2503H
200F 79 MOV A,C MSBs of sum in Accumulator
2010 32 04 25 STA 2504H MSBs of sum in 2504H
EF RST 5 Stop

DATA:

2501H-98H

2502H-9AH

RESULT:

2503H-32H, LSBs of sum

2504H-01H, MSBs of sum

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Write the addressing modes of the following instructions: (a) MOV A, C (b) MVI C, 00 H.

2. Calculate the machine cycles & T-states, when the instruction STA 2503H is executed.

3. After executing of ADD M instruction for the above example, what will be the status of carry
flag?

4. Define the instruction JNC LOOP.


EXPERIMENT NO. : 05

DECIMAL ADDITION OF TWO 8 BITS NUMBERS; SUM 16 BITS

The 1st number 84D is in memory location 2501H.

The 2nd number 75D is in memory location 2502H.

The result is to be stored in memory location 2503H and 2504H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Get address of the 1st no. In H-L
pair
2003 0E 00 MVI C,00 MSDs of sum in register c. value 00
2005 7E MOV A,M 1st no. In accumulator
2006 23 INX H Address of 2nd no. 2502H in H-L pair
2007 86 ADD M Sum of 1st and 2nd no.
2008 27 DAA Decimal adjust
2009 D2 0D 20 JNC LOOP Is carry? Go to label loop
200C 0C INR C Yes, increment C
200D 32 03 25 LOOP STA 2503H LSDs of sum in 2503H
2010 79 MOV A,C MSDs of sum in Accumulator
2011 32 04 25 STA 2504H MSDs of sum in 2504H
2014 EF RST 5 Stop

DATA:

2501H-84D

2502H-75D

RESULT:

2503H-59D, LSDs of sum

2504H-01D, MSDs of sum

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction DAA.

2. Calculate the machine cycles & T-states, when the instruction DAA is executed.

3. For the above example, after executing the program what will be the content of C register?

4. Distinguish between JMP and JNC instructions.


EXPERIMENT NO. : 06

ADDITION OF TWO 16 BITS NUMBERS; SUM 16 BITS OR MORE

The 1st number A645H is in memory location 2501H and 2502H.

The 2nd number 9b23H is in memory location 2503H and 2504H.

The result is to be stored in memory location 2505H to 2507H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 2A 01 25 LHLD 2501H 1st 16 bits no. In H-L pair
2003 EB XCHG 1st no. In D-E pair
nd
2004 2A 03 25 LHLD 2503H 2 16 bits no. In H-L pair
2007 0E 00 MVI C,00 MSBs of sum in register c. value 00
2009 19 DAD D Sum of 1st and 2nd no.
200A D2 0E 20 JNC LOOP Is carry? Go to label loop
200D 0C INR C Yes, increment C
200E 22 05 25 LOOP SHLD 2505H Store LSBs of sum in 2505H and
2506H
2011 79 MOV A,C MSBs of sum in accumulator
2012 32 07 25 STA 2507 Store MSBs of sum in 2507H
2015 EF RST 5 Stop

DATA:

2501H-45H, LSBs of 1st no.

2502H-A6H, MSBs of 1st no.

2503H-23H, LSBs of 2nd no.

2504H-9BH, MSBs of 2nd no.

RESULT:

2505H-68H, LSBs of sum

2506H-41H, LSBs of sum

2507H-01H, MSBs of sum

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction XCHG.

2. Calculate the machine cycles & T-states, when the instruction LHLD 2501H is executed.

3. Distinguish between DAD and DAA instructions.

4. Distinguish between LHLD and SHLD instructions.


EXPERIMENT NO. : 07

FIND ONE’S COMPLEMENT OF AN 8 BIT NUMBER

The number 96H is placed in memory location 2501H.

The result is to be stored in memory location 2502H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 01 25 LDA 2501H Gets data in accumulator
2003 2F CMA Takes its complement
2004 32 02 25 STA 2502H Store result in 2502H
2007 EF RST 5 Stop
DATA:

2501H-96H

RESULT:

2502H-69H

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction CMA.

2. Write the addressing modes of the following instructions: (a) CMA (b) LDA 2501

3. Distinguish between LDA and STA instructions.

4. Calculate total T-states of the above program.


EXPERIMENT NO. : 08

FIND TWO’S COMPLEMENT OF AN 8 BIT NUMBER

The number E4H is placed in memory location 2501H.

The result is to be stored in memory location 2502H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 01 25 LDA 2501H Gets data in accumulator
2003 2F CMA Takes its complement
2004 3C INR A Takes 2’s complement
2005 32 02 25 STA 2502H Store result in 2502H
2007 EF RST 5 Stop
DATA:

2501H-E4H

RESULT:

2502H-1CH

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. What is the word length of the instruction LDA 2501 H.

2. Calculate the machine cycles & T-states, when the instruction CMA is executed.

3. Calculate total T-states of the above program.

4. Specify the Opcode & operand in the instruction STA 2502H.


EXPERIMENT NO. : 09

FIND ONE’S COMPLEMENT OF A 16 BIT NUMBER

The number 5485H is placed in memory location 2501H and 2502H.

The result is to be stored in memory location 2503H and 2504H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Address of LSBs of no.
2003 7E MOV A,M 8 LSBs of the no. In accumulator
2004 2F CMA Complement of 8 LSBs of the no.
2005 32 03 25 STA 2503H Store 8 LSBs of result
2008 23 INX H Address of 8 MSBs of no.
2009 7E MOV A,M 8 MSBs of the no. In accumulator
200A 2F CMA Complement of 8 MSBs of the no.
200B 32 04 25 STA 2504H Store 8 MSBs of result
200E EF RST 5 Stop
DATA:

2501H-85H, LSBs of the number

2502H-54H, MSBs of the number

RESULT:

2503H-7AH, LSBs of the result

2504H-ABH, MSBs of the result

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Calculate the machine cycles & T-states, when the instruction CMA is executed.

2. Write the addressing modes of the following instructions: (a) LXI H, 2501H (b) STA 2504

3. Define instruction cycle, machine cycles & T-states.

4. Define the instruction RST 5.


EXPERIMENT NO. : 10

FIND TWO’S COMPLEMENT OF A 16 BIT NUMBER

The number 5B8CH is placed in memory location 2501H and 2502H.

The result is to be stored in memory location 2503H and 2504H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Address of 8 LSBs of no.
2003 06 00 MVI B,00 Use register B to store carry
2005 7E MOV A,M 8 LSBs In accumulator
2006 2F CMA Complement of 8 LSBs of the no.
2007 C6 01 ADI 01 Takes 2’s complement of 8 LSBs of
the no.
2009 32 03 25 STA 2503H Store 8 LSBs of result
200C D2 10 20 JNC LOOP Is carry? Go to label loop
200F 04 INR B Store carry
2010 23 LOOP INX H Address of 8 MSBs of no.
2011 7E MOV A,M 8 MSBs In accumulator
2012 2F CMA Takes 1’s complement of 8 MSBs of
the no.
2013 80 ADD B Add carry
2014 32 04 25 STA 2504H Store 8F MSBs of result
2017 EF RST 5 Stop

DATA:

2501H-8CH, LSBs of the number

2502H-5BH, MSBs of the number

RESULT:

2503H-74H, LSBs of the result

2504H-A4H, MSBs of the result

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction ADI 01H.

2. 8085 microprocessor provides how many flags?

3. Distinguish between INR and INX instructions.

4. Distinguish between ADD and ADI instructions.


EXPERIMENT NO. : 11

SHIFT AN 8 BIT NUMBER LEFT BY ONE BIT

The number 65H is placed in memory location 2501H.

The result is to be stored in memory location 2502H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 01 25 LDA 2501H Gets data in accumulator
2003 87 ADD A Shift it left by one bit
2004 32 02 25 STA 2502H Store result in 2502H
2007 EF RST 5 Stop

DATA:

2501H-65H

RESULT:

2502H-CAH

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. What is the word length of the instruction STA 2502H

2. Specify the Opcode & operand in the instruction STA 2502H.

3. Calculate the machine cycles & T-states, when the instruction STA 2502H is executed.

4. Draw the timing diagram of the instruction STA 2502H.


EXPERIMENT NO. : 12

SHIFT AN 8 BIT NUMBER LEFT BY TWO BITS

The number 15H is placed in memory location 2501H.

The result is to be stored in memory location 2502H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 01 25 LDA 2501H Gets data in accumulator
2003 87 ADD A Shift it left by one bit
2004 87 ADD A Again shift it left by one bit
2005 32 02 25 STA 2502H Store result in 2502H
2008 EF RST 5 Stop

DATA:

2501H-15H

RESULT:

2502H-54H

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define instruction cycle, machine cycles & T-states.

2. Calculate the machine cycles & T-states, when the instruction ADD A is executed.

3. How shifting is taking place by the instruction ADD A, explain.

4. Draw the timing diagram of the instruction ADD A.


EXPERIMENT NO. : 13

SHIFT A 16 BIT NUMBER BY ONE BIT

The number 7596H is placed in memory location 2501H AND 2502H.

The result is to be stored in memory location 2503H AND 2504H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 2A 01 25 LHLD 2501H Gets data in H-L pair
2003 29 DAD H Shift left by one bit
2004 22 03 25 SHLD 2503H Store result in 2503H and 2504H
2007 EF RST 5 Stop

DATA:

2501H-96H, LSBs of the number

2502H-75H, MSBs of the number

RESULT:

2503H-2CH, LSBs of the result

2504H-EBH, MSBs of the result

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction DAD H.

2. 8085 microprocessor provides how many pins?

3. Distinguish between ADD and DAD instructions.

4. Distinguish between LHLD and SHLD instructions.


EXPERIMENT NO. : 14

SHIFT A 16 BIT NUMBER LEFT BY TWO BITS

The number 1596H is placed in memory location 2501H AND 2502H.

The result is to be stored in memory location 2503H AND 2504H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 2A 01 25 LHLD 2501H Gets data in H-L pair
2003 29 DAD H Shift left by one bit
2004 29 DAD H Again shift left by one bit
2004 22 03 25 SHLD 2503H Store result in 2503H and 2504H
2007 EF RST 5 Stop

DATA:

2501H-96H, LSBs of the number

2502H-15H, MSBs of the number

RESULT:

2503H-58H, LSBs of the result

2504H-56H, MSBs of the result

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Write the addressing modes of the following instructions: (a) LHLD 2501H (b) DAD H

2. Calculate the machine cycles & T-states, when the instruction SHLD 2503H is executed.

3. What is the word length of the instruction DAD H

4. 8085 microprocessor provides how many address lines?


EXPERIMENT NO. : 15

MASK OF LEAST SIGNIFICANT 4 BITS OF AN 8 BIT NUMBER

The number A6H is placed in memory location 2501H.

The result is to be stored in memory location 2502H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 01 25 LDA 2501H Gets data in accumulator
2003 E6 F0 ANI F0 Mask of the least significant 4 bits
2005 32 02 25 STA 2502H Store result in 2502H
2008 EF RST 5 Stop

DATA:

2501H-A6H

RESULT:

2502H-A0H

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction ANI F0.

2. 8085 microprocessor provides how many data lines?

3. Distinguish between LDA and STA instructions.

4. Draw the timing diagram of the instruction STA 2502.


EXPERIMENT NO. : 16

MASK OF MOST SIGNIFICANT 4 BITS OF AN 8 BIT NUMBER

The number A6H is placed in memory location 2501H.

The result is to be stored in memory location 2502H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 01 25 LDA 2501H Gets data in accumulator
2003 E6 F0 ANI 0F Mask of the most significant 4 bits
2005 32 02 25 STA 2502H Store result in 2502H
2008 EF RST 5 Stop

DATA:

2501H-A6H

RESULT:

2502H-06H

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. How masking takes place, explain with example.

2. How many 8255 PPI are available in the trainer kit?

3. Write the addressing modes of the following instructions: (a) STA 2502H (b) ANI 0F

4. Draw the timing diagram of the instruction LDA 2501H.


EXPERIMENT NO. : 17

TO FIND LERGER OF TWO NUMBERS

The 1st number 98H is in memory location 2501H.

The 2nd number 87H is in memory location 2502H.

The result is to be stored in memory location 2503H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Get address of the 1st no. In H-L pair
2003 7E MOV A,M 1st no. In accumulator
2004 23 INX H Address of 2nd no. in H-L pair
2005 BE CMP M Compare 2nd no. with 1st no.
2006 D2 0A 20 JNC LOOP No, larger no. is in accumulator else go
to loop
2009 7E MOV A,M Yes get 2nd no. in accumulator
200A 32 03 25 LOOP STA 2503H Store larger no. in 2503H
200D EF RST 5 Stop

DATA:

2501H-98H

2502H-87H

RESULT:

2503H-98H (Larger Number)

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Define the instruction CMP M.

2. Write the addressing modes of the following instructions: (a) CMP M (b) LXI H, 2501H

3. Distinguish between CMP and CMA instructions.


EXPERIMENT NO. : 18

TO FIND SMALLER OF TWO NUMBERS

The 1st number 84H is in memory location 2501H.

The 2nd number 99H is in memory location 2502H.

The result is to be stored in memory location 2503H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 21 01 25 LXI H,2501H Get address of the 1st no. In H-L pair
2003 7E MOV A,M 1st no. In accumulator
2004 23 INX H Address of 2nd no. in H-L pair
2005 BE CMP M Compare 2nd no. with 1st no.
2006 D2 0A 20 JC LOOP Yes, smaller no. is in accumulator else go
to loop
2009 7E MOV A,M No get 2nd no. in accumulator
200A 32 03 25 LOOP STA 2503H Store larger no. in 2503H
200D EF RST 5 Stop

DATA:

2501H-84H

2502H-99H

RESULT:

2503H-84H (Smaller Number)

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Distinguish between JNC and JC instructions.

2. Specify the Opcode & operand in the instruction STA 2503H.

3. Distinguish between JMP and JNC instructions.

4. What will be the content of accumulator after executing the instruction STA 2503 H.
EXPERIMENT NO. : 19

TO FIND SQUARE FROM LOOK-UP TABLE

Find square of 07(decimal) using look-up table.

The number 07D is in memory location 2500H.

The result is to be stored in memory location 2501H.

The table for square is store from 2600H to 2609H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2000 3A 00 25 LDA 2500H Get data In accumulator
2003 6F MOV L,A Get data In register L
2004 26 26 MVI H,26H Get 26 In register H
2006 7E MOV A,M Square of data in accumulator
2007 32 01 25 STA 2501H Store square in 2501H
200A EF RST 5 Stop
DATA:

2500H-07D

RESULT:

2501H-49D

LOOK-UP TABLE:

ADDRESS SQUARE

2600 00

2601 01

2602 04

2603 09

2604 16

2605 25

2606 36

2607 49

2608 64

2609 81

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Write the addressing modes of the following instructions: (a) MOV L, A (b) MVI H, 26H.

2. Calculate the machine cycles & T-states, when the instruction MVI H, 26H is executed.

3. Distinguish between MOV and MVI instructions.


EXPERIMENT NO. : 20

SUM OF A SERIES OF 8 BIT NUMBERS; SUM 8 BITS

Add 16, 2B, 39 and 12H.

The numbers are placed in the memory location 2501H to 2504H.

The result is to be stored in memory location 2450H.

As there are 4 no. in the series, count=04.

The initial value of the sum is made 00.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2400 21 00 25 LXI H,2500H Address for the count in H-L pair
2403 4E MOV C,M The count in register C
2404 3E 00 MVI A,00H Initial value of sum=00
2406 23 LOOP INX H Address of next data in H-L pair
2407 86 ADD M Previous sum+next no.
2408 0D DCR C Decrement count
2409 C2 06 24 JNZ LOOP Is count=0? No, Jump to LOOP
240C 32 50 24 STA 2450H Store sum in 2450H
240F EF RST 5 Stop

DATA:

2500H-04

2501H-16

2502H-2B

2503H-39

2504H-12

RESULT:

2450H-8C

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. What is the word length of the instruction LXI H, 2500 H.

2. Specify the Opcode & operand in the instruction MVI A, 00H.

3. Distinguish between DCR and DCX instructions.

4. Distinguish between ADD and ADI instructions.


EXPERIMENT NO. : 21

SUM OF A SERIES OF 8 BIT NUMBERS; SUM IS 16 BIT

Add 45, 98, 8A and E2H.

The numbers are placed in the memory location 2501H to 2504H and the count in 2500H.

The result is to be stored in memory location 2450H and 2451H.

As there are 4 no. in the series, count=04.

The initial value of the sum is made 00.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2400 21 00 25 LXI H,2500H Address for the count in H-L pair
2403 4E MOV C,M The count in register C
2404 3E 00 MVI A,00H LSBs of sum=00 (initial value)
2406 47 MOV B,A MSBs of sum=00 (initial value)
2407 23 LOOP INX H Address of next data in H-L pair
2408 86 ADD M Previous sum+next no.
2409 D2 0D 24 JNC AHEAD Is carry? No, Jump to AHEAD
240C 04 INR B Yes, add carry to MSBs of sum
240D 0D AHEAD DCR C Decrement count
240E C2 07 24 JNZ LOOP Is count=0? No, Jump to LOOP
2411 32 50 24 STA 2450H Store LSBs of the sum in 2450H
2414 78 MOV A,B Gets MSBs of sum in accumulator
2415 32 51 24 STA 2451H Store MSBs of the sum in 2451H
2418 EF RST 5 Stop

DATA:

2500H-04H

2501H-45H

2502H-98H

2503H-8AH

2504H-E2H

RESULT:

2450H-49H, LSBs of sum

2451H-02H, MSBs of sum

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Calculate the machine cycles & T-states, when the instruction INR B is executed.

2. What is the difference between RAM & ROM?

3. Distinguish between JNC and JNZ instructions.

4. What is the memory addressing capacity of 8085 microprocessor, explain.


EXPERIMENT NO. : 22

SUM OF A SERIES OF 8 BIT DECIMAL NUMBERS; SUM IS 16 BIT

Add 65, 46, 35 and 98D.

The numbers are placed in the memory location 2501H to 2504H.

The result is to be stored in memory location 2450H and 2451H.

As there are 4 no. in the series, count=04.

The initial value of the sum is made 00.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2400 21 00 25 LXI H,2500H Address for the count in H-L pair
2403 4E MOV C,M The count in register C
2404 3E 00 MVI A,00H LSBs of sum=00 (initial value)
2406 47 MOV B,A MSBs of sum=00 (initial value)
2407 23 LOOP INX H Address of next data in H-L pair
2408 86 ADD M Sum =sum+data
2409 27 DAA Decimal adjust
240A D2 0E 24 JNC AHEAD Is carry? No, Jump to AHEAD
240D 04 INR B Yes, add carry to MSBs of sum
240E 0D AHEAD DCR C Decrement count
240F C2 07 24 JNZ LOOP Is count=0? No, Jump to LOOP
2412 32 50 24 STA 2450H Store LSBs of the sum in 2450H
2415 78 MOV A,B Gets MSBs of sum in accumulator
2416 32 51 24 STA 2451H Store MSBs of the sum in 2451H
2419 EF RST 5 Stop
DATA:

2500H-04H

2501H-65D

2502H-46D

2503H-35D

2504H-98D

RESULT:

2450H-44D, LSBs of sum

2451H-02D, MSBs of sum

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Distinguish between DAD and DAA instructions.

2. What is the difference between EPROM & EEPROM?

3. Write the addressing modes of the following instructions: (a) DAA (b) ADD M

4. Define instruction cycle, machine cycles & T-states.


EXPERIMENT NO. : 23

DETECT EVEN AND ODD NUMBER

Assume data is stored in memory location 2000H.

When data is even, 00H will be stored in 2001H.

When data is odd, 01H will be stored in 2002H.

Assume the programme is written from memory location 2500H.

PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


2500 20 00 20 LXI H,2000 Initialise the memory location of
number 2000H in HL register pair.
2503 36, NUMBER MVI M,NUMBER Store number in memory.
2505 7E MOV A,M Transfer data from memory into
accumulator.
2506 E6 01 ANI 01H AND 01H with accumulator
2502 OF RRC Rotate accumulator right once so
that LSB moves to carry bit.
2509 DA 11 25 JC LOOP If carry flag is set, number is
odd and is store in location 2102H
250C 23 INX H Increment registers pair.
250D 3E 00 MVI A,00H Load 00H in accumulator
250F 77 MOV M.A If carry flag is reset, number is
even and 00H is stored in location
2001H
2510 EF RST 5 stop
2511 23 LOOP INX H Increment registers pair.
2512 3E 01 MVI A,01H Load 01H in accumulator
2514 77 MOV M,A If carry flag is set, number is even
and 01H is stored in location
2002H
2515 EF RST 5 stop

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. What is the word length of the instruction LXI H, 2500 H.

2. Specify the Opcode & operand in the instruction MVI A, 00H.

3. Distinguish between DCR and DCX instructions.

4. Distinguish between ADD and ADI instructions.


EXPERIMENT NO. : 24

ADDITION OF N 8 BIT NUMBER


Write a program for addition of a series of 8-bit numbers with carry. The N number of hexadecimal
numbers lies from F101H onwards. F100H has the number of hexadecimal bytes to be added. The
result is stored at F200H and F201H memory location. Assume program is written in memory location
F000H.Fig 4.12 shows the flow chart for addition of N 8-bit numbers.
PROGRAM:

ADDRESS OP-CODE LABEL MNEMONIC OPERAND COMMENTS


F000 21 00 F1 LXI H,FI00H Address of no. Of bytes in HL
register pair
F003 4E MOV C,M Transfer number of bytes from memory
location to C register.
F004 AF XRA A Clear accumulator register.
F005 06 00 MVI B.00 Initialise B register with 00H to
store MSBs of sum
F007 23 LOOP INX H Address of 1st no. in H-L pair
F008 66 ADD M Add memory to accumulator
F009 D2 0D F0 JNC LEVEL_1 If carry is not generated, jump to
LEVEL_1.
F00C 04 INR B If carry is generated, increment B
register.
F00D 0D LEVEL_1 DCR C Decrement count by one.
F00E C2 07 F0 JNZ LOOP Test to check whether addition of
all numbers are done
F011 32 00 F2 STA F200 Store LSBs of sum in memory
location 8503H
F014 78 MOV A,B Copy content of B in accumulator.
F015 32 01 F2 STA F201 Store MSBs of sum in memory
location 8503H
F018 EF RST 5 Stop
EXAMPLE:

Consider five (n=05H) data are store from location F101H onwards as given below. The results are stored in
location F200H and F201H.

DATA RESULT
Memory location Data Memory location Data
F100H 05H F200H OFH LSBs of sum

F101H 01H F201H 00H MSBs of sum

F102H 02H

F103H 03H

F104H 04H

F105H 05H

THEORYRITICAL VERIFICATION:

QUESTIONS:

1. Distinguish between JNC and JC instructions.

2. Specify the Opcode & operand in the instruction STA 2503H.

3. Distinguish between JMP and JNC instructions.


OPCODES TABLE OF INTEL 8085

Sl. No. Mnemonics, Operand Opcode Bytes


1. ACI Data CE 2
2. ADC A 8F 1
3. ADC B 88 1
4. ADC C 89 1
5. ADC D 8A 1
6. ADC E 8B 1
7. ADC H 8C 1
8. ADC L 8D 1
9. ADC M 8E 1
10. ADD A 87 1
11. ADD B 80 1
12. ADD C 81 1
13. ADD D 82 1
14. ADD E 83 1
15. ADD H 84 1
16. ADD L 85 1
17. ADD M 86 1
18. ADI Data C6 2
19. ANA A A7 1
20. ANA B A0 1
21. ANA C A1 1
22. ANA D A2 1
23. ANA E A3 1
24. ANA H A4 1
25. ANA L A5 1
26. ANA M A6 1
27. ANI Data E6 2
28. CALL Label CD 3
29. CC Label DC 3
30. CM Label FC 3
31. CMA 2F 1
32. CMC 3F 1
33. CMP A BF 1
34. CMP B B8 1
35. CMP C B9 1
36. CMP D BA 1
37. CMP E BB 1
38. CMP H BC 1
39. CMP L BD 1
40. CMP M BD 1
41. CNC Label D4 3
42. CNZ Label C4 3
Sl. No. Mnemonics, Operand Opcode Bytes
43. CP Label F4 3
44. CPE Label EC 3
45. CPI Data FE 2
46. CPO Label E4 3
47. CZ Label CC 3
48. DAA 27 1
49. DAD B 09 1
50. DAD D 19 1
51. DAD H 29 1
52. DAD SP 39 1
53. DCR A 3D 1
54. DCR B 05 1
55. DCR C 0D 1
56. DCR D 15 1
57. DCR E 1D 1
58. DCR H 25 1
59. DCR L 2D 1
60. DCR M 35 1
61. DCX B 0B 1
62. DCX D 1B 1
63. DCX H 2B 1
64. DCX SP 3B 1
65. DI F3 1
66. EI FB 1
67. HLT 76 1
68. IN Port-address DB 2
69. INR A 3C 1
70. INR B 04 1
71. INR C 0C 1
72. INR D 14 1
73. INR E 1C 1
74. INR H 24 1
75. INR L 2C 1
76. INR M 34 1
77. INX B 03 1
78. INX D 13 1
79. INX H 23 1
80. INX SP 33 1
81. JC Label DA 3
82. JM Label FA 3
83. JMP Label C3 3
84. JNC Label D2 3
85. JNZ Label C2 3
86. JP Label F2 3
87. JPE Label EA 3
88. JPO Label E2 3
89. JZ Label CA 3
Sl. No. Mnemonics, Operand Opcode Bytes
90. LDA Address 3A 3
91. LDAX B 0A 1
92. LDAX D 1A 1
93. LHLD Address 2A 3
94. LXI B 01 3
95. LXI D 11 3
96. LXI H 21 3
97. LXI SP 31 3
98. MOV A, A 7F 1
99. MOV A, B 78 1
100. MOV A, C 79 1
101. MOV A, D 7A 1
102. MOV A, E 7B 1
103. MOV A, H 7C 1
104. MOV A, L 7D 1
105. MOV A, M 7E 1
106. MOV B, A 47 1
107. MOV B, B 40 1
108. MOV B, C 41 1
109. MOV B, D 42 1
110. MOV B, E 43 1
111. MOV B, H 44 1
112. MOV B, L 45 1
113. MOV B, M 46 1
114. MOV C, A 4F 1
115. MOV C, B 48 1
116. MOV C, C 49 1
117. MOV C, D 4A 1
118. MOV C, E 4B 1
119. MOV C, H 4C 1
120. MOV C, L 4D 1
121. MOV C, M 4E 1
122. MOV D, A 57 1
123. MOV D, B 50 1
124. MOV D, C 51 1
125. MOV D, D 52 1
126. MOV D, E 53 1
127. MOV D, H 54 1
128. MOV D, L 55 1
129. MOV D, M 56 1
130. MOV E, A 5F 1
131. MOV E, B 58 1
132. MOV E, C 59 1
133. MOV E, D 5A 1
134. MOV E, E 5B 1
135. MOV E, H 5C 1
136. MOV E, L 5D 1
Sl. No. Mnemonics, Operand Opcode Bytes
137. MOV E, M 5E 1
138. MOV H, A 67 1
139. MOV H, B 60 1
140. MOV H, C 61 1
141. MOV H, D 62 1
142. MOV H, E 63 1
143. MOV H, H 64 1
144. MOV H, L 65 1
145. MOV H, M 66 1
146. MOV L, A 6F 1
147. MOV L, B 68 1
148. MOV L, C 69 1
149. MOV L, D 6A 1
150. MOV L, E 6B 1
151. MOV L, H 6C 1
152. MOV L, L 6D 1
153. MOV L, M 6E 1
154. MOV M, A 77 1
155. MOV M, B 70 1
156. MOV M, C 71 1
157. MOV M, D 72 1
158. MOV M, E 73 1
159. MOV M, H 74 1
160. MOV M, L 75 1
161. MVI A, Data 3E 2
162. MVI B, Data 06 2
163. MVI C, Data 0E 2
164. MVI D, Data 16 2
165. MVI E, Data 1E 2
166. MVI H, Data 26 2
167. MVI L, Data 2E 2
168. MVI M, Data 36 2
169. NOP 00 1
170. ORA A B7 1
171. ORA B B0 1
172. ORA C B1 1
173. ORA D B2 1
174. ORA E B3 1
175. ORA H B4 1
176. ORA L B5 1
177. ORA M B6 1
178. ORI Data F6 2
179. OUT Port-Address D3 2
180. PCHL E9 1
181. POP B C1 1
182. POP D D1 1
183. POP H E1 1
Sl. No. Mnemonics, Operand Opcode Bytes
184. POP PSW F1 1
185. PUSH B C5 1
186. PUSH D D5 1
187. PUSH H E5 1
188. PUSH PSW F5 1
189. RAL 17 1
190. RAR 1F 1
191. RC D8 1
192. RET C9 1
193. RIM 20 1
194. RLC 07 1
195. RM F8 1
196. RNC D0 1
197. RNZ C0 1
198. RP F0 1
199. RPE E8 1
200. RPO E0 1
201. RRC 0F 1
202. RST 0 C7 1
203. RST 1 CF 1
204. RST 2 D7 1
205. RST 3 DF 1
206. RST 4 E7 1
207. RST 5 EF 1
208. RST 6 F7 1
209. RST 7 FF 1
210. RZ C8 1
211. SBB A 9F 1
212. SBB B 98 1
213. SBB C 99 1
214. SBB D 9A 1
215. SBB E 9B 1
216. SBB H 9C 1
217. SBB L 9D 1
218. SBB M 9E 1
219. SBI Data DE 2
220. SHLD Address 22 3
221. SIM 30 1
222. SPHL F9 1
223. STA Address 32 3
224. STAX B 02 1
225. STAX D 12 1
226. STC 37 1
227. SUB A 97 1
228. SUB B 90 1
229. SUB C 91 1
230. SUB D 92 1
Sr. No. Mnemonics, Operand Opcode Bytes
231. SUB E 93 1
232. SUB H 94 1
233. SUB L 95 1
234. SUB M 96 1
235. SUI Data D6 2
236. XCHG EB 1
237. XRA A AF 1
238. XRA B A8 1
239. XRA C A9 1
240. XRA D AA 1
241. XRA E AB 1
242. XRA H AC 1
243. XRA L AD 1
244. XRA M AE 1
245. XRI Data EE 2
246. XTHL E3 1

You might also like