Lab Manual: Department of Electronics Engineering

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 63

Department of Electronics Engineering

LAB MANUAL
Semester-IV
Microprocessor and Peripherals Laboratory

Department of Electronics Engineering

Institute Vision, Mission & Quality Policy


Vision
To foster and permeate higher and quality education with value added engineering,
technology programs, providing all facilities in terms of technology and platforms for all
round development with societal awareness and nurture the youth with international
competencies and exemplary level of employability even under highly competitive
environment so that they are innovative adaptable and capable of handling problems faced
by our country and world at large.

Mission
The Institution is committed to mobilize the resources and equip itself with men and
materials of excellence thereby ensuring that the Institution becomes pivotal center of
service to Industry, academia, and society with the latest technology. RAIT engages
different platforms such as technology enhancing Student Technical Societies, Cultural
platforms, Sports excellence centers, Entrepreneurial Development Center and Societal
Interaction Cell. To develop the college to become an autonomous Institution & deemed
university at the earliest with facilities for advanced research and development programs
on par with international standards. To invite international and reputed national
Institutions and Universities to collaborate with our institution on the issues of common
interest of teaching and learning sophistication.

Quality Policy

Our Quality Policy


It is our earnest endeavour to produce high quality engineering professionals who are
innovative and inspiring, thought and action leaders, competent to solve problems
faced by society, nation and world at large by striving towards very high standards in
learning, teaching and training methodologies.
Our Motto: If it is not of quality, it is NOT RAIT!

Dr. Vijay D. Patil


President, RAES

Department of Electronics Engineering

Department Vision & Mission


Vision
The department envisions that the students of the branch become engineers of
professional character equipped with a strong theoretical and experimental
foundation required for critical thinking, practical engineering skills to face the
recent research and industrial challenges in the field, the ability to work in a team
dignity, and all the qualities that help them accomplish their goals with a zeal for
social awareness.

Mission

Our mission is to facilitate the development of well rounded, educated,


productive, societyfocused, creative, adaptive, motivated and ethical
individuals who are well versed in technology and in social and
environmental issues.

To create an academic environment of high quality through an outcome


based interactive learning teaching model.

Provide outstanding education & research training to students to enable


them to have productive careers in industry and academia.

To inculcate leadership and entrepreneurship qualities in the students and


to make them ready for the challenges of competitive professional life.

To foster and encourage collaborative research activities and to develop


the excitement of research with intellectual stimulation of diverse campus
community and with other various leading industries and research
institutions.

ii

Department of Electronics Engineering

Index
Sr. No.

Contents

Page No.

1.

List of Experiments

2.

Experiment Plan and Course Outcomes

3.

Study and Evaluation Scheme

4.

Experiment No. 1

5.

Experiment No. 2

11

6.

Experiment No. 3

19

7.

Experiment No. 4

24

8.

Experiment No. 5

28

9.

Experiment No. 6

32

10.

Experiment No. 7

36

11.

Experiment No. 8

40

12.

Experiment No. 9

44

13.

Experiment No. 10

48

14.

Appendix I-Procedure to use Dyna-8085 kit

54

15.

Appendix II-Procedure to use Dyna-8086 kit

57

iii

Department of Electronics Engineering

List of Experiments
Sr. No.

Experiments Name

To study 8085 Microprocessor and write a program in assembly language to perform 8


bit addition and subtraction on 8085 Dyna Kit.

To study 8086 Microprocessor and write a program in assembly language to perform 8


bit addition and subtraction on 8086 Dyna Kit.

To write an Assembly Language Program for performing multiplication and division


operation of 16-bit numbers.

To write an Assembly Language Program for performing unpacking of the packed BCD
number.

To write an Assembly Language Program to find the largest number in a given array.

To write an Assembly Language Program to convert ASCII character to Hex character.

To write an Assembly Language program to find even and odd number from given
numbers.

To write an Assembly Language program to transfer block of data 0000:C200 to


0000:C100.

To write an Assembly Language program to calculate nth power.

10

To write an Assembly Language program for interfacing 8255 with 8086.

Department of Electronics Engineering

Experiment Plan & Course Outcome


Course Outcomes:
CO1

To introduce students about basic working & functions of 8085 & 8086 microprocessors.

CO2

To analyze and implement various instructions and Assembly language programs of 8086
microprocessor.

CO3

To understand basic interfacing of the I/O devices with 8086 microprocessor.

Module
No.

Week
No.

W1

To study 8085 Microprocessor and write a program in


assembly Language to perform 8-bit addition and subtraction
on 8085 Dyna Kit.

CO1

W2

To study 8086 Microprocessor and write a program Language


in assembly to perform 8-bit addition and subtraction on 8086
Dyna Kit.

CO1

W3

To write an Assembly Language Program for performing the


multiplication and division operation of 16-bit numbers.

CO2

W4

To write an Assembly Language Program for performing


unpacking of the packed BCD number.

CO2

W5

To write an Assembly Language Program to find the largest


number in a given array.

CO2

W6

To write an Assembly Language Program to convert ASCII


character to Hex character.

CO2

W7

To write an Assembly Language program to find even and odd


number from given number.

CO2

W8

To write an Assembly Language program to transfer block of


data 0000:C200 to 0000:C100.

CO2

W9

To write an Assembly Language program to calculate nth


power.

CO2

10

W10

To write an Assembly Language program for interfacing of


8255 with 8086.

CO3

Experiments Name

Course
Outcome

Department of Electronics Engineering

Study and Evaluation Scheme


Course

Course Name

Code

EXL
402

Microprocessor
and peripherals
laboratory

Course Code

EXL

Teaching Scheme

Theory

Credits Assigned

Practical

Tutorial

Theory

Practical

Tutorial

Total

02

--

--

01

--

01

Course Name

Examination Scheme
Term Work

Oral

Total

25

25

50

Microprocessor
and peripherals
laboratory

402

Term Work:
1. Term work assessment must be based on the overall performance of the student with every
experiment graded from time to time. The grades should be converted into marks as per the
Credit and Grading System manual and should be added and averaged.
2. The final certification and acceptance of term work ensures satisfactory performance of
laboratory work and minimum passing marks in term work.

Oral:
Oral exam will be based on the entire syllabus.

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory

Experiment No : 1

To Study 8085 Microprocessor and Write


a Program in Assembly Language to
Perform 8-bit Addition and Subtraction
on 8085 Dyna Kit

Department of Electronics Engineering

Experiment No. 1
1. Aim: To study 8085 Microprocessor and write a program in assembly language to
perform 8-bit addition and subtraction on 8085 Dyna Kit.
2. What you will learn by performing this experiment ?

Learn how and where to use 8085 Microprocessor.


To explore the applications of 8085 Microprocessor
Able to write programs based on 8085 Microprocessor.

3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
8085 Dyna Kit
3 MHz
C000-FFFF
5V

