The 8085 Microprocessor Architecture Programming and Interfacing 1e Kumar download
The 8085 Microprocessor Architecture Programming and Interfacing 1e Kumar download
https://ebookultra.com/download/the-8085-microprocessor-
architecture-programming-and-interfacing-1e-kumar/
https://ebookultra.com/download/the-8085-microprocessor-architecture-
programming-and-interfacing-1st-edition-k-udaya-kumar/
https://ebookultra.com/download/analog-interfacing-to-embedded-
microprocessor-systems-2nd-ed-edition-stuart-ball/
https://ebookultra.com/download/microprocessor-architecture-from-
simple-pipelines-to-chip-multiprocessors-1st-edition-jean-loup-baer/
Embedded Linux Hardware Software and Interfacing R
Hardware Software and Interfacing Hollabaugh
https://ebookultra.com/download/embedded-linux-hardware-software-and-
interfacing-r-hardware-software-and-interfacing-hollabaugh/
https://ebookultra.com/download/microprocessor-3-philippe-darche/
https://ebookultra.com/download/digital-signal-processors-
architecture-programming-and-applications-2nd-edition-b-venkataramani/
THE 8085
MICROPROCESSOR
Architecture, Programming
and Interfacing
K. UDAYA KUMAR,
Principal,
B.N.M. Institute of Technology,
Bangalore, India.
B. S. UMASHANKAR,
Professor,
Department of Computer Science,
B.N.M. Institute of Technology,
Bangalore, India.
udayakumar_fm.qxp 4/16/2008 4:21 PM Page ii
No part of this eBook may be used or reproduced in any manner whatsoever without the publisher’s prior
written consent.
This eBook may or may not include all assets that were part of the print version. The publisher reserves the
right to remove any material present in this eBook at any time.
ISBN 9788177584554
eISBN 9788131799772
Head Office: A-8(A), Sector 62, Knowledge Boulevard, 7th Floor, NOIDA 201 309, India
Registered Office: 11 Local Shopping Centre, Panchsheel Park, New Delhi 110 017, India
udayakumar_fm.qxp 4/16/2008 4:21 PM Page iii
Dedicated to
the Goddess of Learning
udayakumar_fm.qxp 4/16/2008 4:21 PM Page iv
Contents
vi
8.3 Instructions to Perform 12. Addressing of I/O Ports 125
‘EXCLUSIVE OR’ Operation 80
8.4 Instruction to Complement 12.1 Need for I/O Ports 125
Accumulator 82 12.2 IN and OUT Instructions 127
8.5 Instructions to Complement/Set ‘Cy’ 12.3 Memory-Mapped I/O 128
Flag 82 12.4 I/O-Mapped I/O 129
Contents
vii
15.3 Generation of .OBJ File using a 17.5 Bubble Sort in Ascending/Descending
Cross-Assembler 195 Order as per Choice 259
15.4 Generation of .HEX File using a 17.6 Selection Sort in Ascending/Descending
Linker 197 Order as per Choice 263
15.5 Downloading the Machine Code to 17.7 Add Contents of N Word
the Kit 199 Locations 266
Contents
15.6 Running the Downloaded Program 17.8 Multiply Two 8-Bit Numbers (Shift
on the Kit 201 and Add Method) 268
15.7 Running the Program using the PC 17.9 Multiply two 2-Digit BCD
as a Terminal 201 Numbers 270
Questions 204 17.10 Multiply two 16-Bit Binary
Numbers 272
Questions 276
16. Additional Assembly Language
Programs 205
16.1 Search for a Number using Linear Part III
Search 206
16.2 Find the Smallest Number 208 PROGRAMMABLE AND NON-
16.3 Compute the HCF of Two 8-Bit PROGRAMMABLE I/O PORTS 275
Numbers 210
16.4 Check for ‘2 out of 5’ Code 212 18. Interrupts In 8085 277
16.5 Convert ASCII to Binary 214 18.1 Data Transfer Schemes 278
16.6 Convert Binary to ASCII 216 18.2 General Discussion about 8085
16.7 Convert BCD to Binary 218 Interrupts 283
16.8 Convert Binary to BCD 221 18.3 EI and DI Instructions 285
16.9 Check for Palindrome 228 18.4 INTR and INTA* Pins 288
16.10 Compute the LCM of Two 8-Bit 18.5 RST5.5 and RST6.5 Pins 291
Numbers 230 18.6 RST7.5 Pin 292
16.11 Sort Numbers using Bubble 18.7 Trap Interrupt Pin 293
Sort 233 18.8 Execution of ‘DAD rp’
16.12 Sort Numbers using Selection Instruction 296
Sort 235 18.9 SIM and RIM Instructions 297
16.13 Simulate Decimal up Counter 237 18.10 HLT Instruction 302
16.14 Simulate Decimal down 18.11 Programs using Interrupts 302
Counter 240 Questions 310
16.15 Display Alternately 00 and FF in
the Data Field 241 19. 8212 Non-Programmable 8-Bit
16.16 Simulate a Real-Time Clock 243 I/O Port 311
Questions 246 19.1 Working of 8212 311
19.2 Applications of 8212 315
17. More Complex Assembly Questions 322
Language Programs 247
20. 8255 Programmable Peripheral
17.1 Subtract Multi-Byte BCD
Numbers 248
Interface Chip 323
17.2 Convert 16-Bit Binary to BCD 250 20.1 Description of 8255 PPI 323
17.3 Do an operation on Two Numbers 20.2 Operational Modes of 8255 327
Based on the Value of X 252 20.3 Control Port of 8255 328
17.4 Do an Operation on Two BCD 20.4 Mode 1–Strobed I/O 331
Numbers Based on the Value 20.5 Mode 2–Bi-Directional I/O 340
of X 255 Questions 342
udayakumar_fm.qxp 4/16/2008 4:21 PM Page viii
viii
ix
27.4 Addressing Modes of Z-80 499 29.4 Data Memory Structure 551
27.5 Special Instruction Types 506 29.5 Programmer’s View of 8051 556
27.6 Pins of Z-80 517 29.6 Addressing Modes of 8051 557
27.7 Interrupt Structure in Z-80 519 29.7 Instruction Set of 8051 560
27.8 Programming Examples 524 29.8 Programming Examples 568
27.9 Instruction Set Summary 527 Questions 573
Contents
Questions 528
30. Advanced Topics
28. Motorola M6800
in 8051 574
Microprocessor 529
30.1 Interrupt Structure of 8051 575
28.1 Pin Description of 6800 530 30.2 Timers of 8051 579
28.2 Programmer’s View of 6800 531 30.3 Serial Interface 584
28.3 Addressing Modes of 6800 533 30.4 Structure and Operation of
28.4 Instruction Set of 6800 536 Ports 591
28.5 Interrupts of 6800 540 30.5 Power Saving Modes of 8051 595
28.6 Programming Examples 542 30.6 Programming of EPROM in
Questions 545 8751BH 597
Questions 600
29. 8051 Microcontroller 546
29.1 Main Features of Intel 8051 547 Bibliography 601
29.2 Functional Blocks of Intel 8051 548
29.3 Program Memory Structure 550 Index 603
udayakumar_fm.qxp 4/16/2008 4:21 PM Page x
Preface
Microprocessors, microcontrollers, and digital signal processor chips are used in business machines,
automotive electronics, home appliances, electronic toys, and a variety of industrial applications. In
this book, we confine ourselves to the study of 8-bit microprocessors Intel 8085, Zilog Z-80 and
Motorola 6800, as well as the popular 8-bit microcontroller—the Intel 8051.
This book has been written after teaching the subject of microprocessors for more than two
decades, keeping in mind the difficulties faced by students in grasping the subject. We have pre-
sented the material in a lucid language, using short, simple sentences to facilitate easy reading and
understanding. Each concept has been articulated with a number of examples with emphasis on clar-
ity, in a logical sequence. To this end, the book is divided into four parts. The first part consists of
Chapters 1 to 13, and deals with the fundamentals of a microprocessor. Chapters 14 to17 make up
the second part, and focuses on assembly language programs. The programmable and non-program-
mable ports are examined in part three from Chapters 18 to 21, while the concluding portion of the
book, consisting of Chapters 22 to 30 deals with support chips.
Chapter 1 introduces the developments in electronics starting with the transistor and the early inte-
grated circuits and provides an insight into the evolution of microprocessors, microcontrollers and
digital signal processors.
Chapter 2 familiarizes students with the various parts of a computer, their main functions and the
evolution of computer languages.
Chapter 3 explains clearly the unsigned and the various signed number representations for integers
and provides an overview of signed floating-point numbers.
Chapter 4 touches upon the history of the microprocessor and deals with the fundamentals of the
8085 microprocessor, which is the main focus of this book. The various registers and the program-
mer’s view of 8085 are also introduced here.
Chapter 5 describes a typical 8085-microprocessor kit and its usage by indicating the steps needed
to write and execute a simple assembly language program.
Chapter 6 gives the classification of 8085 instructions and elaborates on the data transfer group of
instructions with meaningful examples. The various addressing modes of 8085 are also explained.
Chapter 7 deals with the arithmetic group of instructions and explains the various flags used in the
8085 microprocessor.
Chapters 8 to 10 focus on the logical, stack, and branch group of instructions respectively, explain-
ing them with suitable examples.
Chapter 11 dwells on the concept of chip selection and the use of 74138 to generate chip select
logic.
Chapter 12 discusses the need for I/O ports, their addressing and compares I/O mapped I/O with
memory mapped I/O.
Chapter 13 furnishes a detailed architecture of 8085, and explains the various machine cycles
needed for executing a variety of instructions.
Chapter 14 explains simple assembly language programs that are executed on a microprocessor kit
and also illustrates some of the commonly used monitor routines.
udayakumar_fm.qxp 4/16/2008 4:21 PM Page xii
xii
Chapter 15 brings out the use of a personal computer in writing an assembly language program,
translating it to machine language using an assembler, and then downloading it to the microprocessor
kit for execution.
Chapter 16 deals with complex assembly language programs. For these programs students have to
use the PC to enter the program, do the translation using the assembler, download the machine code
Preface
to the microprocessor kit, and run the program using the commands issued by the PC in serial mode.
Chapter 17 is about more complex assembly language problems. For each of these problems, the
flowchart and the program are provided along with trace for test data. This simplifies the understand-
ing of the given solution.
Chapter 18 expounds on data transfer schemes and discusses in detail about the use of interrupts in
the 8085 microprocessor. The interrupt related instructions are explained here, and we look at a num-
ber of assembly language programs that make use of interrupts.
Chapter 19 presents a detailed explanation of the working and application of the Intel 8212—a non-
programmable I/O port.
Chapter 20 is about the popular Intel 8255—a programmable peripheral interface chip. The
description, operational modes and the control words are delineated.
Chapter 21 describes some of the commonly used interface modules like logic controller, analog-
to-digital converter, digital-to-analog converter and stepper motor. A number of interesting programs
using these interface modules are illustrated.
Chapter 22 first deals with interfacing 7-segment display and matrix keyboard using latches and
tri-state gates. Then the Intel 8279—the programmable keyboard and display controller chip is
described at length. A number of useful routines using the 8279 chip are also explained.
Chapter 23 is about the Intel 8259—the programmable interrupt controller. It gives an overview of
the working of 8259, and explains the function of its pins and the programming of 8259 with and with-
out slave 8259s.
Chapter 24 covers the programmable DMA Controller—the Intel 8257. In this chapter the concept
of Direct Memory Access (DMA), the DMA controller chip and its programming are examined in
depth.
Chapter 25 describes the Intel 8253—a programmable interval timer. It explains the need for a pro-
grammable timer and succinctly spells out the various modes of operation of 8253.
Chapter 26 examines the Intel 8251—the Universal Synchronous Asynchronous Receiver Trans-
mitter (USART). It explains the asynchronous and synchronous modes of transmission and reception,
and describes the programming of the 8251.
Chapter 27 reviews the Zilog Z-80 microprocessor. With an in-depth knowledge of the 8085
microprocessor acquired from the first 26 chapters, students would be in a position to understand the
programmer’s view, new addressing modes, and the new instruction types available in Z-80. The
chapter ends with a few programming examples that provide a critical comparison of the Z-80 and
the Intel 8085.
Chapter 28 talks about the M6800 microprocessor from Motorola, which has a very simple archi-
tecture compared to 8085 or the Z-80. It describes the pins, the programmer’s view, addressing modes,
and the instruction set of M6800 and ends with a few programming examples that demonstrate its
power in spite of its simplicity.
Chapter 29 is devoted to the popular Intel 8051 microcontroller. It discusses the basics of the 8051
providing details about its functional blocks, the programmer’s view, addressing modes, and the
instruction set. A number of assembly language programming examples are provided to make students
comfortable with the instruction set of 8051.
Chapter 30, the concluding chapter, reviews the advanced topics in 8051. It deals with the interrupt
structure, timers, serial interface, structure and operation of ports, and power saving modes of 8051.
udayakumar_fm.qxp 4/16/2008 4:21 PM Page xiii
xiii
The chapter ends with the programming of EPROM in 8751, which is the EPROM version of the 8051
microcontroller.
Comments and feedback on the various topics discussed in this book are welcome.
ACKNOWLEDGEMENTS
Preface
The authors are grateful for the timely help, encouragement and support extended by Narayan Rao R.
Maanay, Secretary, B.N.M. Institute of Technology, as well as Prof. T.J. Rama Murthy, Director, and
Dr. K. Ranga, Dean of the institution. They are thankful to the reviewers for their constructive sug-
gestions, which helped in enhancing the contents of this book. Finally, the authors are indebted to their
family members for their encouragement and forbearance.
K. Udaya Kumar
B. S. Umashankar
udayakumar_fm.qxp 4/16/2008 4:21 PM Page xiv
T
o return to Faust and Schoeffer. After the lawsuit, as we have
seen, they mostly ignored the existence and services of
Gutenberg. Soon after the memorable separation, Faust
went to Paris as before related, the sales of Bibles in Germany alone
being so limited as to bring in but small returns for the money
invested. It was evidently necessary to take extraordinary measures
to meet the emergency. In Faust’s cool, business-like view,
everything would be lost, unless some speedy and marked success
was attained. His experiments resulted better even than he had
anticipated; and returning flush with money, the printing rooms soon
presented a scene of unwonted activity. The “Litterariæ
Indulgentiæ,” with which Schoeffer and his journeymen had busied
themselves during Faust’s absence, was urged through the press and
into the market.
Wynken·de·Worde
O
n inquiring more closely respecting the peculiarities of the first
printed books and the modes of producing them, we find
that they were generally large or small folios or quartos;
lesser sizes than these not being in use. In some cases they had no
title, number of pages, or paragraph divisions. The character
employed was designed to imitate the hand-writing of the time, a
rude old Gothic or German, from which the old English was formed,
now known as German text. The words were printed so closely
together as to make reading difficult even by those accustomed to it,
while one unpracticed got on slowly and with many blunders.
CELEBRATION AT MENTZ.
“The modes in which a large population displays its enthusiasm
are pretty much the same throughout the world. If the sentiment
which collects men together be very heart-stirring, it will be seen in
the outward manifestations. Thus processions, orations, public
dinners, and pageantries, which in themselves are vain and empty,
are important when the persons whom they collect together are
moved by one common feeling, which sways them for the time.
“We never saw such a popular fervor as prevailed at Mentz, at
the festival of August 1857. The statue was to be uncovered on
Monday the 14th; but on Sunday evening the name of Gutenberg
was rife through the streets. In the morning, all Mentz was in motion
by six o’clock; and at eight, a procession was formed to the
Cathedral, which, if it was not much more imposing than some of
the processions of trades in London and other cities, was conducted
with a quiet precision which evinced that the people felt that they
were engaged in a solemn act. The fine old Cathedral was crowded;
the Bishop of Mentz performed High Mass; the first Bible printed by
Gutenberg was displayed. What a field for reflection was here
opened! The first Bible in connection with the imposing pageantries
of Roman Catholicism,—the Bible in great part a sealed book to the
body of the people; the service of God in a tongue unknown to the
larger number of worshippers; but that first Bible the germ of
millions of Bibles that have spread the light of Christ throughout the
veritable globe!
“The mass ended, the procession again advanced to an adjacent
square, where the statue was to be opened. Here was erected a vast
amphitheatre, where, seated under their respective banners, were
deputations from all the great cities of Europe. Amidst salvos of
artillery the veil was removed from the statue, and a hymn sung by
a thousand voices. Then came orations, then dinners, balls, orations,
boat-races, processions by torch light. For three days the population
of Mentz was kept in a state of high excitement, the echo of which
went through Germany, and “Gutenberg! Gutenberg!” was toasted in
many a bumper of Rhenish wine amidst this cordial and enthusiastic
people.
“And, indeed, even in one who could not boast of belonging to
the land in which printing was invented, the universal and mighty
effects of this art, when rightly considered, would produce almost a
corresponding enthusiasm. It is difficult to look upon the great
changes that have been effected during the last four centuries, and
which are still in progress everywhere around us, and not connect
them with printing and its inventor. The castles on the Rhine, under
whose ruins we travelled back from Mentz, perished before the
powerful combinations of the people of the towns. The petty feudal
despots fell when the burghers had acquired wealth and knowledge.
But the progress of despotism on a larger scale could not have been
arrested, had the art of Gutenberg not been discovered. The
strongholds of military power still frown over the same majestic river.
The Rhine has seen its petty fortresses crumble into decay.
Ehrenbreitstein is stronger than ever. But even Ehrenbreitstein will
fall before the powers of the mind. Seeing, then, what, under God,
intellect has done and is doing, we may well venerate the memory of
Gutenberg of Mentz.”
XXI.
Modes of making Type.—Varieties of Type.—Cylindrical Ink-distributor.—A Modern
Printing Establishment.—Composition Room.—Cases.—Proof-reading.
L
et us now glance at the Art of Printing in modern times.
In the making of types, formerly each letter was cast, and then
finished one at a time, by hand. Now there is a process of manufacturing the
copper face by machinery, the operation being effected by the pressure of a
sharp die upon copper. And it is said that a small steam-engine can produce
one type a second, or thirty-six thousand in ten hours.
By the more ordinary process, types are made by casting type-metal in a
mould, though some of the larger sizes are manufactured from maple,
mahogany, or box-wood. The process of casting type, which is the business of
the type-founders, requires great skill. In the first place, a punch is cut, of the
letter to be formed, except that it is in reverse. The punch being of hardened
steel, and having this letter on its point, is then struck into a small piece of
copper, which is called the matrix, or form of the letter to be cast. The matrix is
now fixed in a curiously contrived instrument, termed the mould, attached to a
compact hand machine, having in the centre a small furnace of burning coal to
keep the vessel of type-metal over it liquid. The workman turns a wheel, thus
forcing melted metal into the mould, which quickly shapes and drops one after
another the types, perfect, save polishing. In some foundries there are twenty
of these machines. In this way not only every letter, but every figure, hyphen,
comma, or other mark, must have its punch and matrix, as well as its separate
casting. One machine will cast one hundred types a minute.
In the cut, a is the body; b, the face, or part from which the impression is
taken; c, the shoulder, or top of the body; d, the nick, designed to assist the
compositor in distinguishing the bottom of the face from the top; and e, the
groove made in the process of finishing.
As soon as a heap of types is cast, a boy takes them away, and breaks off
the superfluous piece at the end of each, when another rubs its sides on a
stone, to render it smooth. The face, or printing part of the type, is not
touched after it leaves the matrix, that giving it all the
distinctness and sharpness of which it is capable.
Type-metal is a compound of lead and antimony, in the
proportion of three to one, with a small portion of tin, and
sometimes a little copper.
In Gutenberg’s day types were necessarily an imitation of
the handwriting of the monk-copyists, with little variety and
beauty. Now the types which compose an ordinary book-
fount consist of Roman CAPITALS, small capitals, and lower-
Metal Type. case letters, and Italic capitals and lower-case letters, with
accompanying figures, points and reference-marks,—in all
about two hundred characters. Including the various modern styles of fancy
types, some three or four hundred varieties of face are made. Besides the
ordinary Roman and Italic, the most important of the varieties are
The smallest body in common use is diamond; then follow, in order of size
as below—
Diamond. abcdefghijklmnopqrstuvwxyz
Pearl. abcdefghijklmnopqrstuvwxyz
Agate. abcdefghijklmnopqrstuvwxyz
Nonpariel. abcdefghijklmnopqrstuvwxyz
Minion. abcdefghijklmnopqrstuvwxyz
Brevier. abcdefghijklmnopqrstuvwxyz
Bourgeois. abcdefghijklmnopqrstuvwxyz
Long Primer. abcdefghijklmnopqrstuvwxyz
Small Pica. abcdefghijklmnopqrstuvwxyz
Pica. abcdefghijklmnopqrstuvwxyz
English. abcdefghijklmnopqrstuvwxyz
Great Primer. abcdefghijklmnopqrstu
COMPOSITION ROOM.
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
ebookultra.com