Sunteți pe pagina 1din 72

DEPARTMENT OF ELECTRONICS &

COMMUNICATION


MICROPROCESSORS
LAB MANUAL



EEC 553
MICROPROCESSOR LAB

1. Write a program using 8085 Microprocessor for Decimal, Hexadecimal
addition and subtraction of two Numbers.

2. Write a program using 8085 Microprocessor for addition and subtraction of
two BCD numbers.

3. To perform multiplication and division of two 8 bit numbers using 8085.

4. To find the largest and smallest number in an array of data using 8085
instruction set.

5. To write a program to arrange an array of data in ascending and descending
order.

6. To convert given Hexadecimal number into its equivalent ASCII number
and vice versa using 8085 instruction set.

7. To write a program to initiate 8251 and to check the transmission and
reception of character.

8. To interface 8253 programmable interval timer to 8085 and verify the
operation of 8253 in six different modes.

9. To interface DAC with 8085 to demonstrate the generation of square,
saw tooth and triangular wave.

10. Serial communication between two 8085 through RS-232 C port.


Note :-In addition, Institutes may include two more experiments based on the
expertise.
TEE 453
MICROPROCESSOR LABORATORY

A. Study Experiments
1 To study 8085 based microprocessor system
2 To study 8086 and 8086A based microprocessor system
3 To study Pentium Processor

B. Programming based Experiments (any four )
4 To develop and run a program for finding out the largest/smallest number from a
given set of numbers.
5 To develop and run a program for arranging in ascending/descending order of a
set of numbers
6 To perform multiplication/division of given numbers
7 To perform conversion of temperature from 0F to 0C and vice-versa
8 To perform computation of square root of a given number
9 To perform floating point mathematical operations (addition, subtraction,
multiplication and division)

C. Interfacing based Experiments (any four)
10 To obtain interfacing of RAM chip to 8085/8086 based system
11 To obtain interfacing of keyboard controller
12 To obtain interfacing of DMA controller
13 To obtain interfacing of PPI
14 To obtain interfacing of UART/USART
15 To perform microprocessor based stepper motor operation through 8085 kit
16 To perform microprocessor based traffic light control
17 To perform microprocessor based temperature control of hot water.
EXPERIMENT NO. 1

KNOW YOUR SYSTEM

1.1BRIEF INTRODUCTION

ET-8085 AD2 is a Microprocessor Training /cum development Kit designs around 8085
processor which is still the most popular in India. 8085 is a very versatile processor and it is easy
for the students to understand its architecture and assembly language programming. In India
8085 processor is still consider the first step for the students to understand the microprocessor
technology.

ET-8085 AD2 has been design to provide ease in interaction with the microprocessor and various
peripheral chips. The processor communicates is with outside world through 58 key keyboards
and liquid crystal displays. The system can also interact with the user through its CRT ternminal
. The system provides 16K/32K bytes of EPROM having the monitor program and 8K bytes
through additional two memory mapping address. The system has 24 I/O through 8255 PPI
expandable to 48 I/O lines. It has three 16 bit timer/counter using 8253. An additional RS 232
interface is provide through 8251 USART chip. 8259 chip provide on board to add 8 levels of
interrupts.

ET 8085 AD2 also provides an interface for EPROM programmer. An interface for A/D
converter. D/A converter, printer, Relay and opto isolated input is also provide on the board to
allow students to experiments and learn about process control.
The Monitor of ET-8085 AD2 is very powerful and provides various software commands like
INSERT, DELETE, BLOCK MOVE, RELOCATE, STRING, FILL, MEMORY COMPARE
Etc.

All address, data and necessary control lines are brought out on 50 PIN FRC connector. The
student can use these lines for interfacing the kit to external hardware through the BUS.

1.2 SYSTEM SPECIFICATIONS (HARDWARE)

CPU : 8 bit microprocessor the 8085
XTAL FREQUENCY : 6.144 MHZ
RAM : 8 Kb with provision for expansion
Battery backup for RAM (optional)
EPROM : 16K/32K bytes of EPROM with the
provision for expansion
MEMORY : Total On board Capacity of 64 K bytes
TIMER : three 16 bits programmable timers
counters using 8253
I/O LINES : 24 I/O lines using 8255 expandable to 48
I/O Lines
INTERRUPTS : 8 Interrupts line through 8259
SERIAL INTERFACE : RS 232 C through SID & SOD Lines Additional
RS 232 C through 8251 USART
SERIAL INTERFACE : 1. A/D converter I/F
2. D/A converter I/F
3. Relay I/F
4. Opto Isolated input I/F
5. Printer I/F
6. Real Time Clock (Optional)

KEYBOARD : 63 Keys ASCII Keyboard
DISPLAY : 20*2 LCD Display
BUS : All Data, address and control signals (TTL)
available at 50 pin FRC conncetor
POWER SUPPLY : (Optional)
REQUIREMENTS : +5V, 1.5 Amp, for the kit & Serial I/F +/-12V for
Aux Serial I/F
OPERATING TEMPRATURE : 0 to 50
0
C

1.3 SYSTEM SPECIFICATIONS (SOFTWARE)

ET-8085 AD2 provides various software commands to achieve the following.

A) KEYBOARD
1. Examine the contents of any memory location
2. Examine/Modify the contents of any of the p internal register
3. Modify the contents of any of the RAM location
4. Move a block of data from one location to another location.
5. Insert one or more instructions in the user program.
6. Delete one or more instructions from the user program
7. Relocate program written for some memory area to some other memory
area.
8. Find out a string of data lying at a particular address.
9. Fill particular memory area with a constant
10. Compare two blocks of memory
11. Insert one or more data bytes in the user program/data area.
12. delete one or more data bytes from the user program/data area
13. Execute a program at full clock speed.
14. Execute a program in single step i.e instructions by instruction.
15. Blank check an EPROM.
16. List an EPROM in the RAM area.
17. program an EPROM
18. verify the EPROM with the kit memory area
19. print the contents of a Block of RAM/EPROM area.
20. Assemble a program from RAM or EPROM area.

B) SERIAL MODE
Most of the commands mentioned above can also be used in serial mode. Please refer to
the chapter 4 for details.

1.4 INTERODUCTION TO HARDWARE

a) GENERAL
The system has got 8085 as the CPU. The clock frequency for the system is 3.07 MHz
and generated from a crystal of 6.144 Mhz.
8085 has got 8 data lines and 16 address lines. The lower 8 address lines and 8 bit data
lines are multiplexed. Since the lower 8 address bits are appear on the bus during the
first clock cycle.it becomes necessaty to latch the lower 8 address bits during the first
clock cycle, So that the 16 bit address remains available in subsequence cycles. This is
achieved using a latch 74-LS-373.
MEMORY
ET-8085 AD2 provides 8K bytes of RAM using 6264 chip and 16K/32K bytes EPROM
for monitor using 27128 or 27257. There are two memory space provided on the board
of ET-8085 AD2 for expansion. These spaces can be defined any address slot from
4000-DFFF depending upon the size of memory chip to be used. The memory space
MEM 2 can be used to define 6264 (8K)/62256 (32K) where as MEM3 can be define to
have 2764/128/256 EPROM.
b) I/O DEVICES
ET-8085 AD2 uses 8279, 8255, 8253, 8251, 8259 peripheral chips The function of each
of these chips is explained below.