4. Theory:
The Intel 8085 is an 8-bit microprocessor produced by Intel and introduced in 1976. It is
software-binary compatible with the more-famous Intel 8080 with only a few minor instructions
added. However, it requires less support circuitry, allowing simpler and less
expensive microcomputer systems to be built. 8085 uses a single +5 Volt (V) power supply by
using depletion mode transistors. The 8085 is supplied in a 40-pin DIP package. To maximize
the functions on the available pins, the 8085 uses a multiplexed address/data bus. However, an
8085 circuit requires an 8-bit address latch so Intel manufactured several support chips with an
address latch built in. These include the 8755, with an address latch, 2 KB of EPROM and 16 I/O
pins, and the 8155 with 256 bytes of RAM, 22 I/O pins and a 14 bit programmable
Timer/Counter. The multiplexed address/data bus reduced the number of PCB tracks between the
8085 and such memory and I/O chips.
Features :
a)
b)
c)
d)
e)

Single + 5V Supply
4 Vectored Interrupts (One is Non Maskable)
Serial In/Serial Out Port
Decimal, Binary, and Double Precision Arithmetic
Direct Addressing Capability to 64K bytes of memory
5

Department of Electronics Engineering


f) Clock frequencies of 8085 are: 3 MHz ,5 MHz and 6 MHz depending on the chip used.
8085 Pin Diagram :

Fig 1. Pin Diagram


Pins Descriptions :
X1 and X2 Pins : These are also called Crystal Input Pins.8085 can generate clock signals
internally .To generate Clock signals internally 8085 requires external inputs from X1 and X2
Pins.
RESET IN: It is used to reset the microprocessor. It is active low signal. When the signal on this pin is
low for at least 3 clocking cycles, it forces the microprocessor to reset itself. RESET IN and RESET OUT
Pin 36 (Input) and Pin 3 (Output). Resetting the microprocessor means, Clearing the PC and IR. Disabling
all interrupts (except TRAP). Disabling the SOD pin. All the buses (data, address, control) are tri stated.
RESET OUT: It is used to reset the peripheral devices and other ICs on the circuit. It is an output
signal. It is an active high signal. The output on this pin goes high whenever RESET IN is given low
signal. The output remains high as long as RESET IN is kept low.
SID (Serial Input Data): It takes 1 bit input from serial port of 8085. It Stores the bit at the 8th position
(MSB) of the Accumulator. RIM (Read Interrupt Mask) instruction is used to transfer the bit.
6

Department of Electronics Engineering


SOD (Serial Output Data): It takes 1 bit from Accumulator to serial port of 8085. ItTakes the bit from
the 8th position (MSB) of the Accumulator. SIM (Set Interrupt Mask) instruction is used to transfer the
bit.

Interrupt Pins : It means interrupting the normal execution of the microprocessor When
microprocessor receives interrupt signal, it discontinues whatever it was executing. It starts
executing new program indicated by the interrupt signal. Interrupt signals are generated by
external peripheral devices .After execution of the new program, microprocessor goes back to
the previous program.
TRAP : It is an non-maskable interrupt. It has the highest priority. It cannot be disabled. It is
both edge and level triggered. It means TRAP signal must go from low to high. It means TRAP
signal must go from low to high and must remain high for a certain period of time.
Architecture of 8085 : The architecture of 8085 is shown in figure 2.

Fig 2. 8085 Architecture


