Sie sind auf Seite 1von 25

Sub.

Code: 2141001

MICROPROCESSOR AND INTERFACING


Practical Manual
(Semester – 4th- EC)

Department of Electronics and


Communication Engineering

Government Engineering
College Modasa
Equipments/Software:

1. 8085 microprocessor kit


2. Microprocessor simulator
3. Computer
TABLE OF CONTENTS

LA PAGE
TITLE DATE SIGN
B NO.

1 Introduction to 8085 microprocessor kit

2 Programming based on Data transfer operations

Programming based on Arithmetic and logical


3
operations

4 Programming based on Branch operations

5 Programming based on Array.

6 Programming based on Stack and Subroutines

Programming based on Delay and counter


7
techniques

8 To interface 8255 with 8085 microprocessor.

9 To interface 8253 with 8085 microprocessor.

To interface 8257 study card with 8085


10
microprocessor kit
PRACTICAL 1
INTRODUCTION TO 8085 MICROPROCESSOR KIT

OBJECTIVE
To familiar with 8085 microprocessor kit and its commands.

THEORY
M85-0X kit is a single board MICROPROCESSOR TRAINING KIT based on 8085
Microprocessor. It contains the following features:

 Based on 8085 CPU operating at 6.144 MHz.


 8K bytes of Powerful Monitor Program using 27512 EPROM
 8K bytes of RAM using 6264 with Battery Backup using NICD Battery.
 On-board one memory expansion up to 56KB.
 Three Channel Timer/Counter using 8253 brought out at 10 Pins FRC Connector.
 24 I/O lines provided through 8255 brought out at 26 Pins FRC Connector to
interface with IC-XX Series.
 22 I/O lines provided through 8155 brought at 26 Pins FRC Connector.
 RS-232C interface through SID/SOD lines
 Two mode of commands : Hex Key pad Mode
- Serial Mode
 28 keys hexadecimal keyboard and six seven segment display using 8279
 Powerful Commands like Examine/Edit Memory, Examine/Edit Register, Single
stepping, Execution, Block Move, Insert Data, Delete Data can be used through
hex keyboard or PC serial mode.
 Facility for Downloading/Uploading files from/to PC.
 All address, data & control lines are available on KXT Bus 50 pin FRC Connector
to interface with SC-XX Series.
 All ICS are mounted on IC Sockets.
 Bare board Tested Glass Epoxy SMOBC PCB is used.
 In-Built Power Supply of +5V/1.5A, ±12V/250mA
List of important commands:

1. Reset: This key initializes the M85-02 kit and displays ‘8085
MICROPROCESSOR TRAINER KIT” on the display. A ‘-’ on the left most end
of display indicates that the system

2. Examine/Modify Register: This command is used to examine/modify any internal


register of the CPU. If one wants to examine the contents of all the registers, one
can start from ‘A’ Register and examine all the registers by pressing next key.
Whereas if some specific registers is to be examined, then the key for that register
can be entered directly. The contents of any register can be changed.

3. Examine/Modify Memory: This command is used to examine the contents of any


memory location and modify the contents of the RAM area. On pressing this key,
a dot is displayed in the end of address field. One can now enter the address of
any location one wants to examine. Enter the desired address and press NEXT.
The content of this location is displayed in the data field. If one wants to examine
the contents of next location, just press NEXT and the address in the address field
will be incremented by one and its content will displayed in data field. Same way
if one wants to examine the content of previous location just press PRE key and
the address in the address field will be decremented by one and its contents will
be displayed in the data field.

If one wants to modify the contents of any RAM location, then enter the data and
press NEXT. The data field will be written in the address displayed in the address
field and simultaneously the contents of next location will be displayed.

4. GO: This command is used to execute the program in full clock speed. On
pressing this key, the program counter content is displayed in the address field
with the data in the data field. A dot in the address field indicates that the address
can be changed, if so desired. Enter the starting address of the program. On
entering this address, the data field gets blanked out. Press Terminate (.) key. The
CPU will start executing the program and E wil be displayed in address field.

5. Delete: This command allows the user to delete one or more instructions from the
user’s program. In this command all the memory referenced instructions also get
modified accordingly to keep the logic of the program same.

SAMPLE QUATION:

1. Draw the pin diagram & block diagram of 8085 microprocessor and explain in
brief.
2. Examine content of register A and change it to 0x99.
3. Examine the data stored at memory location 2100H and change it to 0x45
PRACTICAL 2

PROGRAMMING BASED ON DATA TRANSFER OPERATIONS