i) 8279 (KEYBOARD & DISPLAY CONTROLLER)
8279 is a general purpose programmable keyboard and display I/O interface device
designed for use with 8085 p. It provides a scanned interface for the six seven segment
displays. 8279 has got 168 display RAM which can be loaded or interrogated by the
CPU. When the key is presse, its corresponding code is entered in the FIFO queue of
8279 and can now be read by the microprocessor. 8279 also refreshes the display RAM
automatically.
ii) 8255 (PROGRAMMABLE PERIPHERAL INTERFACE)
It is Programmable Peripheral interface (PPI ) designed to use with 8085 microprocessor.
This This basically act as a general purpose I/O Device to interface with peripheral
devices since the function configuration of 8255 is programmed by the system software.
It has got 3 I/O ports of 8 Lines each, Port C upper and Port C Lower. Any I/P and O/P
combination of Port A, Port B, Port C Upper and Port C lower can be defined using the
appropriate software Commands.
iii) 8253 (PROGRAMMABLE INTERVAL TIMER)
This chip is a programmable interval Timer/Counter and can be used for generation of
accurate time delays under software control. Various other function that can be
implemented with this chip are programmable rate generation, Event counter, Binary rate
Multiplier, Real time clock etc.
iv) 8251 (USART)
This chip is a programmable communication interface and is used as a peripheral device.
This device accept data character from the CPU in Parallel format and then converts them
into serial data characters the CPU. This chip will signal CPU whenever it can accept a
new character for transmission or whenever it ha received qa character for the CPU. The
CPU can read the complete status of it at any time 8251 has been utilized in the kit for
RS-232-C interface nd 20 mA current loop.
v) 8259 (INTERRUPT CONTROLLER)
The 8259 is a device specifically designed for use in real time, interrupt driven
microcomputer system. It manages 8 level of request and has built in features for expand
ability to other 8259 . It is programmed by system software as an I/O peripheral. A
selection of priority modes in which the request are processed by 8259 can be configured
dynamically at any time during the main program.

c) PROCESSS CONTROL CHIPS
ET 8085 AD2 uses ADC 0809, DAC 0800, Relay and MCT2E chip to provide AD
converter, D/A converter, Relay contact and Opto isolated input interface in the kit
respectively
i) ADC 0809 (A TO D CONVERTER)
It is a monolithic CMOS A/D converter having conversion time of about 100 micro sec.
It has eight channels by using the address decoder.ADC0809 users successive
approximation as the conversion techniques.
ii) DAC 0800 (D TO A CONVERTER)
DAC 0800 is monolithic 8 bit high speed current output digital to analog converter
having settling time of 100 nanoseconds. It has a full scale errors of the -1 LSB and can
operate under wide power supply range.

iii) DIP REALY
The DIP RELAY used here to provides two double throw contacts. The realy operates at
+5V supply and is available in DIP package.
d) DISPLAY
ET 8085 AD2 kit provides 20*2 LCD display. The display device as a microcontroller
sitting inside it.
e) BUFFERS
The kit has all the address, data and control lines being buffred and brought on the 50 pin
connector to allow the user to further expand the system.
f) BATTERY BACKUP
An optional battery backup ckt is provided on the board of the kit. The user can select
battery backup for the RAM by a jumper.

















EXPERIMENT NO. 2

KNOW YOUR SYSTEM ET-8086AD

1.1 BRIEF INTRODUCTION

ET-8086 LCD is a single board microprocessor training kit configured around Intels 16 bit
microprocessor 8086. This kit has design to provide brief interaction with the 16 bit micro
processor . The kit communicates with the outside world through a keyboard having an ASCII
Keyboard and LCD display.
The kit is packed with powerful monitor in 64 K Bytes of factory programmed EPROMS
and 32 bytes of Read/Write memory and scratch pad memory . The total memory on the board
can be easily expanded further using the same sockets as the chip of higher capacity can be used.
The system has 48 programmable I/O lines. The serial I/O connection is made possible through
8251.
For control applications, three 16 bit Timer/Counter are available through 8253. For real
time application the 8 levels of interrupts are provide through 8259. The kit provides onboard
battery backup for onboard RAM. This saves the users program in case of power failure.
The kit provides onboard EPROM programmer which enables the user to burn his
program in any of the EPROMS 2764/27128/27256. The onboard resident system monitors
software is very powerful. It provides various software commands like BLOCK, MOVE,
INSERT, DELETE, FILL etc. Which are helpful in debugging/developing software.

The kit also provides on board interface for real time clock chip. The address, data and
control signals are available on the 50 pin FRC Connector for further expansion of the system.
1.2 SYSTEM SPECIFICATIONS (HARDWARE)

CPU bit : 16 bit microprocessor operating in max mode or
8088, 8 bit microprocessor
Co-Processor : 8087 Numeric data processor
I/O : 8089 I/O Processor
EPROM : 64K bytes of EPROM with monitor expandable
to 256 K byte s using 27512
RAM : 32K bytes of CMOS RAM expandable
to 128 K byte s using 62256
I/O LINES : 48 I/O lines expandable to 72 I/O Lines
SERIAL INTERFACE : EIA RS-232-C through 8251
INTERRUPTS : 8 Interrupts line through 8259
Maskable : 1
Non maskable : 8

TIMER/COUNTER : three 16 bits timers/counters using 8253
OTHER INTERFACE : EPROM PROGRAMMER for 64/27128/27256
Real time clock interface
KEYBOARD & DISPLAY : 64 Keys ASCII, 16*2 LCD Display
BUS : All Data, address and control signals are
Available at edge connector as per multi Bus
POWER SUPPLY : 5V, 2.0 Amp for kit and serial operation
OPERATING TEMPRATURE : 0 to 50
0
C
1.3 SYSTEM SPECIFICATIONS (SOFTWARE)
The Kit provides various software commands to achieve the following.
C) KEYBOARD MODE
1. Examine/Modify the memory byte location
2. Write/ Read a byte to to/from the I/O port.
3. Examine/Modify the contents of any internal register of 8086
4. Move a block of data/ Program from one location to another location.
5. Fill particular memory area with a constant
6. Compare a memory blocks with another block
7. Compare a memory blocks with constant
8. Test the RAM area for begin ok.
9. To execute a program in in full clock speed.
10. To execute a program instruction at a time.
11. To execute a program with break point.
12. Check the contents of and EPROM for Blank
13. List the contents of an EPROM into RAM area.
14. verify the contents of an EPROM with the any memory area
15. program/Duplicate an EPROM
16. UP loading a program from the kit to the PC/XT/AT System.
17. DOWN loading a program from the PC/XT/AT to the kit.
18. Assemble a program in the Memory area.
D) SERIAL MODE
1. Display/Modify memory location
2. Display/Modify internal register of 8086
3. Write/ Read a byte to to/from the I/O port.
4. Dump a block of memory data on the screen
5. Move a block of Data/Program from one location to another location
6. Fill a constant byte in memory block
7. Execute the program in full clock speed
8. Execute the program in single instruction mode
9. Execute the program with break point
10. Compare a memory blocks with another block
11. Compare a memory blocks with constant
12. Assemble/Disassemble a program on the screen.
13. To search for a string of byte in a memory block