The 8085 Programming Model : The processor has seven 8-bit registers accessible to the
programmer, named A, B, C, D, E, H, and L, where A is the 8-bit accumulator and the other six
can be used as independent byte-registers or as three 16-bit register pairs, BC, DE, and HL,
depending on the particular instruction. Some instructions use HL as a (limited) 16-bit
accumulator. As in the 8080, the contents of the memory address pointed to by HL can be
accessed as pseudo register M. It also has a 16-bit program counter and a 16-bit stack pointer to
memory (replacing the 8008's internal stack). Instructions such as PUSH PSW, POP PSW affect
the Program Status Word (accumulator and flags). The accumulator stores the results of
7

Department of Electronics Engineering


arithmetic and logical operations, and the flags register bits (sign, zero, auxiliary carry, parity,
and carry flags) are set or cleared according to the results of these operations .

Intel 8085 registers


1
5

1
4

1
3

1
2

1
1

1
0

0
9

0
8

0
7

0
6

0
5

0
4

0
3

0
2

0
1

0
0

(bit position)

Main registers
A

Flags

AF (accumulator and
flags)

BC

DE

HL (indirect address)

Index registers
SP

Stack Pointer

PC

Program Counter

Program counter

Status register
S Z I H - P - C Flags

Fig 3. 8085 Programming Model


5. Algorithm for addition and subtraction:
Addition :
1.
2.
3.
4.
5.
6.
7.

Start the program by loading the first data into Accumulator.


Move the data to a register ( B register).
Get the second data and load into Accumulator.
Add the two register contents.
Check for carry.
Store the value of sum and carry in memory location.
Terminate the program.

Department of Electronics Engineering


Subtraction:
1.
2.
3.
4.
5.
6.
7.
8.
9.

Start the program by loading the first data into Accumulator.


Move the data to a register ( B register).
Get the second data and load into Accumulator.
Subtract the two register contents.
Check for carry.
If carry is present take 2s compliment of Accumulator.
Store the value of borrow in memory location.
Store the difference value(present in Accumulator) to a memory location.
Terminate the program.
6. Procedure:

Follow the procedure as given in Appendix I for Dyna-8085 kit.

7. Observation Table:
For Addition :
Sr. No.

Input1
Register/Memory

Input2
Output
Register/Memory Register/Memory

Flags Affected

Input2
Output
Register/Memory Register/Memory

Flags Affected

For Subtraction :
Sr. No.

Input1
Register/Memory

Department of Electronics Engineering


8. Precautions :

Do not keep the kit on for long time.


Switch off the Kits after implementing the program.

9. Conclusion:

10. QUIZ / Viva Questions:

What is meant by the statement that 8085 is a 8-bit microprocessor?


In how many groups can the signals of 8085 be classified?
What is the technology used in the manufacture of 8085?
What is the operating frequency of 8085?
What is the purpose of CLK signal of 8085?
The address capability of 8085 is 64 KB. Explain.
Which are the sixteen bit registers of 8085.
How many instructions 8085 can support?
What are the different assembly languages used for 8085 microprocessor?
Why the lower byte address bus (A0 A7) and data bus (D0 D7) are
multiplexed?

11. References:
1. http://www.nptel.ac.in/courses/Webcourse-contents/IIScBANG/Microprocessors%20and%20Microcontrollers/pdf/Lecture_Notes/LNm1.pdf
2. http://8085microprocessor4u.blogspot.in/2012/12/architecture-diagram-of-8085.html
3. http://www.slideshare.net/anupamkumarpandit/list-of-8085-programs
4. http://www.eazynotes.com/pages/microprocessor/8085-programs.html
5. http://user.das.ufsc.br/~werner/eel7030/8085/instrucoes8085Detalhadas.pdf

10

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 2

To Study 8086 Microprocessor and


Write a Program in Assembly
Language to Perform 8-bit Addition
and Subtraction on 8086 Dyna Kit

11

Department of Electronics Engineering

Experiment No. 2
1. Aim: To study 8086 Microprocessor and write a program in assembly language to
perform 8-bit addition and subtraction on 8086 Dyna Kit.
2. What you will learn by performing this experiment?

Learn how and where to use 8086 Microprocessor.


To explore the applications of 8086 Microprocessor
Able to write programs based on 8086 Microprocessor.

3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
Features :
It is a 16-bit p.
8086 has a 20 bit address bus can access up to 220 memory locations (1 MB).
It can support up to 64K I/O ports.
It provides 14, 16 -bit registers.
Word size is 16 bits.
It has multiplexed address and data bus AD0- AD15 and A16 A19.
It requires single phase clock with 33% duty cycle to provide internal timing .
8086 is designed to operate in two modes, Minimum and Maximum.
It requires +5V power supply.
A 40 pin dual in line package.
Address ranges from 00000H to FFFFFH
Memory is byte addressable - Every byte has a separate address.

12

Department of Electronics Engineering


8086 Pin Diagram :

Fig 1. Pin Diagram


Pin Description :
AD15-AD0 : Data bus, bidirectional, tri-state lines connected to system data lines
A16-A19 : The four most significant address lines multiplexed with status signals S6 through S3.

13

Department of Electronics Engineering


A16/S3,A17/S4: Bit S4 and S3 together from a 2 bit binary code that identifies which of the
8086 internal segment registers are used to generate the physical address that was output on the
address bus during the current bus cycle
S4

S3

Segment Register

Extra

Stack

Code / none

Data

A18/S5 : Address lines multiplexed with internal status signals S5.


A19/S6 : Address lines multiplexed with status signals S5.
NMI : Non-maskable interrupt requests.
INTR : Interrupt requests are input on this pin.
READY: This an output signal used to check the status of output device. If it is low, P will
WAIT until it is high.
CLK: This is clock input signals and are connected to external LC or RC circuit . These are
divide by two so if 6 MHz is connected to CLK, the operating frequency becomes 3 MHz .
GND : This provides the ground for the IC.
VCC :+5V power supply.
RESET : Reset is an input pin which sets the IC to its default state.
RD: Read Control is an Active low input pin. RD is LOW when CPU reads data from the port or
memory.
BHE/S7 : Bus high enable Logic 0 on this used as a memory enable signal for the most
significant byte half of the data bus D8 through D15. These lines also multiplexed with the S7
status line.

14

Department of Electronics Engineering


Modes of 8086:
Microprocessor 8086 has Minimum Mode and Maximum Modes. The minimum mode is
selected by applying logic 1 to the MN / MX input pin. This is a single microprocessor
configuration. The maximum mode is selected by applying logic 0 to the MN / MX input pin.
This is a multi micro processors configuration. When the Minimum mode operation is selected,
the 8086 provides all control signals needed to implement the memory and I/O interface.
WR: Write Enable is an active low input pin. WR is LOW when CPU Write data to the port or
memory.
INTA: It is an active low input pin. Interrupt acknowledgment.
IO/M: This is output pin or signal used to indicate whether 8085 is working in I/O
mode(IO/M=1) or Memory mode(IO/M=0 ).
HOLD: HOLD is an input signal .When P receives HOLD signal it completes current machine
cycle and stops executing next instruction .
HLDA: In response to HOLD P generates HLDA that is HOLD Acknowledge signal.
ALE: Address latch enable is an output signal . It goes high when operation is started by
processor .
DEN: This is data enable and it signals external devices when they should put data on the bus.
DT/R : The direction of data transfer over the bus is signaled by the logic level output at DT/R.
When this line is logic 1 during the data transfer part of a bus cycle, the bus is in the transmit
mode. Therefore, data are either written into memory or output to an I/O device.
On the other hand, logic 0 at DT/R signals that the bus is in the receive mode. This corresponds
to reading data from memory or input of data from an input port.
LOCK: It is an active low signal. When it is low all interrupt are masked and no HOLD request
is granted.
Local Bus Control Signal Request / Grant Signals: In a maximum mode configuration, the
minimum mode HOLD, HLDA interface is also changed. These two are replaced by
request/grant lines RQ/ GT0 and RQ/ GT1, respectively. They provide a prioritized bus access
mechanism for accessing the local bus.

15

Department of Electronics Engineering


Architecture of 8086 :

Fig 2. 8086 Architecture


8086 Programming Model. :

Fig 3. 8086 Programming Model

16

Department of Electronics Engineering


5. Algorithm for addition and subtraction :
Addition :
1) Start the program by loading the first data into Accumulator.
2) Move the data to a register ( B register).
3) Get the second data and load into Accumulator.
4) Add the two register contents.
5) Check for carry.
6) Store the value of sum and carry in memory location.
7) Terminate the program.
Subtraction:
1)
2)
3)
4)
5)
6)
7)
8)
9)

Start the program by loading the first data into Accumulator.


Move the data to a register ( B register).
Get the second data and load into Accumulator.
Subtract the two register contents.
Check for carry.
If carry is present take 2s compliment of Accumulator.
Store the value of borrow in memory location.
Store the difference value(present in Accumulator) to a memory location.
Terminate the program.

6. Procedure :
Follow the procedure as given in Appendix II for Dyna-8086 kit .
7. Observation Table:
For Addition

Sr. No.

Input1
Register/Memory

Input2
Output
Register/Memory Register/Memory

Flags Affected

17

Department of Electronics Engineering


For Subtraction
Sr. No.
Input1
Register/Memory

Input2
Output
Register/Memory Register/Memory

Flags Affected

8. Precautions :
Do not keep the kit ON for long time.
Switch off the Kits after implementing the program.
9. Conclusion :

10. QUIZ / Viva Questions:

What is meant by the statement that 8086 is a 16-bit microprocessor?

What is the technology used in 8086 microprocessor ?

Mention and explain the modes in which 8086 can operate ?

Distinguish between the lower sixteen address lines from the upper four ?

Mention the different varieties of 8086 and their corresponding frequencies ?

Describe the status register of 8086?

Compare 8086 and 8088 microprocessors ?

Comment on the instruction size of 8086 ?

Is direct memory to memory data transfer possible in 8086 ?

Why memory segmentation is done for 8086?


11. References:
1. http://nptel.ac.in/courses/Webcourse-contents/IISc
BANG/Microprocessors%20and%20Microcontrollers/pdf/Teacher_Slides/mod1/M1L3.p
df
2. http://www.slideshare.net/poojithchowdhary/8086-micro-processor
3. www.eazynotes.com/pages/microprocessor/microprocessor-slides.htm
4. https://www.cpp.edu/~carich/classes/cs499/.../intel_architecture.ppt
5. ece.uprm.edu/~ahchinaei/courses/2013jun/.../0135038952_pp3a.ppt

18

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 3

To Write an Assembly Language


Program for Performing Multiplication
and Division Operation of 16-bit
Numbers

19

Department of Electronics Engineering