OBJECTIVE
To familiar with the use of data transfer instruction set of 8085

THEORY

Opcode Operand Description

MOV Rd, Rs Copies data from source resister Rs to Rd

MVI R, 8-bit Copies 8-bit data to resister R

LXI Rp, 16-bit Copies 16-bit data to register pair Rp

LXI SP, 16-bit Copies 16-bit data to stack pointer SP


Copies 8-bit data stored at memory location specified by the
MOV R,M
content of HL register to register R
Copies 8-bit data stored at memory location specified by the
LDAX B/D
content of BC or DE register to the accumulator
Copies 8-bit data stored at memory location specified by 16-bit
LDA 16-bit
to the accumulator
Copies data from a register R, into the memory location
MOV M,R
specified by the HL pair
Stores the content of the accumulator to the memory location
STAX B/D
specified by the BC or DE pair
STA 16-bit Store the content of the accumulator to memory address
Store 8-bit data to the memory location specified by the register
MVI M, 8-bit
pair HL
XCHG Exchange H and L with D and E respectively
EXAMPLE PROGRAM
Load the accumulator and register B with 0x04 and 0x05 respectively. Swap the content
of the accumulator and register B using register C.

Hex
Address Label Mnemonics Comments
Code
Load Accumulator with
2000H 3EH MVI A, 04H
immediate value 05h
2001H 04H
Load register B with
2002H 06H MVI B, 05H
immediate value 09h
2003H 05H
Copy the contents of Acc
2004H 4FH MOV C, A
in register C
Copy the content of B to
2005H 78H MOV A, B
Acc.
Copy the content of C to
2006H 41H MOV B,C
B
2006H EFH RST 5 Ends the program

1. Load memory location 2000h with data 61H. Transfer the data in to register C

LXI H, 2000H
MVI M, 61H
MOV C, M
HLT

2. Load register B with data from memory location 2100H.

LXI H, 2100H
MOV B, M
HLT

OR

LDA 2100H
MOV B,A
HLT
SAMPLE QUESTION:
1. Load the memory address 2100H with 0x45 and transfer it to accumulator. Copy
accumulator to register B, C, D, E, H and L.
2. Load the accumulator with 0x45 and save accumulator at memory location
2105H.
3. Write instructions to load 0x65 in register C and 0x92 in the accumulator. Store
the content of both register at memory location 2122H and 2212H.
PRACTICAL 3

PROGRAMMING BASED ON ARITHMETIC AND LOGICAL OPERATIONS

OBJECTIVE
To familiar with the use of arithmetic and logical instruction sets of 8085

THEORY

Opcode Operand Description

ADD R Adds the content of register R to the content of the accumulator

ADI 8-bit Adds the 8-bit Data to the content of the accumulator

SUB R Subtracts content of register R from the content of the accumulator

SUI 8-bit Subtracts 8-bit Data from the content of the accumulator

INR R Increases the content of register R by 1

DCR R Decreases the content of register R by 1


Adds the content of memory location specified by register pair HL
ADD M
to the content of the accumulator
Subtracts the content of memory location specified by register pair
SUB M
HL from the content of the accumulator
Increment the content of the memory location specified by register
INR M
pair HL by 1.
Decrement the content of the memory location specified by
DCR M
register pair HL by 1.
Logically ANDs the content of register R with the content of
ANA R
accumulator
ANI 8-bit Logically ANDs the 8-bit data with the content of the accumulator
Logically ORs the content of register R with content of the
ORA R
accumulator
ORI 8-bit Logically ORs the 8-bit data with the content of the accumulator
Exclusive-ORs the contents of register R with the content of
XRA R
accumulator
XRI 8-bit Exclusive-ORs the 8-bit data with the content of the accumulator

CMA Complements the content of the accumulator

RLC Rotate accumulator left

RAL Rotate accumulator left through carry

RRC Rotate accumulator right

RAR Rotate accumulator right through carry

CMP R/M Compare register or memory with accumulator

CPI 8-bit Compare 8-bit data with accumulator

1. Add the data of memory locations 2010h & 2011h. Store answer at 2013h.
LXI H, 2010H
MOV A, M
INX H
ADD M
INX M
MOV M, A
HLT

2. Load register C with 65H & B with 3FH. Add the data of C&B, store the result at
2005h

MVI C, 65H
MVI B, 3FH
MOV A,B
ADD C
STA 2005H
HLT
Logical Operations

1. Perform AND operations such that

(a) Output is same as input

MVI A,63H
ANI FFH
MOV B,A
HLT

(b) Output should mask the upper nibble