1.4 INTERODUCTION TO HARDWARE
a) MICROPOROCESSOR
8086 is a 16 bit third generation microprocessor and is suitable for an exceptionally wide
spectrum of microcomputer applications. This flexibility is one of its most outstanding
characteristics.
8086 has got 16 data lines and 20 address lines. The lower 16 address lines are
multiplexed with 16 data lines. Hence it becomes necessary to latch the address lines.
This is done by using 74 LS 373. In fact several of the 40 CPU pins have dual functions
that are selected by a strapping pin. In this kit 8086 is used in the max.
The INTER, TEST & HOLD inputs to 8086 are pulled down and are brought out at PCB
FRC connector.
The maskable interrupt INTR is available to the peripheral circuits through the expansion
Bus. To use the maskable interrupt an interrupt vector pointer must be provided on the
data bus when INTA is active.
b) CO-PROCESSOR 8087
The 8087 o-processor hooks have been designed into the 8086 and 8088 so that this
type of processor can be accommodated in the future. A co-processor differs from an
independent processor in that it obtains its instructions from another processor, called a
host.
c) I/O PROCESSOR
The 8086 and 8088 are designed to be used with the 8089 in high performance I/O
applications. The 8089 in conceptually resemble a microprocessor with two DMA
channels and an instruction set specifically tailored for I/O operations. Unlike simple
DMA controllers, the 8089 can service I/O device directly, removing this task from the
CPU. In addition it can transfer data on its own bus or on the system bus, can match 8 bit
or 16 bit peripherals to 8 bit or 16 bit buses, and can transfer data from memory to
memory and from I/O devices to I/O device. 8089 has been used here in local mode.
d) CLOCK GENERATION
The clock generation circuit is an Intels 8284 clock generator/driver. The circuit
accept a crystal input which operates at a fundamental frequency of 14.7456 MHz.
The clock generator/driver divides the crystal frequency by three to produce the
4.9 Mhz CLK signal required by the CPU. Additionally the clock generator
performs a further divided by two output called PCLK which is the primary clock
signal used by the remainder of the circuits. RST is used to reset the Kit to an
initialized state that occours when the RES input goes low. As will be explained in
the next section, the RDY 1 input is active whenever onboard memory is
addressed.
e) BUS CONTROLLER
The 8288 is a bus controller which decodes status signal output by an 8089, or a
maximum mode 8086 or 8088.When these signals indicate that the processor is to
run a bus cycle as memory read, memory write, I/O read, I/O write , etc. It also
provides a signal that strobes the address into latches. The 8288 provide the drive
level needed for the control lines in medium to large systems.
f) MEMORY
The kit provide 64 KB of EPROM loaded with monitor and 32 KB of CMOS RAM. The
total max onboard memory can be configured in either way.
256 KB of EPROM and 128 KB of RAM
128 KB of EPROM and 128 KB of RAM
The memory address in different selection cases is also given there for the user to easily
understand.
g) I/O DEVICES
1) 8255 (PROGRAMMABLE PERIPHERAL INTERFACE)
It is Programmable Peripheral interface (PPI ) designed to use with 8085 microprocessor.
This This basically act as a general purpose I/O Device to interface with peripheral
devices since the function configuration of 8255 is programmed by the system software.
It has got 3 I/O ports of 8 Lines each, Port C upper and Port C Lower. Any I/P and O/P
combination of Port A, Port B, Port C Upper and Port C lower can be defined using the
appropriate software Commands.
2) 8253 (PROGRAMMABLE INTERVAL TIMER)
This chip is a programmable interval Timer/Counter and can be used for generation of
accurate time delays under software control. Various other function that can be
implemented with this chip are programmable rate generation, Event counter, Binary rate
Multiplier, Real time clock etc.
3) 8251 (USART)
This chip is a programmable communication interface and is used as a peripheral device.
This device accept data character from the CPU in Parallel format and then converts them
into serial data characters the CPU. This chip will signal CPU whenever it can accept a
new character for transmission or whenever it ha received qa character for the CPU. The
CPU can read the complete status of it at any time 8251 has been utilized in the kit for
RS-232-C interface nd 20 mA current loop.
4) 8259 (INTERRUPT CONTROLLER)
The 8259 is a device specifically designed for use in real time, interrupt driven
microcomputer system. It manages 8 level of request and has built in features for expand
ability to other 8259 . It is programmed by system software as an I/O peripheral. A
selection of priority modes in which the request are processed by 8259 can be configured
dynamically at any time during the main program.
5) 58167 (REAL TIME CLOCK CHIP)
The kit provide on board RTC chip which can be used to run the real time clock on the
board. The students can understand the function of the real time clock. The other details
of the RTC are given in Annexure.
h) DISPLAY
The kit provides 16*2 characters LCD display. The user can therefore directly
work on the alphanumeric mode. Each line of the display has an address, which
can be used by the user to the display the data on the display. Some of the sample
programs given. The kit also has provision for adding 20*2 LCD display instead
of standard 16*2 LCD display instead of standard 16*2 display.
i) INTERFACE
RS 232 C interfacing through 8251 (USART)
EPROM Programmer interface for 2764/27128/27256
Real time Clock chip interface
Cassette interface (optional)


EXPERIMENT NO. 3

BCD ADDITION

AIM: To add two 8 bit BCD numbers stored at consecutive memory locations.

ALGORITHM:

1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and add it to the accumulator
4. Adjust the accumulator value to the proper BCD value using DAA instruction.
5. Store the answer at another memory location.

RESULT:

Thus the 8 bit BCD numbers stored at 4500 &4501 are added and the result stored at 4502 &
4503.

PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
4100 START MVI C, 00 Clear C reg.
4101
4102 LXI H, 4500 Initialize HL reg. to
4500 4103
4104
4105 MOV A, M Transfer first data to
accumulator
4106 INX H Increment HL reg. to point
next memory Location.
4107 ADD M Add first number to acc.
Content.
4108 DAA Decimal adjust accumulator
4109 JNC L1 Jump to location if result
does not yield carry. 410A
410B
410C INR C Increment C reg.
410D L1 INX H Increment HL reg. to point
next memory Location.
410E MOV M, A Transfer the result from acc.
to memory.
410F INX H Increment HL reg. to point
next memory Location.
4110 MOV M, C Move carry to memory
4111 HLT Stop the program

OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
FLOW CHART:



















NO


YES
























START
[HL] 4500H
[A] [M]
[A] [A]+[M]
Decimal Adjust Accumulator

[HL] [HL]+1
STOP
[HL] [HL]+1
[M] [A]
[C] 00H
[M] [C]
[HL] [HL]+1
Is there a
Carry ?
[C] [C]+1
EXPERIMENT NO. 4
BCD SUBTRACTION
AIM: To Subtract two 8 bit BCD numbers stored at consecutive memory locations.
ALGORITHM:
1. Load the minuend and subtrahend in two registers.
2. Initialize Borrow register to 0.
3. Take the 100s complement of the subtrahend.
4. Add the result with the minuend which yields the result.
5. Adjust the accumulator value to the proper BCD value using DAA instruction. If
there is a carry ignore it.
6. If there is no carry, increment the carry register by 1
7. Store the content of the accumulator (result)and borrow register in the specified
memory location
PROGRAM:
ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
4100 START MVI D, 00 Clear D reg.
4101
4102 LXI H, 4500 Initialize HL reg. to
4500 4103
4104
4105 MOV B, M Transfer first data to
accumulator
4106 INX H Increment HL reg. to point
next mem. Location.
4107 MOV C, M Move second no. to B reg.
4108 MVI A, 99 Move 99 to the Accumulator
4109
410A SUB C Subtract [C] from acc.
Content.
410B INR A Increment A register
410C ADD B Add [B] with [A]
410D DAA Adjust Accumulator value for
Decimal digits
410E JC LOOP Jump on carry to loop
410F
4110
4111 INR D Increment D reg.
4112 LOOP INX H Increment HL register pair
4113 MOV M , A Move the Acc.content to the
memory location
4114 INX H Increment HL reg. to point
next mem. Location.
4115 MOV M, D Transfer D register content to
memory.
4116 HLT Stop the program

OBSERVATION:
INPUT OUTPUT
4500 4502
4501 4503
RESULT:

Thus the 8 bit BCD numbers stored at 4500 &4501 are subtracted and the result stored at 4502 &
4503.




















FLOW CHART:





















YES


NO





