Experiment No. 3
1. Aim: To write an Assembly Language Program (ALP) for performing multiplication and
division operation of 16-bit numbers.
2. What you will learn by performing this experiment ?
Learn about arithmetic instructions of 8086 Microprocessor.
To explore the applications of 8086 Microprocessor
Able to write programs based on 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory: .
MOV MOV Destination, Source
The MOV instruction copies a word or byte of data from a specified source to a specified
destination. The destination can be a register or a memory location. The source can be a register,
a memory location or an immediate number. The source and destination cannot both be memory
locations. They must both be of the same type (bytes or words). MOV instruction does not affect
any flag.
MOV CX, 037AH
MOV BL, [437AH]
MOV AX, BX
MOV DL, [BX]
MOV DS, BX

Put immediate number 037AH to CX


Copy byte in DS at offset 437AH to BL
Copy content of register BX to AX
Copy byte from memory at [BX] to DL
Copy word from BX to DS register

MUL MUL Source


This instruction multiplies an unsigned byte in some source with an unsigned byte in AL register
or an unsigned word in some source with an unsigned word in AX register. The source can be a
register or a memory location. When a byte is multiplied by the content of AL, the result
(product) is put in AX. When a word is multiplied by the content of AX, the result is put in DX
and AX registers. If the most significant byte of a 16-bit result or the most significant word of a
20

Department of Electronics Engineering


32-bit result is 0, CF and OF will both be 0s. AF, PF, SF and ZF are undefined after a MUL
instruction.
If you want to multiply a byte with a word, you must first move the byte to a word location such
as an extended register and fill the upper byte of the word with all 0s. You cannot use the CBW
instruction for this, because the CBW instruction fills the upper byte with copies of the most
significant bit of the lower byte.
MUL BH
MUL CX
MUL BYTE PTR [BX]

Multiply AL with BH; result in AX


Multiply AX with CX; result high word in DX, low word in AX
Multiply AL with byte in DS pointed to by [BX]

DIV DIV Source


This instruction is used to divide an unsigned word by a byte or to divide an unsigned double
word (32bits) by a word. When a word is divided by a byte, the word must be in the AX register.
The divisor can be in a register or a memory location. After the division, AL will contain the 8bit quotient, and AH will contain the 8-bit remainder. When a double word is divided by a word,
the most significant word of the double word must be in DX, and the least significant word of the
double word must be in AX. After the division, AX will contain the 16-bit quotient and DX will
contain the 16-bit remainder. If an attempt is made to divide by 0 or if the quotient is too large to
fit in the destination(greater than FFH / FFFFH), the 8086 will generate a type 0 interrupt. All
flags are undefined after a DIV instruction.
If you want to divide a byte by a byte, you must first put the dividend byte in AL and fill AH
with all 0s. Likewise, if you want to divide a word by another word, then put the dividend word
in AX and fill DX with all 0s.
DIV BL
DIV CX
DIV SCALE [BX]

Divide word in AX by byte in BL; Quotient in AL, remainder in AH


Divide down word in DX and AX by word in CX;
Quotient in AX, and remainder in DX.
AX / (byte at effective address SCALE [BX]) if SCALE [BX] is of
type byte; or (DX and AX) / (word at effective address SCALE[BX]
if SCALE[BX] is of type word

5. Algorithm for multiplication and division :


Multiplication of 16-bit numbers:
a) Get the multiplier.
b) Get the multiplicand.
c) Initialize the product to 0.
d) Product = product + multiplicand.
e) Decrement the multiplier by 1.
f) If multiplicand is not equal to 0,repeat from step (d) otherwise store the
product.
21

Department of Electronics Engineering


Division of 16-bit numbers :
a)
b)
c)
d)
e)
f)
g)

Get the dividend.


Get the divisor.
Initialize the quotient to 0.
Dividend = dividend divisor.
If the divisor is greater, store the quotient. Go to step g.
If dividend is greater, quotient = quotient + 1. Repeat from step (d).
Store the dividend value as remainder.
6. Procedure:

Follow the procedure as given in Appendix II for Dyna-8086 kit .


7. Observation Table:
For Multiplication :
Sr. No.

Input1
Register/Memory

Input2
Output
Register/Memory Register/Memory

Flags Affected

For Division :
Sr. No.
Input1
Register/Memory

Input2
Output
Register/Memory Register/Memory

Flags Affected

8. Precautions :
Do not keep the kit on for long time.
Switch off the Kits after implementing the program.
22

Department of Electronics Engineering


9. Conclusion :

10. QUIZ / Viva Questions:

Although 8086 is a 16-bit microprocessor?, it deals with 8-bit memory. Why?

Is the flat scheme of memory applied for 8086 microprocessor?

Describe how memory is organized for 8086 microprocessor?

What are the different types of data transfer operations possible?

Discuss logical address, base segment address and physical address.

Describe how the 20-bit physical address is generated.

What is an instruction?

What is meant by instruction set?

In how many categories the instructions of 8086 be classified?

List the instruction used for multiplication and division.


11. References:
1. http://www.eazynotes.com/pages/microprocessor/8086-programs.html
2. http://www.slideshare.net/HassnainJamil/mul-div-instructions-in-assembly-language
3. http://www.ukessays.com/essays/engineering/assembler-directive-of-8086microprocessor.php
4. http://nptel.ac.in/courses/106108100/pdf/Teacher_Slides/mod2/M2L2.pdf
5. http://iitestudent.blogspot.in/2012/03/assembler-directives-of-80868088.html

23

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 4
To Write an Assembly Language
Program for Performing Unpacking of
the Packed BCD Number

24

Department of Electronics Engineering

Experiment No. 4
1. Aim: To write an Assembly Language Program for performing unpacking of the packed
BCD number.
2. What you will learn by performing this experiment?
Learn about BCD number.
To explore the applications of 8086 Microprocessor
Able to write programs based on BCD numbers in 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
Unpacking of BCD numbers uses following instructions :
AND AND Destination, Source
This instruction ANDs each bit in a source byte or word with the same numbered bit in a
destination byte or word. The result is put in the specified destination. The content of the
specified source is not changed. The source can be an immediate number, the content of a
register, or the content of a memory location. The destination can be a register or a memory
location. The source and the destination cannot both be memory locations. CF and OF are both 0
after AND. PF, SF, and ZF are updated by the AND instruction. AF is undefined. PF has
meaning only for an 8-bit operand.
AND CX, [SI]
AND BH, CL
AND BX,00FFH
OR OR Destination, Source
This instruction ORs each bit in a source byte or word with the same numbered bit in a
destination byte or word. The result is put in the specified destination. The content of the
specified source is not changed. The source can be an immediate number, the content of a
register, or the content of a memory location. The destination can be a register or a memory
25

Department of Electronics Engineering


location. The source and destination cannot both be memory locations. CF and OF are both 0
after OR. PF, SF, and ZF are updated by the OR instruction. AF is undefined. PF has meaning
only for an 8-bit operand.
OR AH, CL
OR BP, SI
OR SI, BP
OR BL, 80H
XOR XOR Destination, Source
This instruction Exclusive-ORs each bit in a source byte or word with the same numbered bit in
a destination byte or word. The result is put in the specified destination. The content of the
specified source is not changed. The source can be an immediate number, the content of a
register, or the content of a memory location. The destination can be a register or a memory
location. The source and destination cannot both be memory locations. CF and OF are both 0
after XOR. PF, SF, and ZF are updated. PF has meaning only for an 8-bit operand. AF is
undefined.
XOR CL, BH
XOR BP, DI
XOR WORD PTR [BX], 00FFH

