Sie sind auf Seite 1von 30

EC Department

A LABORATORY MANUAL OF
MICROPROCESSORS
AND
INTERFACING

B.H.Gardi College of Engineering & Technology


EC Department
Shri B.H.Gardi College of Engineering &
Technology

CERTIFICATE
This is to certify that Mr. / Miss. ____________________________

Of_____________SEM.____________branch_______________
Enrolment no. __________________ has satisfactorily completed
his/her term work in the subject
___________________________________ for the term ending in
_______________ 20 / 20

Date: ___________

Subject In charge Head of Department


NAME OF STUDENT :____________________________________

YEAR : ______________ ROLL NO. : ___________________


ENROLLMENT NO. : ______________________

INDEX

SR. PAGE
DATE PROGRAM STATEMENT GRADE SIGN
NO. NO.
1 A data byte is stored at location C100H. Write
instructions to transfer this data byte to
accumulator using three different op-codes
namely (i) MOV (ii) LDAX (iii) LDA.
2 Register B Contains 32H.Use (i) MOV (ii) STAX to
copy this content to location D100H.
3 Add two 8 bit numbers such that numbers are
stored in memory location C100H and C101H.
Store the answer in memory location C104H.
Take care for carry.
4 Add two 16-bit numbers. Take data from
memory and store answer in memory.
5 Block transfer. Ten bytes of data are stored in
location C100H-C109H. Transfer the entire block
of data to new memory location starting at
D100H.
6 Six bytes of data are stored in memory locations
starting at C100H.Add all the data bytes. Use
registers B to save any carries generated, while
adding data bytes. Store the sum at two
consecutive memory locations.
7 Write a Program to take a data from memory
location C100H. if it is greater then 7FH send it
to port 01H else send it to port 00H
8 Write a program to take a data from location
C100H & C101H. Add this data. If answer is
greater then FFH store the answer in B register
else store it in C register.
9 A set of ten current readings is stored in memory
locations starting at C100H. Add all the positive
readings (<12710).Reject all negative readings.
Output FFH to port1 at any time when the sum
exceeds eight bits to indicate overload,
otherwise Display the sum.
10 A set of Current readings is stored in memory
locations starting at C100H. The end of data
string is indicated by the data byte 0DH (ASCII
Code of enter).Copy this string contents at
another location up to the end of string.
11 Write a program to arrange data in descending
order. Assume five bytes are stored in successive
memory locations starting from C100H.
12 An array of binary numbers is stored in memory
starting from address C100H. There are ten
numbers in the array. Write an ALP which finds
out quantity of positive no., negative no. and
zeros in the data array and stores the result in
memory location starting from address C200H.

13 Ten data are stored from memory location


C100H. Write a program to arrange them in odd
& even data. Store the even data first starting
from C200H location
14 Write a subroutine on C300H for generate the
delay of 1 second.

15 1. Write a program for BCD to binary (Hex)


data conversion.
2. Write a program for Binary (Hex) to BCD
data conversion.
3. Write a program to convert Binary (Hex) to
7-segment Display data.
4. Write a program to convert Binary (Hex) to
ASCII data.
Microprocessors & Interfacing EC Department

