FUNDAMENTALS OF AND ITS APPLICATIONS

FUNDAMENTALS OF MICROPROCESSORS AND ITS APPLICATIONS [For B.E./B.Tech., BIT, BCA, MCA, AMIE, IETE and B.Sc. (Computer Science & Information Technology) Students of All Indian Universities]

ANOKH SINGH Department of Applied Electronics and Microwave Technology Pusa Institute, New Delhi

Er. A.K. CHHABRA B.Tech., MISTE Department of Electronics Engineering Directorate of Training and Technical Education, New Delhi

S. CHAND & COMPANY LTD. RAM NAGAR, NEW DELHI-110 055 S. CHAND & COMPANY LTD. (An ISO 9001 : 2000 Company) Head Office: 7361, RAM NAGAR, NEW DELHI - 110 055 Phone: 23672080-81-82, 9899107446, 9911310888 Fax: 91-11-23677446 Shop at: schandgroup.com; e-mail: [email protected] Branches : AHMEDABAD : 1st Floor, Heritage, Near Gujarat Vidhyapeeth, Ashram Road, Ahmedabad - 380 014, Ph: 27541965, 27542369, [email protected] BENGALURU : No. 6, Ahuja Chambers, 1st Cross, Kumara Krupa Road, Bengaluru - 560 001, Ph: 22268048, 22354008, [email protected] BHOPAL : 238-A, M.P. Nagar, Zone 1, Bhopal - 462 011, Ph: 4274723. [email protected] CHANDIGARH : S.C.O. 2419-20, First Floor, Sector - 22-C (Near Aroma Hotel), Chandigarh -160 022, Ph: 2725443, 2725446, [email protected] CHENNAI : 152, Anna Salai, Chennai - 600 002, Ph: 28460026, 28460027, [email protected] COIMBATORE : Plot No. 5, Rajalakshmi Nagar, Peelamedu, Coimbatore -641 004, (M) 09444228242, [email protected] CUTTACK : 1st Floor, Bhartia Tower, Badambadi, Cuttack - 753 009, Ph: 2332580; 2332581, [email protected] DEHRADUN : 1st Floor, 20, New Road, Near Dwarka Store, Dehradun - 248 001, Ph: 2711101, 2710861, [email protected] GUWAHATI : Pan Bazar, Guwahati - 781 001, Ph: 2738811, 2735640 [email protected] HYDERABAD : Padma Plaza, H.No. 3-4-630, Opp. Ratna College, Narayanaguda, Hyderabad - 500 029, Ph: 24651135, 24744815, [email protected] JAIPUR : A-14, Janta Store Shopping Complex, University Marg, Bapu Nagar, Jaipur - 302 015, Ph: 2719126, [email protected] JALANDHAR : Mai Hiran Gate, Jalandhar - 144 008, Ph: 2401630, 5000630, [email protected] JAMMU : 67/B, B-Block, Gandhi Nagar, Jammu - 180 004, (M) 09878651464 KOCHI : Kachapilly Square, Mullassery Canal Road, Er nakulam, Kochi - 682 011, Ph: 2378207, [email protected] KOLKATA : 285/J, Bipin Bihari Ganguli Street, Kolkata - 700 012, Ph: 22367459, 22373914, [email protected] LUCKNOW : Mahabeer Market, 25 Gwynne Road, Aminabad, Lucknow - 226 018, Ph: 2626801, 2284815, [email protected] MUMBAI : Blackie House, 103/5, Walchand Hirachand Marg, Opp. G.P.O., Mumbai - 400 001, Ph: 22690881, 22610885, [email protected] NAGPUR : Karnal Bag, Model Mill Chowk, Umrer Road, Nagpur - 440 032, Ph: 2723901, 2777666 [email protected] PATNA : 104, Citicentre Ashok, Govind Mitra Road, Patna - 800 004, Ph: 2300489, 2302100, [email protected] PUNE : 291/1, Ganesh Gayatri Complex, 1st Floor, Somwarpeth, Near Jain Mandir, Pune - 411 011, Ph: 64017298, [email protected] RAIPUR : Kailash Residency, Plot No. 4B, Bottle House Road, Shankar Nagar, Raipur - 492 007, Ph: 09981200834, [email protected] RANCHI : Flat No. 104, Sri Draupadi Smriti Apartments, East of Jaipal Singh Stadium, Neel Ratan Street, Upper Bazar, Ranchi - 834 001, Ph: 2208761, [email protected] VISAKHAPATNAM : Plot No. 7, 1st Floor , Allipuram Extension, Opp. Radhakrishna Towers, Seethammadhara North Extn., Visakhapatnam - 530 013, (M) 09347580841, [email protected] © 2005, Anokh Singh and A.K. Chhabra All rights reserved. No part of this publication may be reproduced, stored in a retrieval system or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording or otherwise, without the prior permission of the Publishers.