Byte in BH exclusive-OR with byte in CL.


Result in CL. BH not changed.
Word in DI exclusive-OR with word in BP.
Result in BP. DI not changed.
Exclusive-OR immediate number 00FFH with word
at offset [BX] in the data segment.
Result in memory location [BX]

NOT-NOT Destination
The NOT instruction inverts each bit (forms the 1s complement) of a byte or word in the
specified destination. The destination can be a register or a memory location. This instruction
does not affect any flag.
NOT BX
NOT BYTE PTR [BX]
5. Algorithm of unpacking of packed BCD number :
1) Initialize Data Segment
2) Initialize Source Index
3) Load Data
4) Move data from AL to AH
5) Masking higher byte of AX
6) Masking lower byte of AX
7) Initialize count
8) Rotate contents of AH with 04 times
9) Store the result
10) Terminate the program
26

Department of Electronics Engineering


6. Procedure : Follow the procedure as given in Appendix II for Dyna-8086 kit .
7. Observation Table :
Sr. No.

Input
Register/Memory

Output
Register/Memory

Flags Affected

8. Precautions :
Do not keep the kit on for long time.
Switch off the Kits after implementing the program.
9. Conclusion :

10. QUIZ / Viva Questions:


Write the flags of 8086?

Write the special functions carried by the general purpose registers of 8086.
List the segment registers ?
Explain packing of BCD number ?
What is the drawback in machine language and assembly language programs?
How many machine cycles constitute one instruction cycle in 8086?
Explain BCD subtraction.
What is the difference between a mnemonic code and machine code?
Explain the logical instruction of 8086?

11. References:
1. http://www.eazynotes.com/pages/microprocessor/8086-programs.html
2. http://www.slideshare.net/HassnainJamil/mul-div-instructions-in-assembly-language
3. http://www.ukessays.com/essays/engineering/assembler-directive-of-8086microprocessor.php
4. http://nptel.ac.in/courses/106108100/pdf/Teacher_Slides/mod2/M2L2.pdf
5. http://iitestudent.blogspot.in/2012/03/assembler-directives-of-80868088.html

27

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 5
To Write an Assembly Language
Program to Find the Largest Number in a
Given Array

28

Department of Electronics Engineering

Experiment No. 5
1. Aim: To write an Assembly Language Program to find the largest number in a given
array.
2. What you will learn by performing this experiment ?
Learn about logical, arithmetic and conditional instructions of 8086.
To explore the applications of 8086 Microprocessor
Able to write programs based on searching and sorting in 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
Following instructions are used for finding largest and smallest number in a given array :
CMP CMP Destination, Source
This instruction compares a byte / word in the specified source with a byte / word in the specified
destination. The source can be an immediate number, a register, or a memory location. The
destination can be a register or a memory location. However, the source and the destination
cannot both be memory locations. The comparison is actually done by subtracting the source
byte or word from the destination byte or word. The source and the destination are not changed,
but the flags are set to indicate the results of the comparison. AF, OF, SF, ZF, PF, and CF are
updated by the CMP instruction.
CMP AL,01H
CMP BH, CL
CMP CX, TEMP
CMP PRICES [BX], 49H

Compare immediate number 01H with byte in AL


Compare byte in CL with byte in BH
Compare word in DS at displacement TEMP with word at CX
Compare immediate number 49H with byte at offset [BX]
in array PRICES

29

Department of Electronics Engineering


INC INC Destination
The INC instruction adds 1 to a specified register or to a memory location. AF, OF, PF, SF, and
ZF are updated, but CF is not affected. This means that if an 8-bit destination containing FFH or
a 16-bit destination containing FFFFH is incremented, the result will be all 0s with no carry.
INC BL
INC CX
INC BYTE PTR [BX]
INC WORD PTR [BX]

Add 1 to contains of BL register


Add 1 to contains of CX register
Increment byte in data segment at offset contained in BX.
Increment the word at offset of [BX] and [BX + 1]
in the data segment.

DEC DEC Destination


This instruction subtracts 1 from the destination word or byte. The destination can be a register
or a memory location. AF, OF, SF, PF, and ZF are updated, but CF is not affected. This means
that if an 8-bit destination containing 00H or a 16-bit destination containing 0000H is
decremented, the result will be FFH or FFFFH with no carry (borrow).
DEC CL
DEC BP
DEC BYTE PTR [BX]
DEC WORD PTR [BP]

Subtract 1 from content of CL register


Subtract 1 from content of BP register
Subtract 1 from byte at offset [BX] in DS.
Subtract 1 from a word at offset [BP] in SS.

JNE / JNZ (JUMP NOT EQUAL / JUMP IF NOT ZERO)


This instruction is usually used after a Compare instruction. If the zero flag is 0, then this
instruction will cause a jump to the label given in the instruction.
IN AL, 0F8H
CMP AL, 72
JNE NEXT
ADD AX, 0002H
DEC BX
JNZ NEXT

Read data value from port


Compare (AL 72)
Jump to label NEXT if AL 72
Add count factor 0002H to AX
Decrement BX
Jump to label NEXT if BX 0

5. Algorithm :

Take the first number of the array.


Compare with next number.
Take the bigger one of the them.
Decrement the count in CL register.
If the count is not zero then continue from step 2.
Store the result into Memory address 9500.
30

Department of Electronics Engineering


6. Procedure : Follow the procedure as given in Appendix II for Dyna-8086 kit
7. Observation Table :
Sr. No.
Input
Register/Memory

Output
Register/Memory

Flags Affected

8. Precautions :
Do not keep the kit on for long time.
Switch off the Kits after implementing the program.
9. Conclusion :

10. QUIZ / Viva Questions:

Explain logical instruction of 8086?

Explain Arithmetic instruction of 8086?

Explain shifting instruction of 8086?

Explain rotating instruction of 8086?

Explain JAE / JNB / JNC in 8086 ?

Explain JB / JC / JNAE and JBE / JNA in 8086 ?

Explain JG / JNLE and JGE / JNL in 8086 ?

Explain JE / JZ and JS/JNS in 8086 ?

Explain the function of M/IO in 8086 ?

Explain 8086 addressing modes ?


11. References:
1. http://www.eazynotes.com/pages/microprocessor/8086-programs.html
2. http://www.slideshare.net/HassnainJamil/mul-div-instructions-in-assembly-language
3. http://www.ukessays.com/essays/engineering/assembler-directive-of-8086microprocessor.php
4. http://nptel.ac.in/courses/106108100/pdf/Teacher_Slides/mod2/M2L2.pdf
5. http://iitestudent.blogspot.in/2012/03/assembler-directives-of-80868088.html
31

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 6
To Write an Assembly Language
Program to Convert ASCII Character to
Hex Character

32

Department of Electronics Engineering