MVI A,63H
ANI 0FH
MOV B,A
HLT

(c) Output should display 00H

MVI A, 63 H
ANI 00H
MOV B,A
HLT

SAMPLE QUATION:
1. Write an assembly language program for the adding of two 8-bits numbers stored
at memory location 2100H and 2101H respectively. Store the result at memory
location 2102H.
2. Write an ALP to add two sixteen bit numbers and store 16-bit result.
3. Subtract two 8-bit numbers at 2100H and 2101H. Save the result at location
2102H.
4. Write a program to subtract two 16-bit numbers and store the result.
5. Write ALP to find one’s complement of data 0x55 stored at memory location
2100H.
6. Write an ALP to find two’s complement of data 0x45 stored at memory location
2100H.
7. Write an ALP to unpacked data stored at location 2100H. Save result at memory
locations 2101H and 2102H.
8. Write a program that takes two nibbles from 2100H, 2101H and combines to form
byte. The nibbles from 2100 are to be taken as most significant nibble.
PRACTICAL 4

PROGRAMMING BASED ON BRANCH OPERATIONS

OBJECTIVE
To familiar with the use of branch operation related instructions in 8085 programming

BACKGROUND INFORMATION

Opcode Operand Description

JMP 16-bit Jump on the 16-bit memory address

JC 16-bit Jump on Carry

JNC 16-bit Jump on no Carry

JZ 16-bit Jump on Zero

JNZ 16-bit Jump on no Zero

JP 16-bit Jump on Plus

JM 16-bit Jump on Minus

JPE 16-bit Jump on Even Parity

JPO 16-bit Jump on Odd Parity


1. Compare two numbers of memory location C100H& C101H. If both are equal then
display 00H at register B. If the data of C100 is greater than the data of C101 then
display 01H in register B. Otherwise display 02H in Register B

MVI B,00H
LHLD C100H
MOV A,L
CMP H
JZ STOP
JNC ELSE
INR B
ELSE: INR B
STOP: HLT

2. Write an assembly language program to check whether the number is positive or


negative. To do this load from m.l. C300h. Display 00H in Reg. C if numbers is positive,
o/w display FFH in Reg.C

MVI C, 00H
LDA C300H
ADI 00H
JP STOP
DCR C
STOP: HLT

SAMPLE QUATION:
1. Write a program to multiply two 8 bit data stored at location 2101H and 2102H.
2. Write a program to add two BCD numbers located at 2101H and 2102H.
3. Write a program to find largest and smallest numbers in block of array from
2100H to 2109H. Store the result at location 210AH and 210BH.
4. Write an ALP to sort array of 10 elements from 2100H in ascending order.
PRACTICAL 5

PROGRAMMING BASED ON ARRAY


.

OBJECTIVE
To familiar with the array programingin 8085 microprocessor

Sample Program:

Exchange of Data between Two Arrays

Exchange the data of two arrays stored at m.l. 2100H & 2200H. The length of both
the arrays is 10.

LXI H, 2100H
LXI D, 2200H
MVI C, 0AH
MOV B, M
LOOP: LDAX D
MOV M, A
MOV A, B
STAX D
INX D
INX H
DCR C
JNZ LOOP
HLT
Sample Program:

Find Smallest and Largest Elements from an Array

An array of 10 data bytes is stored at C100H. Find the largest element of an array and
store at Reg. D

LXI H, C100H
MVI C, 0A H
GO: MOV A, M
REPEAT: INX H
DCR C
JZ STOP
CMP M
JC GO
JMP REPEAT
STOP: MOV D, A
HLT

Sample Quation:

(1) An array of 10 data bytes is stored at C100H. Find the smallest element of an
array and store at Reg. E
(2) An array is stored at D300H. The end of array is indicated by 00H. Find the
length of an array.
(3) An array of 10 bytes is stored at E100H onwards. Store the array in reverse order
PRACTICAL 6

PROGRAMMING BASED ON STACK AND SUBROUTINES.

OBJECTIVE
To familiar with the subroutine programming and stack operations in 8085

THEORY

Opcode Operand Description

LXI SP, 16-bit Load the stack pointer with a 16-bit data to SP

PUSH Rp Store the content of register pair on stack

PUSH PSW Store the content of the accumulator and the flag on the stack

POP Rp Retrieve register pair from stack

POP PSW Retrieve accumulator and flags form stack

CALL 16-bit Call subroutine unconditionally

RET 16-bit Return from subroutine unconditionally

CC 16-bit Call subroutine if carry flag is set

CNC 16-bit Call subroutine if carry flag is reset