First Edition 2005 Second Revised Edition 2010 ISBN : 81-219-2474-X Code : 20A 083

PRINTED IN INDIA By Rajendra Ravindra Printers Pvt. Ltd., 7361, Ram Nagar, New Delhi -110 055 and published by S. Chand & Company Ltd., 7361, Ram Nagar, New Delhi -110 055. PREFACE TO THE REVISED SECOND EDITION

The World’s First 4004 (4–bit) came in 1971, since then many microprocessor manufacturers join the race of producing better and better versions. With the advancement in this field, till now there are FIVE generations of Microprocessor. The latest is the Processor. The an 8–bit microprocessor and 8086/8088 16–bit, third generation microprocessors are still most popular. The latest edition describes detailed study of these 8–bit, 16– bit microprocessors, its peripherals devices, interfacing circuits, assembly language programs and its applications. The revised edition also covers the salient features of 80286, 80386, 80486 and the Pentium processor. The book is designed for students of all disciplines studying in Engineering colleges and technical universities. Also useful for students of MCA, BCA, BIT, BIS, BSC (Electronics, Computer Sciences) AMIE, AMIETE, degree, diploma and other competitive examinations. I hope this edition will meet the latest syllabus of all Universities, Engineering Colleges and Technical Universities. The book is presented in simple and easy to understand language with large number of illustrations. A good number of valuable suggestions were received from the subject experts which have been in-corporated in this revised edition. I am thankful to Dr. Amita Dev, Principal BPIBS, New Delhi; Sh. P.P. Chaitre, Shri Kant Patel Lecturers BPIBS and Ms S. Chawla, Ms. Shivani Neb, John Dev Kumar, D. Misra, Shiv Ratan Singh Lecturers, Delhi for their valuable suggestions. I also thank my wife Raj Rani for her constant encouragement and helping hand in checking the manuscript. The author is thankful to Mrs. Nirmala Gupta, Chairperson & Managing Director; Mr. Navin Joshi, Vice President (Publishing) and entire editorial department of S.Chand & Company Ltd. for printing this revised edition in an attractive format. While every care has been taken to present an error free text, but sometimes errors do creep in unintentionally, for which I have to depend on our esteemed students, teachers for their feed back. The advice and suggestions from subject experts are welcome to improve the text and will be highly appreciated.

Er. A.K. CHHABRA

(v)

CONTENTS