Experiment No. 6
1. Aim: To write an Assembly Language Program to convert ASCII character to Hex
character.
2. What you will learn by performing this experiment ?
Learn how conversion is done in 8086 Microprocessor.
To explore the applications of 8086 Microprocessor
Able to write programs based on ASCII conversion in 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
JAE / JNB / JNC
(JUMP IF ABOVE OR EQUAL / JUMP IF NOT BELOW / JUMP IF NO CARRY)
If, after a compare or some other instructions which affect flags, the carry flag is 0, this
instruction will cause execution to jump to a label given in the instruction. If CF is 1, the
instruction will have no effect on program execution.
CMP AX, 4371H
JAE NEXT

Compare (AX 4371H)


Jump to label NEXT if AX above 4371H

CMP AX, 4371H


JNB NEXT

Compare (AX 4371H)


Jump to label NEXT if AX not below 4371H

ADD AL, BL
JNC NEXT

Add two bytes


If the result with in acceptable range, continue

33

Department of Electronics Engineering


JZ ( JUMP IF ZERO)
This instruction is usually used after a Compare instruction. If the zero flag is set, then this
instruction will cause a jump to the label given in the instruction.
IN AL, 30H
SUB AL, 30H
JZ START

Read data from port 8FH


Subtract the minimum value.
Jump to label START if the result of subtraction is 0

5. Algorithm :
Load the input data in AL register.
Subtract 30 from AL register value.
If data is less than or equal to 16 terminate the program.
Else subtract 7 from AL register value.
Result stored in AL register.
6. Procedure :
Follow the procedure as given in Appendix II for Dyna-8086 kit .
7. Observation Table :
Sr. No.

Input
Register/Memory

Output
Register/Memory

Flags Affected

8. Precautions:
Do not keep the kit on for long time.
Switch off the kits after implementing the program.
9. Conclusion :

34

Department of Electronics Engineering


10. QUIZ / Viva Questions:

Define ASCII code.


Explain table of ASCII Characters.
Explain ASCII to Hex conversion.
Explain Hex to ASCII conversion.
Explain ASCII to BCD conversion.
Explain BCD to ASCII conversion.
Explain Gray code.
Explain Binary, Octal and hexadecimal number.
Explain Binary to hexadecimal conversion and vice versa.
Explain Decimal to hexadecimal conversion and vice versa.

11. References:
1.
2.
3.
4.
5.

http://www.eazynotes.com/pages/microprocessor/8086-programs.html
http://www.dnatechindia.com/8-bit-HEX-to-ASCII-Convertor.html
http://forums.codeguru.com/showthread.php?410867-Converting-AscII-to-Hex
http://nptel.ac.in/courses/106108100/pdf/Teacher_Slides/mod2/M2L2.pdf
http://iitestudent.blogspot.in/2012/03/assembler-directives-of-80868088.html

35

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 7

To Write an Assembly Language


Program to Find Even and Odd
Number from Given Numbers

36

Department of Electronics Engineering

Experiment No. 7
1. Aim: To write an Assembly Language program to find even and odd number from given
numbers.
2. What you will learn by performing this experiment ?
Learn how to find type of number in 8086 Microprocessor.
To explore the applications of 8086 Microprocessor
Able to write programs based on even and odd number in 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
ROL ROL Destination, Count

This instruction rotates all the bits in a specified word or byte to the left some number of bit
positions. The data bit rotated out of MSB is circled back into the LSB. It is also copied into CF.
In the case of multiple-bit rotate, CF will contain a copy of the bit most recently moved out of
the MSB.

The destination can be a register or a memory location. If you to want rotate the operand by one
bit position, you can specify this by putting 1 in the count position in the instruction. To rotate
more than one bit position, load the desired number into the CL register and put CL in the
count position of the instruction. ROL affects only CF and OF. OF will be a 1 after a single bit
ROL if the MSB was changed by the rotate.
37

Department of Electronics Engineering


ROL AX, 1
Rotate the word in AX 1 bit position left, MSB to LSB and CF
MOV CL, 04H
Load number of bits to rotate in CL
ROL BL, CL
Rotate BL 4 bit positions
ROR ROR Destination, Count
This instruction rotates all the bits in a specified word or byte some number of bit positions to
right. The operation is desired as a rotate rather than shift, because the bit moved out of the LSB
is rotated around into the MSB. The data bit moved out of the LSB is also copied into CF. In the
case of multiple bit rotates, CF will contain a copy of the bit most recently moved out of the
LSB.

The destination can be a register or a memory location. If you want to rotate the operand by one
bit position, you can specify this by putting 1 in the count position in the instruction. To rotate by
more than one bit position, load the desired number into the CL register and put CL in the
count position of the instruction. ROR affects only CF and OF. OF will be a 1 after a single bit
ROR if the MSB was changed by the rotate.
ROR BL, 1
Rotate all bits in BL right 1 bit position LSB to MSB and to CF
MOV CL, 08H
Load CL with number of bit positions to be rotated
ROR WORD PTR [BX], CL Rotate word in DS at offset [BX] 8 bit position right
5. Algorithm :
Initialize the pointer to memory for data and result.
Loaded the data in AL register from memory.
Rotate the AL register by one bit.
If carry flag is set then go to step2.
Store the even number as a result into the Memory.
6. Procedure :
Follow the procedure as given in Appendix II for Dyna-8086 kit .

38

Department of Electronics Engineering


7. Observation table :
Sr. No.
Input
Register/Memory

Output
Register/Memory

Flags Affected

8. Precautions :
Do not keep the kit on for long time.
Switch off the Kits after implementing the program.

9. Conclusion :

10. QUIZ / Viva Questions:

Explain RCR and RLC instructions of 8086?


Explain SAL and SHL instructions of 8086?
Explain SAR with example ?
Explain 8086 general purpose registers ?
How 8086 is faster than 8085?

Which bus controller used in maximum mode of 8086?


Explain LEA with example ?
Explain LODSB with example ?
What is the use of INT3 ?

What is the use of HLT ?

11. References:
1. http://www.eazynotes.com/pages/microprocessor/8086-programs.html
2. http://80864beginner.com/Sample-Code/Bit-manipulation-instruction/8086-AssemblyLanguage-Program-for-given-data-is-odd-or-even.html
3. http://buzz4micro.blogspot.in/2009/12/program-to-check-if-given-number-is-odd.html
4. http://nptel.ac.in/courses/106108100/pdf/Teacher_Slides/mod2/M2L2.pdf
5. http://iitestudent.blogspot.in/2012/03/assembler-directives-of-80868088.html
39

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 8
To Write an Assembly Language
Program to Transfer Block of Data
0000:C200 to 0000:C100

40

Department of Electronics Engineering

Experiment No. 8
1. Aim: To write an Assembly Language Program to transfer block of data from 0000:C200
to 0000:C100.
2. What you will learn by performing this experiment ?
Learn about data transfer function of 8086.
To explore the applications of 8086 Microprocessor
Able to write programs based on transfer blocks, word in 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
LODS / LODSB / LODSW (LOAD STRING BYTE INTO AL OR STRING WORD
INTO AX)
This instruction copies a byte from a string location pointed to by SI to AL, or a word from a
string location pointed to by SI to AX. If DF is 0, SI will be automatically incremented (by 1 for
a byte string, and 2 for a word string) to point to the next element of the string. If DF is 1, SI will
be automatically decremented (by 1 for a byte string, and 2 for a word string) to point to the
previous element of the string. LODS does not affect any flag.
CLD
MOV SI, OFFSET
LODS SOURCE