CZ 16-bit Call subroutine if zero flag is set

CNZ 16-bit Call subroutine if zero flag is reset

CM 16-bit Call subroutine if sign flag is set

CP 16-bit Call subroutine if sign flag is reset

CPE 16-bit Call subroutine if parity flag is set


CPO 16-bit Call subroutine if parity flag is reset

RC 16-bit Return if carry flag is set

RNC 16-bit Return if carry flag is reset

RZ 16-bit Return if zero flag is set

RNZ 16-bit Return if zero flag is reset

RM 16-bit Return if sign flag is set

RP 16-bit Return if sign flag is reset

RPE 16-bit Return if parity flag is set

RPO 16-bit Return if parity flag is reset

Sample Program :

BCD Addition of n numbers using subroutine

Perform BCD addition using subroutine the length of data bytes is stored at D100 H. The
data bytes are stored at D101H onwards store carry in Reg. C & answer in Reg. D.

Main Program:
LXI SP, FFFFH
MVI C, 00H
LXI H, D100H
MOV B, M
CALL BCDADD
HLT
Subroutine BCDADD

XRA A
LOOP: INX H
ADD M
JNC GO
INR C
GO: DCR B
JNZ LOOP
DAA
MOV A, D
RET
SAMPLE QUATION:
1. Write an ALP to display HEX UP counter from 00H to FFH. Use delay
subroutine.
2. Write a program to meet following requirements
a. Initialize the stack pointer register at 2199H.
b. Clear the memory location starting form 2190H to 219FH
c. Load register pairs B, D and H with data 0237H, 1242H and 4087H,
respectively
d. Push the content of the register pairs B, D and H on the stack.
e. Execute the program and verify the memory location form 2190 to 219FH
PRACTICAL 7
PROGRAMMING BASED ON DELAY AND COUNTER TECHNIQUES

OBJECTIVE
To learn utilization of 8085 instructions for the counting and generating the desired delay
in programs

Sample Program:

Find out the time taken by below program (system frequency 2 Mhz)

MVI C, FFH

LOOP: DCR C

JNZ LOOP

1 T-state execution time= 1/f second=0.5 micro second


Total T state =(14*255)+7
Time taken= Total T state * 0.5 micro second

SAMPLE QUATION:
1. Write an ALP to generate 1 second time delay using loop within loop technique.
2. Write a program to count continuously in hexadecimal from 00H to FFH and
display the status of counter on display. Use appropriate delay between two
counts.
PRACTICAL 8

TO INTERFACE 8255 WITH 8085 MICROPROCESSOR.

OBJECTIVE
To learn interfacing and programming of 8255 with 8085

BACKGROUND INFORMATION
The 8255 is a general purpose programmable I/O device and has 24 I/O pins which may
be individually programmed. The basic function of 8255 is to interface general purpose
I/O devices to microcomputer system bus. It is software programmable so that no
external logic is necessary to interface the peripheral devices. The Read/write control
logic block receives signals likes CS, RD, WR, A0, A1 and Reset. The various
combinations of A1, A0, RD, WR and CS control the selection of one of the three ports
or the control word registers.

There are three basic modes of operation that can be selected by the system software.

 MODE 0 = Basic Input/Output.


 MODE 1 = Strobed Input/Output
 MODE 2 = Bi-directional Bus

Mode 0

In this mode, the ports can be used for simple input/output operations without
handshaking. If both port A and B are initialized in mode 0, the two halves of port C can
be either used together as an additional 8-bit port, or they can be used as individual 4-bit
ports. Since the two halves of port C are independent, they may be used such that one-
half is initialized as an input port while the other half is initialized as an output port.

Mode 1

When we wish to use port A or port B for handshake (strobed) input or output operation,
we initialize that port in mode 1. Some of the pins of port C function as handshake lines.
Mode 2

Only group A can be initialized in this mode. Port A can be used for bidirectional
handshake data transfer. This means that data can be input or output on the same eight
lines (PA0 - PA7). Pins PC3 - PC7 are used as handshake lines for port A. The remaining
pins of port C can be used as input/output lines if group B is initialized in mode 0.

Program:

Read data from port C and display it on Port B.

Control word for Mode 0, Port C input & Port B output:

D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 X 1 0 0 1 89H

Memory Mnemonics Machine Remarks


Address Code
C000 MVI A, 80H 3E,89 Send control word 80h to
C002 OUT 03H D3,03 control register
C004 IN 02H DB,02 Read data from port C and
C00E OUT 01H D3,01 Display it on port B.
C010 HLT 76 End of the Program