1. INTRODUCTION TO MICROPROCESSOR 1–27 1.1 Introduction 1 1.2 Microprocessor Development (Evolution/History) 1 1.3 Differences between microprocessor microcomputer and 4 1.4 The Microprocessor 4 1.5 Microprocessor System Architecture 4 1.6 Microprocessor Organisation 12 1.7 Instructions 13 1.8 μP–System Design And Development 15 1.9 System Design Kits 20 1.10 Software Development Aids 23 Summary 24 Objective Type Questions 25 Review Questions 26 2. 8-BIT MICROPROCESSOR (TYPE-8085 INTEL) 28–100 2.1 Introduction 28 2.2 Intel–8085 Architecture 30 2.3 Pin Configuration 34 2.4 Instruction Execution And Data Flow in 8085 35 2.5 8085 Processor Cycles 35 2.6 Addressing Modes 39 2.7 Halting operation 40 2.8 Instruction Format of 8085 40 2.9 Instruction Set Encyclopedia 41 (Data Transfer Group, Arithmetic Instruction, Logical Instruction, Branching Instruction, Machine Control Instruction.) 2.10 Interrupt Control System 73 2.11 Polling of Interrupts 78 2.12 INTR And Its Expansion 80 2.13 Memory Interfacing 83 2.14 Data Tansfer Scheme 93 Summary 94 Objective Type Questions 95 Review Questions 98 3. ASSEMBLY LANGUAGE PROGRAMMING 101–186 3.1 Introduction 101 3.2 Language of Instruction for microprocessor 102 Machine language assembly language 103 3.3 Assembly language development 103 3.4 Design of an Assembler 104 3.5 Debugger 107 3.6 Simulator 107 (vii) (viii) 3.7 Emulator 107 3.8 Summary of the Assembly Language Development Tools 108 3.9 Flow chart 108 3.10 Flow chart symbol 108 3.11 How to Write and execute Assembly language program 110 3.12 Programming Examples 110 Examples 3.1 to Examples 3.42 110–159 3.13 Implementation time of a program 160 Examples 3.37 to Examples 3.42 161–169 3.14 Assembler Programming 169 Examples 3.43 to Examples 3.44 172 3.15 Common code conversion in microprocessor 173 Summary 179 Objective Type Questions 179 Review Questions 181 4. PERIPHERAL DEVICES 187–228 4.1 Introduction 187 4.2 Programmable Peripheral Interface (PPI) 187 4.3 Programmable DMA controller INTEL 8237A 196 4.4 DMA controller 8257 197 4.5 Programmable Interrupt Controller (PIC) 202 (INTEL–8059) 4.6 Programmable Interval Timer (INTEL 8253/8254) 205 4.7 Serial Communication Interfaces 209 4.8 Programmable Communication Interface 210 (INTEL 8251A) USART 4.9 Programmable keyboard/Display Interface (INTEL 8279) 214 4.10 Other Peripherals 219 (1) INTEL 8212 219 (2) INTEL 8155/8156 220 (3) INTEL 8755 222 (4) RS–232C (Serial communication standards) 222 Summary 224 Objective Type Questions 224 Review Questions 226 5. MICROPROCESSORS 229–259 5.1 Introduction 229 5.2 Features of 8086 229 5.3 8086 Internal Architecture 230 5.4 Pin Configuration And Description of 8086 237 5.5 Intel–8086 Addressing Modes 243 5.6 Multiprogramming 245 5.7 Multiprocessing 246 5.8 Intel–8086 operation 246 5.9 Instruction Format 248 5.10 8086 Instruction 249 5.11 Assembly Language Programs 252 (ix) 5.12 Numeric Data Processor (NDP) 255 Summary 257 Objective Type Questions 257 Review Questions 258 6. SOME OTHER MICROPROCESSOR 260–285 6.1 Introduction 260 6.2 Intel–80186 260 6.3 Intel–80286 261 6.4 Intel–80386 264 6.5 Intel–80486 268 6.6 Intel–8088 270 6.7 Intel–80188/Intel–80186 272 6.8 Zilog Z–80 272 6.9 Zilog Z–8000 275 6.10 Motorola 6800 and 6809 275 6.11 MC – 68000 277 6.12 6502 280 6.13 Pentium Processor 281 Summary 283 Objective Type Questions 284 Review Questions 285 7. MICROPROCESSOR APPLICATIONS 286–298 7.1 Introduction 286 7.2 Some Applications of Microprocessor 1. Temperature Control System 286 2. Motor (D.C) Speed Control System 288 3. Traffic Light Control System 290 4. Stepper Motor Control System 294 5. Microprocessor Based Water Level Indicator 295 6. Washing Machine Controller 296 Summary 297 Review Questions 298 APPENDICES 299-305 Appendix A : 8085 Instruction in Alphabetical order 299 Appendix B : 8085 Instruction in Hexadecimal order 302 Appendix C : 8086 Instruction Set 304