START
HL HL+ 1
C M
A 99

[A] [A] [C]
[A] [A]+1
Is there a
Carry ?
[A] [A]+[B]
DAA
[D] 00H
HL 4500
B M
STOP
[D] [D]+1
[4502] A
[4503] D
[HL] [HL]+1
EXPERIMENT NO. 5
8 BIT DATA ADDITION

AIM: To add two 8 bit numbers stored at consecutive memory locations.

ALGORITHM:

1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and add it to the accumulator.
4. Store the answer at another memory location.

PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
4100 START MVI C, 00 Clear C reg.
4102
4102 LXI H, 4500 Initialize HL reg. to
4500 4103
4104
4105 MOV A, M Transfer first data to
accumulator
4106 INX H Increment HL reg. to
point next memory
Location.
4107 ADD M Add first number to
acc. Content.
4108 JNC L1 Jump to location if
result does not yield
carry.
4109
410A
410B INR C Increment C reg.
410C L1 INX H Increment HL reg. to
point next memory
Location.
410D MOV M, A Transfer the result from
acc. to memory.
410E INX H Increment HL reg. to
point next memory
Location.
410F MOV M, C Move carry to memory
4110 HLT Stop the program










OBSERVATION:

INPUT OUTPUT
4500 4502
4501 4503




RESULT:

Thus the 8 bit numbers stored at 4500 &4501 are added and the result stored at 4502 & 4503.


FLOW CHART:










NO


YES


























START
[HL] 4500H
[A]

[M]
[A] [A]+[M]
[HL] [HL]+1
STOP
[HL] [HL]+1
[M] [A]
[C] 00H
[M] [C]
[HL] [HL]+1
Is there a
Carry ?
[C] [C]+1
EXPERIMENT NO. 6
8 BIT DATA SUBTRACTION

AIM: To Subtract two 8 bit numbers stored at consecutive memory locations.

ALGORITHM:

1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and subtract from the accumulator.
4. If the result yields a borrow, the content of the acc. is complemented and 01H is added to
it (2s complement). A register is cleared and the content of that reg. is incremented in
case there is a borrow. If there is no borrow the content of the acc. is directly taken as the
result.
5. Store the answer at next memory location.

PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
4100 START MVI C, 00 Clear C reg.
4101
4102 LXI H, 4500 Initialize HL reg. to
4500 4103
4104
4105 MOV A, M Transfer first data to
accumulator
4106 INX H Increment HL reg. to
point next mem.
Location.
4107 SUB M Subtract first number
from acc. Content.
4108 JNC L1 Jump to location if
result does not yield
borrow.
4109
410A
410B INR C Increment C reg.
410C CMA Complement the Acc.
content
410D ADI 01H Add 01H to content of
acc. 410E
410F L1 INX H Increment HL reg. to
point next mem.
Location.
4110 MOV M, A Transfer the result from
acc. to memory.
4111 INX H Increment HL reg. to
point next mem.
Location.
4112 MOV M, C Move carry to mem.
4113 HLT Stop the program

OBSERVATION:


INPUT OUTPUT
4500 4502
4501 4503



RESULT:

Thus the 8 bit numbers stored at 4500 &4501 are subtracted and the result stored at 4502 &
4503.

FLOW CHART:





















NO


YES





















START
[HL] 4500H
[A]

[M]
Is there a
Borrow ?
[A] [A]-[M]
[HL] [HL]+1
[C] 00H
[C] [C]+1
STOP
[HL] [HL]+1
[M] [A]
[M] [C]
[HL] [HL]+1
Complement [A]
Add 01H to [A]

EXPERIMENT NO. 7
8 BIT DATA MULTIPLICATION

AIM: To multiply two 8 bit numbers stored at consecutive memory locations and store the
result in memory.

ALGORITHM:

LOGIC: Multiplication can be done by repeated addition.

1. Initialize memory pointer to data location.
2. Move multiplicand to a register.
3. Move the multiplier to another register.
4. Clear the accumulator.
5. Add multiplicand to accumulator
6. Decrement multiplier
7. Repeat step 5 till multiplier comes to zero.
8. The result, which is in the accumulator, is stored in a memory location.

PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
4100 START LXI H, 4500 Initialize HL reg. to
4500

Transfer first data to
reg. B
4101
4102
4103 MOV B, M
4104 INX H Increment HL reg. to
point next mem.
Location.
4105 MVI A, 00H Clear the acc.
4106
4107 MVI C, 00H Clear C reg for carry


4108
4109 L1 ADD M Add multiplicand
multiplier times.
410A JNC NEXT Jump to NEXT if there
is no carry
410B
410C
410D INR C Increment C reg
410E NEXT DCR B Decrement B reg
410F JNZ L1 Jump to L1 if B is not
zero. 4110
4111
4112 INX H Increment HL reg. to
point next mem.
Location.
4113 MOV M, A Transfer the result from
acc. to memory.
4114 INX H Increment HL reg. to
point next mem.
Location.
4115 MOV M, C Transfer the result from
C reg. to memory.
4116 HLT Stop the program




OBSERVATION:


INPUT OUTPUT
4500 4502
4501 4503


RESULT:

Thus the 8-bit multiplication was done in 8085p using repeated addition method.




FLOW CHART:


























NO



YES







NO


YES




[HL] 4500
B M

A 00

C 00

Is there
any carry

C C+1
B B-1
[A] [A] +[M]
[HL] [HL]+1
IS B=0
A
START



















A
STOP
[HL]

[HL]+1
[M]

[A]
[M]

[C]
[HL]

[HL]+1
EXPERIMENT NO. 8
8 BIT DIVISION

AIM: To divide two 8-bit numbers and store the result in memory.

ALGORITHM:

LOGIC: Division is done using the method Repeated subtraction.
1. Load Divisor and Dividend
2. Subtract divisor from dividend
3. Count the number of times of subtraction which equals the quotient
4. Stop subtraction when the dividend is less than the divisor .The dividend now becomes
the remainder. Otherwise go to step 2.
5. stop the program execution.


PROGRAM:

ADDRESS OPCODE LABEL MNEMO
NICS
OPERA
ND
COMMENTS
4100 MVI B,00 Clear B reg for quotient
4101
4102 LXI H,4500 Initialize HL reg. to
4500H 4103
4104
4105 MOV A,M Transfer dividend to acc.
4106 INX H Increment HL reg. to point
next mem. Location.
4107 LOOP SUB M Subtract divisor from dividend
4108 INR B Increment B reg
4109 JNC LOOP Jump to LOOP if result does
not yield borrow 410A
410B
410C ADD M Add divisor to acc.
410D DCR B Decrement B reg
410E INX H Increment HL reg. to point
next mem. Location.
410F MOV M,A Transfer the remainder from
acc. to memory.
4110 INX H Increment HL reg. to point
next mem. Location.
4111 MOV M,B Transfer the quotient from B
reg. to memory.
4112 HLT Stop the program


OBSERVATION:


S.NO INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
1 4500 4502
4501 4503
2 4500 4502
4501 4503




RESULT:

Thus an ALP was written for 8-bit division using repeated subtraction method and
executed using 8085 p kits




FLOWCHART:






















NO

YES





















B 00
M A-M
[B] [B] +1
IS A<0

A A+ M
B B-1
[HL] 4500
A M

[HL] [HL]+1
START
STOP
[HL] [HL]+1
[M] [A]
[M] [B]
[HL] [HL]+1
EXPERIMENT NO. 9
LARGEST ELEMENT IN AN ARRAY