Clear direction flag so that SI is auto-incremented


SOURCE Point SI to start of string
Copy a byte or a word from string to AL or AX

Note: The assembler uses the name of the string to determine whether the string is of type bye or
type word. Instead of using the string name to do this, you can use the mnemonic LODSB to tell
41

Department of Electronics Engineering


the assembler that the string is type byte or the mnemonic LODSW to tell the assembler that the
string is of type word.
STOS / STOSB / STOSW (STORE STRING BYTE OR STRING WORD)
This instruction copies a byte from AL or a word from AX to a memory location in the extra
segment pointed to by DI. In effect, it replaces a string element with a byte from AL or a word
from AX. After the copy, DI is automatically incremented or decremented to point to next or
previous element of the string. If DF is cleared, then DI will automatically incremented by 1 for
a byte string and by 2 for a word string. If DI is set, DI will be automatically decremented by 1
for a byte string and by 2 for a word string. STOS does not affect any flag.
MOV DI, OFFSET TARGET
STOS TARGET
Note: The assembler uses the string name to determine whether the string is of type byte or type
word. If it is a byte string, then string byte is replaced with content of AL. If it is a word string,
then string word is replaced with content of AX.
5. Algorithm :

Initialize the pointer to the memory where data to be transformed.


Load the AL register with the data from memory.
Initialize destination pointer to the memory where data to stored.
Store data from AL register.

6. Procedure :
Follow the procedure as given in Appendix II for Dyna-8086 kit .
7. Observation table :
Sr. No.

Input
Register/Memory
(before execution)

Output
Register/Memory
(after execution)

Flags Affected

42

Department of Electronics Engineering


8. Precautions :
Do not keep the kit on for long time.
Switch off the Kits after implementing the program.
9. Conclusion :

10. QUIZ / Viva Questions:

How to initialize data segment?


How to initialize counter?
List data transfer instruction?
Explain Move instruction with suitable example?
Explain XCHG instruction with suitable example?
Explain XLAT instruction with suitable example?
Explain LEA instruction with suitable example?
Explain LDS instruction with suitable example ?
Explain LES instruction with suitable example?
Explain Special purpose registers of 8086?

11. References:
1.
2.
3.
4.
5.

http://www.eazynotes.com/pages/microprocessor/8086-programs.html
http://nec.edu.np/faculty/chandrat/8086imp.pdf
http://jntuimplab.blogspot.in/2008/06/block-data-transfer-program-for-8086.html
http://nptel.ac.in/courses/106108100/pdf/Teacher_Slides/mod2/M2L2.pdf
http://ggnindia.dronacharya.info/EEEDept/Downloads/QuestionBank/Vsem/MP_Sec.C.2
.pdf

43

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 9
To Write An Assembly Language
Program To Calculate Nth Power

44

Department of Electronics Engineering

Experiment No. 9
1. Aim: To Write an Assembly Language Program to Calculate Nth Power.
2. What you will learn by performing this experiment ?
Learn how to calculate power in 8086 Microprocessor.
To explore the applications of 8086 Microprocessor
Able to write programs based on calculation of nth power 8086 Microprocessor.
3. Apparatus Required:
Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
MUL MUL Source

This instruction multiplies an unsigned byte in some source with an unsigned byte in AL register
or an unsigned word in some source with an unsigned word in AX register. The source can be a
register or a memory location. When a byte is multiplied by the content of AL, the result
(product) is put in AX. When a word is multiplied by the content of AX, the result is put in DX
and AX registers. If the most significant byte of a 16-bit result or the most significant word of a
32-bit result is 0, CF and OF will both be 0s. AF, PF, SF and ZF are undefined after a MUL
instruction.
If you want to multiply a byte with a word, you must first move the byte to a word location such
as an extended register and fill the upper byte of the word with all 0s. You cannot use the CBW
instruction for this, because the CBW instruction fills the upper byte with copies of the most
significant bit of the lower byte.
MUL BH

Multiply AL with BH; result in AX

45

Department of Electronics Engineering


MUL CX
Multiply AX with CX; result high word in DX, low word in AX
MUL BYTE PTR [BX] Multiply AL with byte in DS pointed to by [BX]
JNE / JNZ (JUMP NOT EQUAL / JUMP IF NOT ZERO)
This instruction is usually used after a Compare instruction. If the zero flag is 0, then this
instruction will cause a jump to the label given in the instruction.
ADD AX, 0002H
DEC BX
JNZ NEXT

Add count factor 0002H to AX


Decrement BX
Jump to label NEXT if BX 0

5. Algorithm :

Initialize Data segment.


Initialize Source Index.
Move data to AL.
Move data to BL from SI.
Move data to CL from SI+01.
Multiply BL.
Decrement CL.
Jump to back if not equal to zero.
Move data to SI+02 from AX.
Terminate the program.

6. Procedure :
Follow the procedure as given in Appendix II for Dyna-8086 kit.

7. Observation table :
Sr. No.
Input
Register/Memory
(before execution)

Output
Register/Memory
(after execution)

Flags Affected

46

Department of Electronics Engineering


8. Precautions :
Do not keep the kit on for long time.
Switch off the Kits after implementing the program.
9. Conclusion :

10. QUIZ / Viva Questions:


Write a program to calculate square of a number.
Write a program to calculate cube of a number.
Write a program based on DAA.
Explain DAS with suitable example.

Explain DAS with suitable example.


Explain CBW and CWD with suitable example.
Explain AAA ,AAS and AAM with suitable example.
Write a program to find the factorial of a number.

What are the various interrupts in 8086.


What are the various interrupts in 8086.
11. References:
1. http://www.eazynotes.com/pages/microprocessor/8086-programs.html
2. http://elearning.vtu.ac.in/13/ENotes/8086/unit%201.pdf
3. http://www.technoburst.net/2010/09/8086-programs-05-square-root-of-number.html
4. htt1://gnindia.dronacharya.info/itdept/Downloads/Labmanuals/LAB_MANNUAL_MP_1
7012013.pdf
5. http://iitestudent.blogspot.in/2012/03/assembler-directives-of-80868088.html

47

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Experiment No : 10
To Write an Assembly Language
Program for Interfacing of 8255 with
8086

48

Department of Electronics Engineering

Experiment No. 10
1. Aim : To Write an Assembly Language Program for Interfacing of 8255 (Programmable
Peripheral Interface) with 8086.
2. What you will learn by performing this experiment ?
Learn how to use 8086 Microprocessor with peripherals devices.
To explore the applications of 8086 Microprocessor
Able to write programs based on 8086 Microprocessor and 8255.
Interfacing of Microprocessor with different peripherals.
3. Apparatus Required:

Sr.
No.
1.
2.
3.
4.