INDEX 306–308

1

INTRODUCTION TO MICROPROCESSOR

1.1. INTRODUCTION The term ‘microprocessor’ came into existence, in 1971, when the Intel Corporation of America, developed the first microprocessor (INTEL-4004) which is a 4-bit microprocessor ( μP). Essentially, a microprocessor is a digital circuit, consisting of thousands of component, on a silicon-chip, with capabilities similar to the (CPU) of a computer . As such, a system, with μP as an integral part, is term as a μP-based system. When a computer is μP- based, it is called a micro-computer ( μC). A micro-processor is specified by its ‘word-size’, e.g., 4-bit, 8-bit, 16-bit etc. By the term ‘word-size’, we mean the number of bits of data, that is processed by the μP as a unit. For example, an 8-bit μP performs various operations on 8-bit data. It also specifies the width of the data-bus. Thus, a μC consists of input/output devices, and memory , in addition to μP, which acts its CPU. The CPU is, as a matter of fact, the brain of a digital-computer , where arithmetic and logical operations are carried out, or from where other sections of a computing machine are controlled. CPU is commonly used to refer to microprocessor ( μP), and so is sometimes also called as main processing unit (MPU). 1.2. MICRO-PROCESSOR DEVELOPMENT (EVOLUTION/HISTORY) The ancient Babylonians first began using the abacus (using beads) near about 500 BC. This simple and primitive calculating machine eventually sparked human-mind to develop better and better calculating machine using gears and wheels (ref. Blaise Pascal in 1624 A.D.). Refinement continued, we had the giant machines of the 1940’ s and 1950’ s using relays and vacuum tubes. Then came the age of transistors and solid-state electronics. Finally , the advent of IC technology led to the development of the μP in 1971 (), a 4-bit μP. It had an instruction set of 45-dif ferent instructions using PMOS technology . It was soon followed by a variety of μPs by different manufacturers. Thus, the 1971-μP 4004, we call as the FIRST GENERATION MICRO-PROCESSOR. The PMOS-technology gave low cost but low speed, not compatiable with TTL-levels (Transistor – Transistor – Logic Levels). It has to use as much as 30 ICs to form a system. We had, besides INTEL-4004, INTEL-4040, FAIR-CHILD PPS-25, NATIONAL IMP-4, ROCKWELL PPP-4 and NTL- MC-1 — all 4-bit μPs.

1 2 FUNDAMENTALS OF MICR OPROCESSORS & ITS APPLICA TIONS