SAMPLE QUATION:
1. Draw and explain internal architecture of 8255.
2. Explain various modes and control registers of 8255.
3. Generate square wave at PORT-A, PORT-B and PORT-C of 8255.
PRACTICAL 9

TO INTERFACE 8253 WITH 8085 MICROPROCESSOR.

OBJECTIVE

To learn interfacing and programming of 8253 with 8085.

BACKGROUND INFORMATION
The 8253 is a programmable interval timer/counter specially designed for use with Intel
Micro Computer System. It’s function is that of a general purpose, multi-timing elements
that can be treated as an array of I/O ports in the system software.

The 8253 solves one of the most common problem in any microprocessor system, the
generation of accurate time delays under software control. Instead of setting up timing
loops in system software, the programmer configures the 8253 to match his requirements,
initializes one of the counters of 8253 with desired quantity. It is easy to see that the
software overhead is minimal and that multiple delays can easily be maintained by
assignment of priority levels.

Other counter timer functions that are non-delay in nature but also common to most
microprocessors can be implemented with the 8253.
The 8253 consists of 3 independent 16 bit counters each with a count rate of 2 Mhz. Each
counter can work in six modes.

 Mode 0 – Interrupt on terminal count


 Mode 1 – Programmable one shot
 Mode 2 – Rate generator
 Mode 3 – Square wave generator
 Mode 4 – Software triggered strobe
 Mode 5 – Hardware triggered strobe
PROGRAM :

To interface 8253 with 8085 using Mode 1 - Programmable One-Shot

ADDRESS OPCODE MNEMONICS


9100 3E 74 MVI A,32
9102 D3 23 OUT 23
9104 3E 0A MVI A,04
9106 D3 21 OUT 20
9108 3E 00 MVI A,00
910A D3 21 OUT 20
910C D3 40 OUT 40
910E 76 HLT

PROGRAM :

To interface 8253 with 8085 using Mode 2 - Rate Generator:

ADDRESS OPCODE MNEMONICS


9100 3E 74 MVI A,74
9102 D3 23 OUT 23
9104 3E 0A MVI A,0A
9106 D3 21 OUT 21
9108 3E 00 MVI A,00
910A D3 21 OUT 21
910C 76 HLT

Sample Quation:
1. Draw and explain block diagram of 8253.
2. Explain various modes and control registers of 8253.
3. Generate square wave at channel-1 of 8253.
PRACTICAL 10

TO INTERFACE 8257 STUDY CARD WITH 8085 MICROPROCESSOR


KIT

OBJECTIVE
To learn interfacing and programming of 8257 with 8085

BACKGROUND INFORMATION
The programmable DMA controller 8257 is 4-channel Direct Memory Access controller.
It is used for transfer of data at high speeds. Its primary function is to generate, upon a
peripheral request, a sequential memory address which will allow the peripheral to read
or write data directly to or from memory. Acquisition of the system bus is accomplished
via the CPU’s hold function. The 8257 has a priority logic that resolves the peripherals
requests issues a composite hold request to CPU. It maintains the DMA cycle count for
each channel and outputs a control signal to notify the peripheral that the programmed
number of DMA cycle is completed.

The 8257 offers three different modes of operation

1. DMA read, which causes data to be transferred from memory to a peripheral.


2. DMA write, which causes data to be transferred from a peripheral to memory.
3. DMA verify, which does not actually involve the transfer of data.

DESCRIPTION OF 8257 STUDY CARD

 The study card is connected to the 8085 kit through a 50 pin FRC. Before making
connection, check the polarity of the cable.
 The study card consists of one 8257, two toggle switches, debounce switches for
single stepping, transceivers used for asynchronous two way communications
between data buses tags can be connected to VCC or GND and LED’s to display
status.
 The toggle switch (SW1) is for enabling CPU single stepping and another switch
SW2 for DMA single stepping. The PUSH to ON Switch (SW3) is form single
stepping of every instruction. While single stepping with the help of SW3 each
data transfer in an instruction will be displayed on the LED’s (Data Bus).
 Status of LED’s defined 0 as OFF and 1 as ON.
 I/O address range for all the experiments is F4H-F8H.
o Channel 0-F4H
o Channel 1 – F5H
o Channel 2 – F6H
o Channel 3 – F7H
o Channel 4 – F8H

SAMPLE QUATION:
1. Draw and explain block diagram of 8257.
2. Explain different modes of 8257.
3. Write a program to use 8257 in DMA read mode.

Das könnte Ihnen auch gefallen