Apparatus / Equipment
Kit
Operating Frequency
Memory
Power Supply

Specification
Dyna 8086L & Dyna 8255
8 MHz
C000-FFFF
+5V with 3 Amps
+12V with 250 mA
-12V with 250 mA

4. Theory:
Features of Dyna-PIO 8255
1.
2.
3.
4.
5.
6.
7.
8.

It is a programmable device.
It has 24 I/O programmable pins like PA,PB,PC (3-8 pins).
T T L compatible.
Compatible with Dyna-85, ILC-V2* , Star-85* , Dyna-86, Dyan-51 Kits.
Selection of I/O addresses through jumper.
Demo programs of all modes available.
Compatible programs based on different kits supported now available.
RST 5.5 , RST 6.5, RST 7.5 are provided onboard for interrupt driven modes. (For 8085
based Kits) Using 8255, all possible modes can be experimented.
9. PA0-PA7, PB0-PB7, PC0-PC7 LED indicators and test lug inputs with handshake signals.
10. User links and lugs provided for inputs with their legends

49

Department of Electronics Engineering


11. Experiments for both polled and interrupt driven data transfer is possible with links for 8085
interrupts.
12. Suplied in a attractive wodden cabinet.
Pin Diagram :

Fig. 1 : 8255 Pin Diagram


Control Word Register :

Fig.2 : 8255 Control Word Register


50

Department of Electronics Engineering


Architecture of 8255 :

Fig. 3 : 8255 Architecture

8255 Dyna -kit :

Fig. 4 : 8255 Dyna -Kit

51

Department of Electronics Engineering


8255 Interfacing with 8086 Microprocessor :

Fig. 5 : 8255 Interfacing with 8086


5. Algorithm :

Initialization of 8255
Select I/P 2 as analog input.
Give start of conversion
Pulse to the ADC
Check for EOC by reading port C upper and rotate through carry
If EOC, read digital equivalent in AL
Terminate the program

6. Procedure : Follow the procedure as given in Appendix II for Dyna-8086 kit .

52

Department of Electronics Engineering


7. Observation table :
Sr. No.
Port

Input

Output

8. Precautions :
Do not keep the kit on for long time.
Switch off the kits after implementing the program.
9. Conclusion :

10. QUIZ / Viva Questions:


What is the 82C55A device?
What kind of input/output interface dose a PPI implement?
How many I/O lines are available on the 82C55A?
Describes the mode 0, mode 1, and mode 2 operations of the 82C55A?
What is the mode and I/O configuration for ports A, B, and C of an 82C55A after
its control register is loaded with 82H?
Which port that is used for the generation of handshake lines in mode 1 or mode 2
Which pin clears the control word register of 8255 when it is enabled ?
How is 8255 (PPI) configured if its control register contains 9B h.
Describe the operation performed by the instruction OUT 47 h, AL.
Compare memory mapped I/O with I/O mapped I/O.
11. References:
1. http://gradestack.com/Microprocessors-and/8255-Interfacing-with/8255-InterfacingWith/19320-3912-38187-study-wtw
2. http://www.electronics.dit.ie/staff/tscarff/8255PPI/8255.htm
3. http://nptel.ac.in/courses/108107029/module9/lecture1/lecture1.pdf
4. http://elearning.vtu.ac.in/P6/enotes/CSE45/Intel-Uk.pdf
5. http://www.scribd.com/doc/7900998/8255-interface-PPt#scribd

53

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Appendix I
Procedure to use Dyna-8085 Kit

54

Department of Electronics Engineering

Appendix I
Procedure to use Dyna-8085 Kit:
There are basically five types of steps which we have to follow for 8051 programming on
DYNA kit.
1) A Assemble Command
Syntax : A Starting Address
A Command accepts assembly language statements and assembles each statement into
executable machine code. These assembled machine codes are stored in a specified
memory on line by line basis at the time of entry.
Example: DYNA-85> A C000 (Enter)
0000:C000 MOV AX,0000
----INT 3
After executing assembly language statement press enter for next line.
2) U - Disassemble Command
Syntax: U Starting Address
The U command followed by the address disassembles the program from the specified
location. The U command translates machine instruction into assembly language
mnemonics.
Example: DYNA-85 > U C000
3) E Edit Memory
Syntax : E Starting Address
The E command allows you to examine and modify memory locations individually.
Ex. DYNA-85 > E D000
Press 'Enter' key to exit edit mode.
55

Department of Electronics Engineering

4) GO--Run Program
Syntax: GO Starting Address
The GO command is used to execute user program from the address stated in this
Command
DYNA-85> GO C000
break point
5) R
Syntax: R (Enter)
The R command is used to see the contents of all the registers.
DYNA-85> R (Enter)
5) D Display Memory
Syntax: D Starting Address
Selected area of addressable memory may be accessed and displayed by the D
command. The D command produces a formatted listing of the memory contents
between strt (starting address) and end (end address) inclusive on the display.Each line
of the listing begins with the address of the first memory location displayed on that
line, represented as 4 hexadecimal digits, followed by contents of 8 memory locations,
each one represented by 2 hexadecimal digits.

Ex. DYNA-85 > D D000


Note : Write every commands on main prompt
The user program should start from 0000:C000H or above.

56

Department of Electronics Engineering

Microprocessor and Peripherals


Laboratory
Appendix II
Procedure to use Dyna-8086 Kit

57

Department of Electronics Engineering

Appendix II
Procedure to use Dyna-8086 Kit:
There are basically five types of steps which we have to follow for 8051 programming on
DYNA kit.
1) A Assemble Command
Syntax : A Starting Address
A Command accepts assembly language statements and assembles each statement into
executable machine code. These assembled machine codes are stored in a specified
memory on line by line basis at the time of entry.
Example: DYNA-86> A C000 (Enter)
0000:C000 MOV AX,0000
----INT 3
After executing assembly language statement press enter for next line.
2) U - Disassemble Command
Syntax: U Starting Address
The U command followed by the address disassembles the program from the specified
location. The U command translates machine instruction into assembly language
mnemonics.
Example: DYNA-86 > U C000
3) E Edit Memory
Syntax : E Starting Address
The E command allows you to examine and modify memory locations individually.
Ex. DYNA-86 > E D000
Press 'Enter' key to exit edit mode.
58

Department of Electronics Engineering


4) GO--Run Program
Syntax: GO Starting Address
The GO command is used to execute user program from the address stated in this
Command
DYNA-86> G C000
break point
5) R
Syntax: R (Enter)
The R command is used to see the contents of all the registers.
DYNA-86> R (Enter)
6) D

Display Memory
Syntax: D Starting Address
Selected area of addressable memory may be accessed and displayed by the D
command. The D command produces a formatted listing of the memory contents
between strt (starting address) and end (end address) inclusive on the display.Each line
of the listing begins with the address of the first memory location displayed on that
line, represented as 4 hexadecimal digits, followed by contents of 8 memory locations,
each one represented by 2 hexadecimal digits.

Ex. DYNA-86 > D D000


Note : Write every commands on main prompt
The user program should start from 0000:C000H or above.

59

You might also like