With further improvement in technology , 8 and 16-bit μPs also came and the important one were as follows: (A) 8-bit μμμPs (B) 16-bit μμμPs INTEL-8008 NATIONAL IMP-16 NATIONAL-IMP-8 NATIONAL PACE ROCK-WELL-PPS-8 AMI-7200 MOS-TEK-5065 All these μPs belong to the FIRST-GENERATION of μPs. (1971 to 1973). Second Generation μPs appeared in 1973 and used NMOS-technology , which offered faster speed, highers density and still better reliability . They had (i) larger chip size (170 × 200 mils), ( ii) 40 pins, ( iii) more number of on-chip decoded timing-signals, ( iv) ability to address larger memory spaces, ( v) ability to address more I/O ports, ( vi) faster operation, ( vii) more powerful instruction set, ( viii) a greater number of levels of sub-routine nesting and ( ix) better interrupt handling capabilities. Some of the important second-generation μPs are as follows: (A) 8-bit μμμPs (B) 12-bit μμμPs (C) 16-bit μμμPs INTEL-8080 INTERSIL-6100 DATA GENERALμP-601 INTEL-8085 TOSHIBA TLCS-12 GENERAL INSTRUMENT-CP1600 FAIR-CHILD-F8 DEC-WD MCP-1600 MOTOROLA-M-6800 ILTMS-9900 MOTOROLA-M-6809 NATIONAL CMP-8 RCA-COS-MAC MOS-TECH, 6500/6502 SIGNETICS-2650 ZILOG-Z-80 After 1978, the third generation of μPs was introduced. All these were 16-bit μPs and designed using HMOS (High density MOS) technology , which of fered better speed and higher packing density then NMOS. The chief characteristics of the μPs were: (1) had 40/48/64 pins, (2) High-speed and very strong processing capability , (3) easier to program, (4) allow for dynamically relocateble programs, (5) size of the internal register was 8/16/32 bits, (6) The μPs had the multiply/divide arithmetic hardware, (7) Physical memory space was from 1 to 16 Mega-bytes, (8) Segmented address and virtual memory features, (9) Flexible 10 port addresses, (10) More powerful Interrupt hardware capabilities. Some of the important third-generation, μPs were as follows: INTEL-8086 MOTOROLA-68000 ZILO-Z-8000 INTEL-8088 MOTOROLA-68010 Notes: These μPs had in Speed Power INTEL-80186 NATIONAL NS-16016 Product = (Speed × Power) = Pica-Joule INTEL-80286 TEXAS INSTRUMENTS- and packing density of 4128 gates/ μm2 TMS-99000 [one μm = 10–4 m] Then in 1980, were introduce the fourth-generation of μPs, which were all of 32-bit type, using low-power version of HMOS technology (HCMOS). This change made the unit time sophiscated, competing with mainframe ones. Some of the important fifth generation μPs are: INTRODUCTION TO MICROPROCESSOR 3

INTEL-80386 MOTOROLA-M68030 INTEL-80486 BELL-MAC-32 MOTOROLA-MC-88100 MOTOROLA-M-68020 The chief characteristics of these μPs are: (1) Physical Memory Space of 2 24 = 16 MB, (2) Virtual Memory Space of 2 10 bytes (= 1 Tera Byte), (3) Floating-point hardware has been incorporated and (4) Support increased number of . INTEL is thus modified in developing more and more new processors. The latest INTEL- PENTIUM is considered as the fifth-generation μP, is a 64-bit μP, with maximum clock-speed upto 266 MHz. With better and better and more advanced technology the speed of μPs has increased tremensouly. The old 8085 of 1977 executed 0.5 Million instruction/sec (5MIPS), while the 80486 executes 54 Million instruction per sec, and the pentium P4 executs 100 MIPS. The Pentium microprocessor was intriduced in the year 1993, it was similar to the 80386 and 80486 processor. This was originelly labelled as the or 80586. The two version of the pentium processor operates with clock frequencies of 60 MHZ and 66 MHZ, with a speed of 110 MIPS. The pentium contains 16K byte cache memory (8K byte instruction cache and 8K byte data cache). The memory size of pentium is 4 G bytes and data bus width is 64 bits. These pentium also includes the multimedia instruction called MMX instruction. Recently Intel releated the Pentium over Drive model (P24T) similar to processor 40486 which operate at a clock frequently of 63 or 83 MHZ. It is a dual integer processor . It executes two instructure per clock period similteneously which are not dependent on eaxh other , which works on super scular technology . Now Intel Plans to launch microprocessor with 128 bit databus.

1.2.1 Applications of Microprocessor The first-generaion μPs were mainly used in (1) Calculators, (2) Game medium, (3) Home Appliances, (4) Accounting System, (5) Intelligent Instrumentation and (6) Low and Special- purpose application. The second-generation μP made it possible to use them in (1) Complex Industrial Controller, (2) Process-Control System (3) Better instrumentation and (4) Military Appliances. The third-generation μPs entered deeper into business and data-aquisition applications and sophisticated Real Time Control. The fourth-generation μPs are being used in multi-user, multi-applications environment, of fice-information equipment and general-purpose computing application (main frame-type). The latest version of microprocessor finds applications in Robotics, process control systems aircraft flight control system satellite launching systems. Microprocessor are also being used in auto industry to control the efficient burning of the fuel. The use of microprocessor has increased in home appliances and consumer products (Microwave even, washing machine etc.)