AIM: To find the largest element in an array.
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next element).
7. If the accumulator content is smaller, then move the memory content
(largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.

PROGRAM:

ADDRE
SS
OPCO
DE
LABEL MNEM
ONICS
OPER
AND
COMMENTS
8001 LXI H,8100 Initialize HL reg. to
8100H 8002
8003
8004 MVI B,04 Initialize B reg with no. of
comparisons(n-1) 8005
8006 MOV A,M Transfer first data to acc.
8007 LOOP1 INX H Increment HL reg. to point
next memory location
8008 CMP M Compare M & A
8009 JNC LOOP If A is greater than M then go
to loop 800A
800B
800C MOV A,M Transfer data from M to A reg
800D LOOP DCR B Decrement B reg
800E JNZ LOOP1 If B is not Zero go to loop1
800F
8010
8011 STA 8105 Store the result in a memory
location. 8012
8013
8014 HLT Stop the program

OBSERVATION:

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8105
8101
8102
8103
8104

RESULT:
Thus the largest number in the given array is found out.
FLOW CHART:
















NO


YES








NO


YES










[B] 04H
[HL] [8100H]
[A] [HL]
[HL [HL] + 1
IS
[A] < [HL]?
[A] [HL]
[8105] [A]
START
[B] [B]-1
IS
[B] = 0?
STOP
EXPERIMENT NO. 10
SMALLEST ELEMENT IN AN ARRAY

AIM: To find the smallest element in an array.
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content (next element).
7. If the accumulator content is smaller, then move the memory content (largest element) to
the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.

RESULT:
Thus the smallest number in the given array is found out.




PROGRAM:

ADDRE
SS
OPCO
DE
LABEL MNEM
ONICS
OPER
AND
COMMENTS
8001 LXI H,8100 Initialize HL reg. to
8100H 8002
8003
8004 MVI B,04 Initialize B reg with no. of
comparisons(n-1) 8005
8006 MOV A,M Transfer first data to acc.
8007 LOOP1 INX H Increment HL reg. to point
next memory location
8008 CMP M Compare M & A
8009 JC LOOP If A is lesser than M then go
to loop 800A
800B
800C MOV A,M Transfer data from M to A reg
800D LOOP DCR B Decrement B reg
800E JNZ LOOP1 If B is not Zero go to loop1
800F
8010
8011 STA 8105 Store the result in a memory
location. 8012
8013
8014 HLT Stop the program


OBSERVATION:

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8100 8105
8101
8102
8103
8104


FLOW CHART:
















YES


NO








NO


YES














[B] 04H
[HL] [8100H]
[A] [HL]
[HL [HL] + 1
IS
[A] < [HL]?
[A] [HL]
[8105] [A]
START
[B] [B]-1
IS
[B] = 0?
STOP
EXPERIMENT NO. 11
ASCENDING ORDER

AIM: To sort the given number in the ascending order using 8085 microprocessor.

ALGORITHM:
1. Get the numbers to be sorted from the memory locations.
2. Compare the first two numbers and if the first number is larger than second then I
interchange the number.
3. If the first number is smaller, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order

PROGRAM:

ADDR
E
SS
OPCO
DE
LABEL MNEM
ONICS
OPER
AND
COMMENTS
8000 MVI B,04 Initialize B reg with number
of comparisons (n-1) 8001
8002 LOOP 3 LXI H,8100 Initialize HL reg. to
8100H 8003
8004
8005 MVI C,04 Initialize C reg with no. of
comparisons(n-1) 8006
8007 LOOP2 MOV A,M Transfer first data to acc.
8008 INX H Increment HL reg. to point
next memory location
8009 CMP M Compare M & A
800A JC LOOP1 If A is less than M then go to
loop1 800B
800C
800D MOV D,M Transfer data from M to D reg
800E MOV M,A Transfer data from acc to M
800F DCX H Decrement HL pair
8010 MOV M,D Transfer data from D to M
8011 INX H Increment HL pair
8012 LOOP1 DCR C Decrement C reg
8013 JNZ LOOP2 If C is not zero go to loop2
8014
8015
8016 DCR B Decrement B reg
8017 JNZ LOOP3 If B is not Zero go to loop3
8018
8019
801A HLT Stop the program


OBSERVATION:

INPUT OUTPUT
MEMORY
LOCATION
DATA MEMORY
LOCATION
DATA
8100 8100
8101 8101
8102 8102
8103 8103
8104 8104



RESULT:

Thus the ascending order program is executed and thus the numbers are arranged in
ascending order.

FLOWCHART:


















YES


NO
























[B] 04H
[HL] [8100H]
[A] [HL]
[HL [HL] + 1
IS
[A] < [HL]?
[D] [HL]
[HL] [A]
[HL] [HL] - 1
[HL] [D]
[HL] [HL] + 1
[C] [C] 01 H
A
[C] 04H
START









NO


YES





NO


YES





IS
[C] = 0?
A
[B] [B]-1
IS
[B] = 0?
STOP
EXPERIMENT NO. 12
DESCENDING ORDER

AIM: To sort the given number in the descending order using 8085 microprocessor.

ALGORITHM:

1. Get the numbers to be sorted from the memory locations.
2. Compare the first two numbers and if the first number is smaller than second then I
interchange the number.
3. If the first number is larger, go to step 4
4. Repeat steps 2 and 3 until the numbers are in required order

PROGRAM:

ADDRE
SS
OPCO
DE
LABEL MNEM
ONICS
OPER
AND
COMMENTS
8000 MVI B,04 Initialize B reg with number
of comparisons (n-1) 8001
8002 LOOP 3 LXI H,8100 Initialize HL reg. to
8100H 8003
8004
8005 MVI C,04 Initialize C reg with no. of
comparisons(n-1) 8006
8007 LOOP2 MOV A,M Transfer first data to acc.
8008 INX H Increment HL reg. to point
next memory location
8009 CMP M Compare M & A
800A JNC LOOP1 If A is greater than M then go
to loop1 800B
800C
800D MOV D,M Transfer data from M to D reg
800E MOV M,A Transfer data from acc to M
800F DCX H Decrement HL pair
8010 MOV M,D Transfer data from D to M
8011 INX H Increment HL pair
8012 LOOP1 DCR C Decrement C reg
8013 JNZ LOOP2 If C is not zero go to loop2
8014
8015
8016 DCR B Decrement B reg
8017 JNZ LOOP3 If B is not Zero go to loop3
8018
8019
801A HLT Stop the program






OBSERVATION:

INPUT OUTPUT
MEMORY
LOCATION
DATA MEMORY
LOCATION
DATA
8100 8100
8101 8101
8102 8102
8103 8103
8104 8104



RESULT:

Thus the descending order program is executed and thus the numbers are arranged in
descending order.




FLOWCHART:


















NO


YES























[B] 04H
[HL] [8100H]
[A] [HL]
[HL [HL] + 1
IS
[A] < [HL]?
[D] [HL]
[HL] [A]
[HL] [HL] - 1
[HL] [D]
[HL] [HL] + 1
[C] [C] 01 H
A
[C] 04H
START










NO


YES





NO


YES







IS
[C] = 0?
A
[B] [B]-1
IS
[B] = 0?
STOP
EXPERIMENT NO. 13
CODE CONVERSION ASCII TO HEX

AIM:

To convert given ASCII number into Hexadecimal number using 8085
instruction set.

ALGORITHM:
1. Load the given data in A register.
2. Subtract 30H from A register.
3. Compare the content of A register with 0AH.
4. If A<0AH, jump to step 6, else proceed to next step.
5. Subtract 07H from A register.
6. Store the result
7. Terminate the program



PROGRAM:


LDA 4500
SUI 30
CPT 0A
JC SKIP
SUI 07
SKIP STA 4501
HLT




OBSERVATION:

Thus the given ASCII character was converted into its equivalent Hex value.


EXPERIMENT NO. 14
16 BIT DATA ADDITION

AIM: To add two 16-bit numbers stored at consecutive memory locations.

ALGORITHM:

1. Initialize memory pointer to data location.
2. Get the first number from memory and store in Register pair.
3. Get the second number in memory and add it to the Register pair.
4. Store the sum & carry in separate memory locations.


PROGRAM:

ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT
8000 START LHLD 8050H Load the augend in DE
pair through HL pair. 8001
8002
8003 XCHG
8004 LHLD 8052H Load the addend in HL
pair. 8005
8006
8007 MVI A, 00H Initialize reg. A for
carry 8008
8009 DAD D Add the contents of HL
Pair with that of DE
pair.
800A JNC LOOP If there is no carry, go
to the instruction
labeled LOOP.
800B
800C
800D INR A Otherwise increment
reg. A
800E LOOP SHLD 8054H Store the content of HL
Pair in 8054H(LSB of
sum)
800F
8010
8011 STA 8056H Store the carry in
8056H through Acc.
(MSB of sum).
8012
8013
8014 HLT Stop the program.




5. OBSERVATION:


INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050H 8054H
8051H 8055H
8052H 8056H
8053H




RESULT:

Thus an ALP program for 16-bit addition was written and executed in 8085p using
special instructions.
















FLOW CHART:





















NO



YES





















START
[DE] [HL]
[L] [8052H]
[H] [8053H]

[A] 00H
[HL] [HL]+[DE]
[L] [8050 H]
[H] [8051 H]
Is there a
Carry?
STOP
[8054] [ L]
[8055] [H]
[A] [A]+1
[8056] [A]
EXPERIMENT NO. 15
16 BIT DATA SUBTRACTION

AIM: To subtract two 16-bit numbers stored at consecutive memory locations.

ALGORITHM:

1. Initialize memory pointer to data location.
2. Get the subtrahend from memory and transfer it to register pair.
3. Get the minuend from memory and store it in another register pair.
4. Subtract subtrahend from minuend.
5. Store the difference and borrow in different memory locations.

PROGRAM:
ADDRESS OPCODE LABEL MNEMO
NICS
OPER
AND
COMMENTS
8000 START MVI C, 00 Initialize C reg.
8001
8002 LHLD 8050H Load the subtrahend in DE
reg. Pair through HL reg.
pair.
8003
8004
8005 XCHG
8006 LHLD 8052H Load the minuend in HL reg.
Pair. 8007
8008
8009 MOV A, L Move the content of reg. L to
Acc.
800A SUB E Subtract the content of reg.
E from that of acc.
800B MOV L, A Move the content of Acc. to
reg. L
800C MOV A, H Move the content of reg. H
to Acc.
800D SBB D Subtract content of reg. D
with that of Acc.
800E MOV H, A Transfer content of acc. to
reg. H
800F SHLD 8054H Store the content of HL pair
in memory location 8504H. 8010
8011
8012 JNC NEXT If there is borrow, go to the
instruction labeled NEXT. 8013
8014
8015 INR C Increment reg. C
8016 NEXT MOV A, C Transfer the content of reg. C
to Acc.
8017 STA 8056H Store the content of acc. to
the memory location 8506H 8018
8019
801A HLT Stop the program execution.






OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050H 8054H
8051H 8055H
8052H 8056H
8053H






RESULT:

Thus an ALP program for subtracting two 16-bit numbers was written and executed.






















FLOW CHART:



















NO


YES


















START
[DE] [HL]
[L] [8052H]
[H] [8053H]

[HL] [HL]-[DE]
[L] [8050 H]
[H] [8051 H]
Is there a
borrow?
STOP
[8054] [ L]
[8055] [H]
[C] [C]+1
[8056] [C]
EXPERIMENT NO. 16
16 BIT MULTIPLICATION
AIM: To multiply two 16 bit numbers and store the result in memory.

ALGORITHM:
1. Get the multiplier and multiplicand.
2. Initialize a register to store partial product.
3. Add multiplicand, multiplier times.
4. Store the result in consecutive memory locations.

PROGRAMM:
ADDRESS OPCODE LABEL MNEMO
NICS
OPERAND COMMENTS
8000
START LHLD 8050 Load the first No. in stack pointer
through HL reg. pair
8001

8002
8003 SPHL
8004 LHLD 8052 Load the second No. in HL reg. pair
& Exchange with DE reg. pair.
8005
8006
8007 XCHG
8008 LXI H, 0000H

Clear HL & DE reg. pairs.
8009
800A
800B LXI B, 0000H
800C
800D
800E LOOP DAD SP Add SP with HL pair.
800F JNC NEXT If there is no carry, go to the
instruction labeled NEXT
8010

OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050 8054
8051 8055
8052 8056
8053 8057

RESULT:

Thus the 16-bit multiplication was done in 8085p using repeated addition method.
8011
8012 INX B Increment BC reg. pair
8013 NEXT DCX D Decrement DE reg. pair.
8014 MOV A,E Move the content of reg. E to Acc.
8015 ORA D OR Acc. with D reg.
8016 JNZ LOOP If there is no zero, go to instruction
labeled LOOP
8017
8018
8019 SHLD 8054 Store the content of HL pair in
memory locations 8054 & 8055.
801A
801B
801C MOV A, C Move the content of reg. C to Acc.
801D STA 8056 Store the content of Acc. in
memory location 8056.
801E
801F
8020 MOV A, B Move the content of reg. B to Acc.
8021 STA 8057 Store the content of Acc. in
memory location 8056.
8022
8023
8024 HLT Stop program execution
FLOWCHART:












NO



YES








NO

START
L [8050]
H

[8051]
L

[8052]
H

[8053]
SP

HL
DE HL
HL

0000
BC

0000
HL

HL+SP
Is Carry
flag set?
BC

BC+1
DE

DE+1
Is Zero flag set?
A

YES













A
[8054] L
[8055] H
[8056] C
[8057] B
STOP
EXPERIMENT NO. 17
16- BIT DIVISION

AIM: To divide two 16-bit numbers and store the result in memory using 8085 mnemonics.

ALGORITHM:
1. Get the dividend and divisor.
2. Initialize the register for quotient.
3. Repeatedly subtract divisor from dividend till dividend becomes less than divisor.
4. Count the number of subtraction which equals the quotient.
5. Store the result in memory.

PROGRAM:
ADDRESS OPCODE LABEL MNEM
ONICS
OPERA
ND
COMMENTS
8000 START LHLD 8052
Load the first No. in stack pointer
through HL reg. pair
8001
8002
8003 XCHG
8004 LHLD 8050
Load the second No. in HL reg. pair
& Exchange with DE reg. pair.
8005
8006
8007 LXI B, 0000H

Clear BC reg. pair.
8008
8009
800A LOOP MOV A, L
Move the content of reg. L to Acc.
800B SUB E
Subtract reg. E from that of Acc.
800C MOV L, A
Move the content of Acc to L.
800D MOV A, H
Move the content of reg. H Acc.
800E SBB D Subtract reg. D from that of Acc.
800F MOV H, A Move the content of Acc to H.
8010 INX B Increment reg. Pair BC
8011 JNC LOOP If there is no carry, go to the location
labeled LOOP. 8012
8013
8014 DCX B Decrement BC reg. pair.
8015 DAD D Add content of HL and DE reg. pairs.
8016 SHLD 8054 Store the content of HL pair in 8054 &
8055. 8017
8018
8019 MOV A, C Move the content of reg. C to Acc.
801A STA 8056 Store the content of Acc. in memory
8056 801B
801C
801D MOV A, B Move the content of reg. B to Acc.
801E STA 8057 Store the content of Acc. in memory
8057. 801F
8020
8021 HLT Stop the program execution.



OBSERVATION:

INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
8050 8054
8051 8055
8052 8056
8053 8057




RESULT:

Thus the 16-bit Division was done in 8085p using repeated subtraction method.




FLOWCHART:




































NO



YES
START
L [8051]
H

[8052]
HL DE
L

[8050]
H

[8051]

BC

0000H
A L; A

A- E
L

A
A

H
A

A- H- Borrow
H

A
BC

BC+ 1
Is Carry
flag set ?
A





















A
BC

BC- 1
HL

HL+DE
L

[8054]
H

[8055]
A

C
[8056]

A

A

B
[8057]

A

STOP
EXPERIMENT NO.18
SQUARE ROOT

AIM : To find the square root of given number using 8085 Microprocessor.

APPARATUS: 8085 Microprocessor kit, power supply.

2 /
2
2
2
2
2
2 2
2
(

+ =
+
=
+ =
=
X
X
N
X
X
X N
X
X N X
N X


ADDRESS LABEL MNEMONICS MACHINE
CODE
COMMENT
OPCODE OPERAND
2600 H MVI A,X 3E,X
2602H BACK MOV D,A 57
2603 H LHLD 2500 2A,00,25
2606 H CALL 2406 CD,06,24
2609 H MOV A,D 7A
260A H ADD L 85
260B H MOV L,A 6F
260C H MVI H,00 26,00
260E H MVI A,02 3E,02
2610 H CALL 2406 CD,06,24
2613 H MOV A,L 7D
2614 H CMP D BA
2615 H JZ BELOW CA,1B,26
2618 H JMP BACK C3,02,26
RST 5 EF
END

SUBROUTINE:

ADDRESS LABEL MNEMONICS MACHINE
CODE
COMMENT
OPCODE OPERAND
2406 MOV C,A 4F
2407 MVI B,08 06,08
2409 DIV DAD H 29
240A MOV A,H 7C
240B SUB C 91
240C JC AHEAD DA,11,24
240F MOV H,A 67
2410 INR L 2C
2411 AHEAD DCR B 05
2412 JNZ DIV C2,09,24
2415 SHLD 2503 22,03,25
2418 RET C9





INPUT DATA:

ADDRESS DATA
2500 H 10 H
2501 00



RESULT : The square root of a given number will provide at memory location 2550 H

ADDRESS DATA
2550 H 04 H


EXPERIMENT NO. 19
8 BIT MULTIPLICATION

AIM :
To perform multiplication of given numbers using 8086 Microprocessor.

APPARATUS: 8086 Microprocessor kit, power supply, Key Board

ADDRESS LABEL MNEMONICS COMMENT
OPCODE OPERAND
1000:0200
H
START MOV SI ,1300 Memory location 1300 H
addressed by SI
1000:0203 H MOV AX , [SI] Move contents of memory
location to AX addressed by
SI
1000:0205 H MOC CL , [SI+01] Move contents of memory
location to CL addressed by
SI +01
1000:0207 H MUL CL Multiply CL with AL
1000:0208 H MOV [SI+2 ] ,AX Move the contents of AX to
[SI + 02]
1000:0209 H INT A5

DATA
Memory
Location
Data
0000:1300
H
84 H
0000:1301
H
56 H


RESULT
The Multiplier at memory location 0000:1300 H is multiplied with multiplicant
stored at memory location 0000:1301 H and result is stored at memory location 0000:1302 H
and 0000:1303 H
ADDRESS Data
0000:1302
H
58 H
0000:1303
H
2C
H







FLOW CHART



























Get the multiplier in AX
Get the multiplicant in CL

Multiply numbers
Store the result.
STOP
Start
EXPERIMENT NO. 20

16 BIT MULTIPLICATION IN 8086

AIM: To Multiply two numbers each 16 bit long, stored in four consecutive memory locations
using 8086 microprocessor.

APPARATUS : 8086 Microprocessor kit, power supply, Key Board

DATA:
MEMORY
LOCATION
DATA
0000:1300 73
0000:1301 92
0000:1302 35
0000:1303 48


RESULT :
The 16 bit multiplier stored at memory location [SI]and [SI+01] is multiplied with
16 bit multiplicand stored at memory location [SI+02] and [SI+03] and the 32 bit result is stored
at four consecutive memory location from [SI+04].

MEMORY
LOCATION
DATA
0000:1304 CF
0000:1305 A9
0000:1306 4E
0000:1307 29
ADDRESS MNEMONICS COMMENT
1000:0200 MOV SI,1300 Memory location 1300 addressed by SI
1000:0203 MOV AX,[SI] Move the content of memory location addressed
by [SI] and [SI+01] to the accumulator
1000:0205 MOV BX,[SI+02] Move the content of memory location addressed
by [SI +02] and [SI+03]
1000:0207 MUL BX Multiply the content of BX with AX
1000:0208 MOV [SI+04],AX Store MSB of theresult at memory location
[SI+04]
1000:020A MOV [SI+06],DX Store LSB of the result at memory location
[SI+06]
1000:020C INT A5
EXPERIMENT NO. 21
DMA CONTROLLER

AIM: To obtain interfacing of DMA controller.

APPARATUS USED: Microprocessor kit, 8257 DMA Controller study Card, connector
& Power supply

SETUP FOR THE EXPERIMENT

STEP 1: Connect 50 pin FRC connector from interface card to 8085 Microprocessor kits.

STEP 2: Connect +5V and GND through power supply to the kit. Switch ON the Supply
.and press RESET

STEP 3: Enter the program given below by using EXMEM, NEXT keys.

STEP 4: Execute the program using <GO>, <.>, keys.

STEP 5: Execute the program and observe the result on the LEDs

PROGRAM:

ADDRESS OPERAND MACHINE
CODE
COMMENTS
2000 MVI A, 41 3E 41 Send mode word to word register, enable
channel 0, enable TC stop
2002 OUT 58 D3 58
2004 MVI A, 0F 3E 0F Send low order byte count to count register
2006 OUT 51 D3 51
2008 MVI A, 40 3E 40 Send high Byte count to register
200A OUT 51 D3 51
200C MVI A, 60 3E 60 Send low order byte address of the memory
200E OUT 50 D3 50
2010 MVI A, 00 3E 00 Send low byte address of the memory
2012 OUT 50 D3 50
2014 RST 5 EF


EXPERIMENT NO. 22
INTERFACING OF PPI

AIM:To obtain interfacing of PPI.

APPARATUS : 8085 Microprocessor kit, power supply, 8255 (PPI) study card and connector.



STEP 1 : Connect the card to the kit through 50 pin cable.Ensure that the pin-1 of the card is
connected to pin-1 of the kit bus controller.

STEP 2 : Connect +5V and GND to the kit and switch on supply.Press Reset.

STEP 3 : Enter the program given below using EXMEM command.

STEP 4 : Execute the program using <GO> command.

STEP 5 : Observe the result on LEDs as explained below.



PROGRAM:

ADDRESS OPCODES MNEMONICS COMMENT OBSERVATION
2000 H 3E,80 MVI A,80 H Configure A,B,C port
as output

2002 H D3 43 OUT 43 Observe 80 on D0 to
D7 LEDs
2004 H 3E,AA MVI 1,AA H
2006 H D3,40 OUT 40 Out AA on port A Observe AA on A0 to
A7 LEDs
2008 H D3,41 OUT 41 Out AA on port B Observe AA ON B0
to B7 LEDs
200A H D3,42 OUT 42 Out AA on port B Observe AA ON C0
to C7 LEDs
200C H CD,20,20 CALL 2020 Call Delay
200F H 3E,55 MVI A,55
20011H D3,40 OUT 40 Out 55 on port A Observe 55 on A0 to
A7 LEDs
2013 H D3,41 OUT 41 Out 55 on port B Observe 55ON B0 to
B7 LEDs
2015 H D3,42 OUT 42 Out 55on port B Observe 55 ON C0 to
C7 LEDs
2017 H CD,20,20 CALL 2020 Call Delay
201A H C3,04,20 JMP 2004
201B H EF RST 5


ADDRESS OPCODES MNEMONICS COMMENT OBSERVATION
2020 H 11,00,00 LXI D,00,00 DELAY ROUTINE
2023 H CD,BC,03 CALL 03,BC
2026 H C9 RET


RESULT : The 8255 (PPI) interfaced with 8085 and result is observed using LEDs
connected at ports.


CKT DIAGRAM








ALE

AD7-AD0






IO/M

WR

RD

RESET OUT
A7
A6
A5



A4

A3

A2
A1
A0


D7-D0
PA


RD

WR PB




RESET
PC









CS
G
2
B G
2
B G
1



C
B
A
G
2
B G
2
B G
1


LE
Latch
74373
8
0
8
5
C
B
A
8
2
5
5
EXPERIMENT NO. 23
INTERFACING 8253 TIMER WITH 8085
Interfacing 8253 Programmable Interval Timer with 8085 p

AIM: To interface 8253 Interface board to 8085 p and verify the operation of 8253in six
different modes.

APPARATUS REQUIRED:
8085 p kit, 8253 Interface board, DC regulated power supply, VXT parallel bus, CRO.

Mode 0 Interrupt on terminal count:
The output will be initially low after mode set operations. After loading the counter, the output
will be remaining low while counting and on terminal count; the output will become high, until
reloaded again.

Let us set the channel 0 in mode 0. Connect the CLK 0 to the debounce circuit by changing the
jumper J3 and then execute the following program.

Program:
Address Opcodes Label Mnemonic Operands Comments
4100 START: MVI A, 30 Channel 0 in mode 0
4102 OUT CE Send Mode Control word
4104 MVI A, 05 LSB of count
4106 OUT C8 Write count to register
4108 MVI A, 00 MSB of count
410A OUT C8 Write count to register
410C HLT

It is observed in CRO that the output of Channel 0 is initially LOW. After giving six clock
pulses, the output goes HIGH.

Mode 1 Programmable ONE-SHOT:
After loading the counter, the output will remain low following the rising edge of the gate
input. The output will go high on the terminal count. It is retriggerable; hence the output will
remain low for the full count, after any rising edge of the gate input.

Example:
The following program initializes channel 0 of 8253 in Mode 1 and also initiates
triggering of Gate 0. OUT 0 goes low, as clock pulse after triggering the goes back to high level
after 5 clock pulses. Execute the program, give clock pulses through the debounce logic and
verify using CRO.

Address Opcodes Label Mnemonic Operands Comments
4100 START: MVI A, 32 Channel 0 in mode 1
4102 OUT CE Send Mode Control word
4104 MVI A, 05 LSB of count
4106 OUT C8 Write count to register
4108 MVI A, 00 MSB of count
410A OUT C8 Write count to register
410C OUT D0 Trigger Gate0
4100 HLT

Mode 2 Rate Generator:
It is a simple divide by N counter. The output will be low for one period of the input clock.
The period from one output pulse to the next equals the number of input counts in the count
register. If the count register is reloaded between output pulses the present period will not be
affected but the subsequent period will reflect the new value.

Example:
Using Mode 2, Let us divide the clock present at Channel 1 by 10. Connect the CLK1 to
PCLK.
Address Opcodes Label Mnemonic Operands Comments
4100 3E 74 START: MVI A, 74 Channel 1 in mode 2
4102 D3 CE OUT CE Send Mode Control word
4104 3E 0A MVI A, 0A LSB of count
4106 D3 CA OUT CA Write count to register
4108 3E 00 MVI A, 00 MSB of count
410A D3 CA OUT CA Write count to register
410C 76 HLT
In CRO observe simultaneously the input clock to channel 1 and the output at Out1.

Mode 3 Square wave generator:
It is similar to Mode 2 except that the output will remain high until one half of count and go
low for the other half for even number count. If the count is odd, the output will be high for
(count + 1)/2 counts. This mode is used of generating Baud rate for 8251A (USART).

Example:
We utilize Mode 0 to generate a square wave of frequency 150 KHz at channel 0.
Address Opcodes Label Mnemonic Operands Comments
4100 3E 36 START: MVI A, 36 Channel 0 in mode 3
4102 D3 CE OUT CE Send Mode Control word
4104 3E 0A MVI A, 0A LSB of count
4106 D3 C8 OUT C8 Write count to register
4108 3E 00 MVI A, 00 MSB of count
410A D3 C8 OUT C8 Write count to register
410C 76 HLT
Set the jumper, so that the clock 0 of 8253 is given a square wave of frequency 1.5 MHz. This
program divides this PCLK by 10 and thus the output at channel 0 is 150 KHz.

Vary the frequency by varying the count. Here the maximum count is FFFF H. So, the
square wave will remain high for 7FFF H counts and remain low for 7FFF H counts. Thus with
the input clock frequency of 1.5 MHz, which corresponds to a period of 0.067 microseconds, the
resulting square wave has an ON time of 0.02184 microseconds and an OFF time of 0.02184
microseconds.

To increase the time period of square wave, set the jumpers such that CLK2 of 8253 is
connected to OUT 0. Using the above-mentioned program, output a square wave of frequency
150 KHz at channel 0. Now this is the clock to channel 2.

Mode 4: Software Triggered Strobe:
The output is high after mode is set and also during counting. On terminal count, the
output will go low for one clock period and becomes high again. This mode can be used for
interrupt generation.
The following program initializes channel 2 of 8253 in mode 4.

Example:
Connect OUT 0 to CLK 2 (jumper J1). Execute the program and observe the output
OUT 2. Counter 2 will generate a pulse after 1 second.

Address Opcodes Label Mnemonic Operands Comments
4100 START: MVI A, 36 Channel 0 in mode 0
4102 OUT CE Send Mode Control word
4104 MVI A, 0A LSB of count
4106 OUT C8 Write count to register
4108 MVI A, 00 MSB of count
410A OUT C8 Write count to register
410C MVI A, B8 Channel 2 in Mode 4
410E OUT CE Send Mode control Word
4110 MVI A, 98 LSB of Count
4112 OUT CC Write Count to register
4114 MVI A, 3A MSB of Count
4116 OUT CC Write Count to register
4118 HLT

Mode 5 Hardware triggered strobe:

Counter starts counting after rising edge of trigger input and output goes low for one
clock period when terminal count is reached. The counter is retriggerable.

Example:
The program that follows initializes channel 0 in mode 5 and also triggers Gate 0. Connect CLK
0 to debounce circuit.
Execute the program. After giving Six clock pulses, you can see using CRO, the initially
HIGH output goes LOW. The output ( OUT 0 pin) goes high on the next clock pulse.


Address Opcodes Label Mnemonic Operands Comments
4100 START: MVI A, 1A Channel 0 in mode 5
4102 OUT CE Send Mode Control word
4104 MVI A, 05 LSB of count
4106 OUT C8 Write count to register
4108 MVI A, 00 MSB of count
410A OUT D0 Trigger Gate 0
410C HLT


Result:
Thus the 8253 has been interfaced to 8085 p and six different modes of 8253 have been
studied.

S-ar putea să vă placă și