----------------------------------------------------------------
| Intel|
| |
| 88888 000 88888 5555555 A |
| 8 8 0 0 8 8 5 A A |
| 8 8 0 0 0 8 8 5 A A |
| 88888 0 0 0 88888 555555 AAAAAAA |
| 8 8 0 0 0 8 8 5 A A |
| 8 8 0 0 8 8 5 A A |
| 88888 000 88888 555555 A A |
| |
| MICROPROCESSOR PIN DIAGRAM|
| |
| _________ _________ |
| _| \__/ |_ |
| --> X1 |_|1 40|_| Vcc (+5V) |
| _| |_ |
| --> X2 |_|2 39|_| HOLD <-- |
| _| |_ |
| <-- RESET OUT |_|3 38|_| HLDA --> |
| _| |_ |
| <-- SOD |_|4 37|_| CLK (OUT) --> |
| _| |_ ________ |
| --> SID |_|5 36|_| RESET IN <-- |
| _| |_ |
| --> TRAP |_|6 35|_| READY <-- |
| _| |_ _ |
| --> RST 7.5 |_|7 34|_| IO/M --> |
| _| |_ |
| --> RST 6.5 |_|8 33|_| S1 --> |
| _| |_ __ |
| --> RST 5.5 |_|9 32|_| RD --> |
| _| |_ __ |
| --> INTR |_|10 8085A 31|_| WR --> |
| ____ _| |_ |
| <-- INTA |_|11 30|_| ALE --> |
| _| |_ |
| <--> AD0 |_|12 29|_| S0 --> |
| _| |_ |
| <--> AD1 |_|13 28|_| A15 --> |
| _| |_ |
| <--> AD2 |_|14 27|_| A14 --> |
| _| |_ |
| <--> AD3 |_|15 26|_| A13 --> |
| _| |_ |
| <--> AD4 |_|16 25|_| A12 --> |
| _| |_ |
| <--> AD5 |_|17 24|_| A11 --> |
| _| |_ |
| <--> AD6 |_|18 23|_| A10 --> |
| _| |_ |
| <--> AD7 |_|19 22|_| A9 --> |
| _| |_ |
| (Gnd) Vss |_|20 21|_| A8 --> |
| |______________________| |
-----------------------------------------------------
Microprocessors & Interfacing EC Department

ADDRESSING MODES
 Implied Addressing:
The addressing mode of certain instructions is implied by the instruction’s function. For
example, the STC (set carry flag) instruction deals only with the carry flag, the DAA
(decimal adjust accumulator) instruction deals with the accumulator.

 Register Addressing:
Quite a large set of instructions call for register addressing. With these instructions, you
must specify one of the registers A through E, H or L as well as the operation code. With
these instructions, the accumulator is implied as a second operand. For example, the
instruction CMP E may be interpreted as 'compare the contents of the E register with the
contents of the accumulator.

Most of the instructions that use register addressing deal with8-bit values. However, a
few of these instructions deal with 16-bit register pairs. For example, the PCHL instruction
exchanges the contents of the program counter with the contents of the H and L registers.

 Immediate Addressing:
Instructions that use immediate addressing have data assembled as a part of the
instruction itself. For example, the instruction CPI 41H. When this instruction is executed,
the processor fetches the first instruction byte and determines that it must fetch one
more byte. The processor fetches the next byte into one of its internal registers and then
performs the compare operation.

Notice that the names of the immediate instructions indicate that they use immediate
data. Thus, the name of an add instruction is ADD; the name of an add immediate
instruction is ADI.

All but two of the immediate instructions uses the accumulator as an implied operand, as
in the CPI instruction shown previously. The MVI (move immediate) instruction can move
its immediate data to any of the working registers including the accumulator or to
memory. Thus, the instruction MVI D, OFFH moves the hexadecimal
Value FF to the D register.

The LXI instruction (load register pair immediate) is even more unusual in that its
immediate data is a 16-bit value. This instruction is commonly used to load addresses into
a register pair. As mentioned previously, your program must initialize the stack pointer;
LXI is the instruction most commonly used for this purpose. For example, the instruction
LXI SP, 3OFFH loads the stack pointer with the hexadecimal value 30FF.
Microprocessors & Interfacing EC Department

 Direct Addressing:
Jump instructions include a 16-bit address as part of the instruction. For example, the
instruction JMP 1000H causes a jump to the hexadecimal address 1000 by replacing the
current contents of the program counter with the new value 1000H.

Instructions that include a direct address require three bytes of storage: one for the
instruction code, and two for the 16-bit address

 Register Indirect Addressing:


Register indirect instructions reference memory via a register pair. Thus, the instruction
MOV M,C moves the contents of the C register into the memory address stored in the H
and L register pair. The instruction LDAX B loads the accumulator with the byte of data
specified by the address inthe B and C register pair.

 Combined Addressing Modes:


Some instructions use a combination of addressing modes. A CALL instruction, for
example, combines direct addressing and register indirect addressing. The direct address
in a CALL instruction specifies the address of the desired subroutine; the register indirect
address is the stack pointer. The CALL instruction pushes the current contents of the
program counter into the memory location specified by the stack pointer.
Microprocessors & Interfacing EC Department

INSTRUCTION TYPES
Instruction Naming Conventions: The mnemonics assigned to the instructions are
designed to indicate the function of the instruction.

 Data Transfer Croup:


The data transfer instructions move data between registers or between memory and
registers.

MOV Move
MVI Move Immediate
LDA Load Accumulator Directly from Memory
STA Store Accumulator Directly in Memory
LHLD Load H & L Registers Directly from Memory
SHLD Store H & L Registers Directly in Memory

An 'X' in the name of a data transfer instruction implies that it deals with a register pair
(16-bits);

LXI Load Register Pair with Immediate data


LDAX Load Accumulator from Address in Register Pair
STAX Store Accumulator in Address in Register Pair
XCHG Exchange H & L with D & E
XTHL Exchange Top of Stack with H & L

 Arithmetic Group:
The arithmetic instructions add, subtract, increment, or decrement data in registers or
memory.

ADD Add to Accumulator


ADI Add Immediate Data to Accumulator
ADC Add to Accumulator Using Carry Flag
ACI Add immediate data to Accumulator Using Carry
SUB Subtract from Accumulator
SUI Subtract Immediate Data from Accumulator
SBB Subtract from Accumulator Using Borrow/Carry Flag
SBI Subtract Immediate from Accumulator Using Borrow/Carry Flag
INR Increment Specified Byte by One
DCR Decrement Specified Byte by One
INX Increment Register Pair by One
DCX Decrement Register Pair by One
DAD Double Register Add; Add Content of Register
Pair to H & L Register Pair
Microprocessors & Interfacing EC Department

 Logical Group:
This group performs logical (Boolean) operations on data in registers and memory and on
condition flags.

The logical AND, OR, and Exclusive OR instructions enable you to set specific bits in the
accumulator ON or OFF.

ANA Logical AND with Accumulator


ANI Logical AND with Accumulator Using Immediate Data
ORA Logical OR with Accumulator
OR Logical OR with Accumulator Using Immediate Data
XRA Exclusive Logical OR with Accumulator
XRI Exclusive OR Using Immediate Data

The Compare instructions compare the content of an 8-bit value with the contents of the
accumulator;
CMP Compare
CPI Compare Using Immediate Data

The rotate instructions shift the contents of the accumulator one bit position to the left or
right:
RLC Rotate Accumulator Left
RRC Rotate Accumulator Right
RAL Rotate Left through Carry
RAR Rotate Right through Carry

Complement and carry flag instructions:


CMA Complement Accumulator
CMC Complement Carry Flag
STC Set Carry Flag

 Branch Group:
The branching instructions alter normal sequential program flow, either unconditionally
or conditionally. The unconditional branching instructions are as follows:

JMP Jump
CALL Call
RET Return

Conditional branching instructions examine the status of one of four condition flags to
determine whether the specified branch is to be executed. The conditions that may be
specified are as follows:
Microprocessors & Interfacing EC Department

NZ Not Zero (Z = 0)
Z Zero (Z = 1)
NC No Carry (C = 0)
C Carry (C = 1)
PO Parity Odd (P = 0)
PE Parity Even (P = 1)
P Plus (S = 0)
M Minus (S = 1)

Thus, the conditional branching instructions are specified as follows:

Jumps Calls Returns


C CC RC (Carry)
INC CNC RNC (No Carry)
JZ CZ RZ (Zero)
JNZ CNZ RNZ (Not Zero)
JP CP RP (Plus)
JM CM RM (Minus)
JPE CPE RPE (Parity Even)
JP0 CPO RPO (Parity Odd)
Two other instructions can affect a branch by replacing the contents or the program
counter:

PCHL Move H & L to Program Counter


RST Special Restart Instruction Used
with Interrupts

 Stack I/O, and Machine Control Instructions:


The following instructions affect the Stack and/or Stack Pointer:
PUSH Push Two bytes of Data onto the Stack
POP Pop Two Bytes of Data off the Stack
XTHL Exchange Top of Stack with H & L
SPHL Move content of H & L to Stack Pointer

The I/0 instructions are as follows:


IN Initiate Input Operation
OUT Initiate Output Operation

The Machine Control instructions are as follows:


EI Enable Interrupt System
DI Disable Interrupt System
HLT Halt
NOP No Operation
Microprocessors & Interfacing EC Department

MICROFRIEND DYNA – 85 Operating Manual

 First you have to convert your program to the hex code.


 The RAM locations (C000)16 to (FFFF)16 are available for the user to enter any desired
program.
 A system program (commonly called the monitor program) resides in the EPROM
((0000)16 to (BFFF)16)and gets loaded whenever the kit is reset / switched on.
<RESET> key →Does hardware reset. The word “FrIEnd” appears in the display when
pressed
 RST 1 is use for halt the program.

 For Enter the Program Hex code press

SET Address INR

E.g. Our program is

MVI A, 05H 3E 05
RST 1 CF
Then enter:-

SET C000 INR


3E INR
05 INR
CF INR
RST

 For Execute the program press

Go Address EXEC

E.g. Go C000 EXEC

 To Examine a Register press

Reg A --- it will display the content of Accumulator

You examine all the register Using INR or directly.


Microprocessors & Interfacing EC Department

MICROFRIEND DYNA – 85(With LCD) Operating Manual

Background:

The MICROFRIEND DYNA-85 kit is based on the INTEL 8085 designed specifically for
training & development applications.

The µP trainer kit consists of basic units required for a simple computer, namely, a
microprocessor chip (CPU), memory (EPROM, and RAM), input device (Hex / ASCII
keyboard) and output device (seven segment display unit).

Software in the form of a set of instructions written using the 8085 instruction set makes
the µP perform a set of desired operations.

 The CPU operates at 3 MHz (system clock).


 The RAM locations (C000)16 to (FFFF)16 are available for the user to enter any desired
program.
 A system program (commonly called the monitor program) resides in the EPROM
((0000)16 to (3FFF)16)and gets loaded whenever the kit is reset / switched on.
<RESET> key →Does hardware reset. The word “FrIEnd” appears in the display when
pressed

It has to be borne in mind that the instructions NEEDNOT be converted into the
hexadecimal form while keying in. The mnemonics are only to be entered. The hex code of
each instruction and required no of bytes for each are automatically calculated.

Single key system commands are provided in the trainer kit for facilitating easy operation
of the kits. These commands
are described below:

 <A address>→ To assemble a program i.e. Enter the instruction at the specified
address.
 <Enter>→To go next address to enter another instruction

 <U address>→ To examine a program.


 <N>→next instruc on
 <P>→previous instruc on

 <GO> → Used for loading program counter with the memory address of the beginning
of the program and execute the program

 <R>→ To examine the CPU registers (A, B, C, D, E, H, L, Stack Pointer, Program


Counter, Interrupt Mask, Flag Register)
Microprocessors & Interfacing EC Department

The flag register bits are


S Z X AC X P X CY
where S is the sign flag, Z is the zero flag, AC is the auxiliary carry flag, P isthe parity
flag and CY is the carry flag (X means don’s care).

 <E address>→ To examine or modify memory loca on(s).


 <Space>→next loca on
 <Enter>→exit

 To enter a program, follow the following sequence:

<RESET> key ! DYNA -85 > prompt that appears


DYNA -85 > A C000 ! Suppose program starts at address C000H
<Enter>
DYNA -85 >XXX ! First instruction
<Enter> ! Increments address to C001 (if it is one-byte instruction)
. ! Enter the entire program by keying in
. Instructions in each location and moving
. to next by pressing <Enter>
DYNA -85 > RST 1 ! Last instruction in the program

 To execute the entered program, use the following command:

DYNA -85 > GO C000H <Enter><Space><Space>


Microprocessors & Interfacing EC Department

Practical-1 DATE: / /

Aim: - A data byte is stored at location C100H. Write instructions to transfer this data byte to
accumulator using three different op-codes namely (i) MOV (ii) LDAX (iii) LDA.

Output:-

1
Microprocessors & Interfacing EC Department

Practical-2 DATE: / /

Aim: - Register B Contains 32H.Use (i) MOV (ii) STAX to copy this content tolocation D100H.

Output:-

2
Microprocessors & Interfacing EC Department

Practical-3 DATE: / /

Aim: - Add two 8 bit numbers such that numbers are stored in memory location C100H and C101H.
Store the answer in memory location C104H. Take care for carry.

Output:-

3
Microprocessors & Interfacing EC Department

Practical-4 DATE: / /

Aim: - Add two 16-bit numbers. Take data from memory and store answer in memory.

Output:-

4
Microprocessors & Interfacing EC Department

Practical-5 DATE: / /

Aim: - Block transfer. Ten bytes of data are stored in location C100H-C109H. Transfer the entire block of
data to new memory location starting at D100H.

-Output:-
5
Microprocessors & Interfacing EC Department

Practical-6 DATE: / /

Aim:-Six bytes of data are stored in memory locations starting at C100H.Add all the data bytes. Use
register B to save any carries generated, while adding data bytes. Store the sum at two consecutive
memory location.

Output:-
6
Microprocessors & Interfacing EC Department

Practical-7 DATE: / /

Aim:- Write a Program to take a data from memory location C100H. if it is greater then 7FH send it to
port 01H else send it to port 00H.

Output:-

7
Microprocessors & Interfacing EC Department

Practical-8 DATE: / /

Aim: - Write a program to take a data from location C100H & C101H. Add this data. If answer is greater
then FFH store the answer in B register else store it in C register.

Output:-

8
Microprocessors & Interfacing EC Department

Practical-9 DATE: / /

Aim: - A set of ten current readings is stored in memory locations starting at C100H. Add all the positive
readings (<12710).Reject all negative readings. Output FFH to port1 at any time when the sum exceeds
eight bits to indicate overload, otherwise Display the sum.

Output:-
9
Microprocessors & Interfacing EC Department

Practical-10 DATE: / /

Aim: - A set of Current readings is stored in memory locations starting at C100H. The end of data string
is indicated by the data byte 0DH (ASCII Code of enter).Copy this string contents at another location up
to the end of string.

Output:-

10
Microprocessors & Interfacing EC Department

Practical-11 DATE: / /

Aim: - Write a program to arrange data in descending order. Assume five bytes are stored in successive
memory locations starting from C100H.

Output:-

11
Microprocessors & Interfacing EC Department

Practical-12 DATE: / /

Aim: - Write An array of binary numbers is stored in memory starting from address C100H. There are ten
numbers in the array. Write an ALP which finds out quantity of positive no., negative no. and zeros in
the data array and stores the result in memory location starting from address C200H.

Output :-

12
Microprocessors & Interfacing EC Department

Practical-13 DATE: / /

Aim: - Ten data are stored from memory location C100H. Write a program to arrange them in odd &
even data. Store the even data first starting from C200H location.

Output:-

13
Microprocessors & Interfacing EC Department

Practical-14 DATE: / /

Aim: - Write a subroutine on C300H for generate the delay of 1 second.

Output:-

14
Microprocessors & Interfacing EC Department

Practical-15 DATE: / /

Aim: -

1. Write a program for BCD to binary (Hex) data conversion.


2. Write a program for Binary (Hex) to BCD data conversion.
3. Write a program to convert Binary (Hex) to 7-segment Display data.
4. Write a program to convert Binary (Hex) to ASCII data

15
Microprocessors & Interfacing EC Department

Output:-

16

Das könnte Ihnen auch gefallen