1.2.2 Impact of Microprocessor on Modern Society The advent of microprocessor has revolutionised the whole world. It has increased the speed of operation of various process-control system. It has simplify the design of various industrial products, results are more accurate. It has reduced the size of the equipments. The man-power requirements has reduced. The use of microprocessor in auto industry has saved the fuel. 4 FUNDAMENTALS OF MICR OPROCESSORS & ITS APPLICA TIONS

1.3 DIFFERENCE BETWEEN MICROPROCESSOR MICROCOMPUTER AND MICROCONTROLLER The microprocessor is CPU on a single chip. It is manufactured by using large scale Integration (LSI) technique. It includes the ALU, small memory, register arrays on a single chip. The example of microprocessor are INTEL 8085, 8086, 8088, Z80, Motorola’ s MC 6800, Zilog’s Z8000, , 80386 etc. A microcomputer is designed using a microprocessor as its CPU, alongwith input device, output device and memory . It is a computer that can perform arithmetic and logical operations. Microcomputer can be designed using 8-bit, 16-bit or 32-bit microprocessor . If it uses 8085 processor then it is called as a 8085 based microcomputer if it uses 8086 processor , then it is called as 8086 based microcomputer. A microcontroller is designed to include all the features found in microprocessor alongwith memory, I/O signal lines on a single chip using VLSI technology. The prime use of a microcontroller is to control the operation of an industrial machine using a fixed program stored in a ROM of microcontroller and that does not change over the life time of the system. The examples of microcontroller are Intel 8048 , , Intel 8096 and Montorola MC 68HC11.

1.4 THE MICROPROCESSOR The microprocessor is a CPU on a single chip. It is the controlling element in a computer system. The microprocessor controls memory and I/O devices through a series of interconnected lines known as buses. A bus is a group of wires, that interconnect dif ferent component in a microprocessor based computer system (i.e RAM ROM and I/O divices). The three buses are address bus data bus and control bus . The microprocessor buses select an I/O device or memory, transfer data between I/O device or memory and vice verse through CPU. The I/O device and memory are controlled through instruction that are stored in the memory and executed by the microprocessor. The microprocessor performs three main functions namely (i) data transfer between processor and memory or I/O device (ii) Simple arithemetic and logical operation such as addition subtraction, multiplaction, devision, Anding, oring, negative shift, rolate etc. (iii) program flow as per instruction or dicision.

1.5 MICROPROCESSOR SYSTEM ARCHITECTURE A microprocessor is a programme-controlled device, which fetches (from memory), decodes and executes instructions. Most μP are simple single chip devices. The basic units or blocks of a μP are (1) ALU (Arithmetic Logic Unit) Sub-system, (2) Memory Sub-system, (3) Input/Output Sub- system and (4) Control Unit. We now take four sub-system, one by one. 1.5.1 ALU sub-system The microprocessor is identified with the size of its data-bit, the ALU can work with data at a time. For example, INTEL-8085 processor has a 8-bit ALU, hence, it is called a 8-bit μP. The INTEL-8086 has 16-bit ALU, and so it is called a 16-bit μP. (4-bit, i.e., 4-digit) binary number or code is called NIBBLE, while the 8-bit are called a BYTE, and the 16-bit as WORD. The ALU is responsible to perform 16 (sixteen) arithmetic and 16 (sixteen) logic operations on the data stored in a general-purpose register , within the CPU or in a memory device, on two 4- bit variables. Important operations are (1) ADD, (2) SUBTRACT, (3) COMPARE, (4) DOUBLE, (5) Fundamental Of Microprocessors And Its Application

20% OFF

Publisher : SChand Publications ISBN : 9788121924740 Author : A K Chhabra

Type the URL : http://www.kopykitab.com/product/10744

Get this eBook