Introduction to Microprocessors DCAP210
Total Page:16
File Type:pdf, Size:1020Kb
Introduction to Microprocessors DCAP210 Edited by: Gurwinder Kaur INTRODUCTION TO MICROPROCESSORS Edited By: Gurwinder Kaur Printed by EXCEL BOOKS PRIVATE LIMITED A-45, Naraina, Phase-I, New Delhi-110028 for Lovely Professional University Phagwara SYLLABUS Introduction to Microprocessors Objectives: To develop the hardware skills required for the complete understanding of the architecture and programming of the microprocessor used in computing world. S. No. Description 1. Microprocessors, Microcomputers, and Assembly Language: Microprocessors, microprocessor Instruction Set and Computer Languages, Application 2. Introduction to 8085 Assembly Language Programming: 8085 programming model, Instruction Classification, How to write a simple program? 3. Microprocessor Architecture and Microcomputer Systems: Microprocessor architecture and its operation, Memory, I/O devices, Example of Microcomputer system 4. 8085 Microprocessor Architecture and Memory Interfacing: 8085 MPU, Memory Interfacing, How does an 8085- Based Single board Microcomputer work? 5. Interfacing I/O Devices: Basic interfacing Concepts, Interfacing output displays, Interfacing input devices, Memory Mapped I/O 6. Introduction to 8085 Instructions: Data transfer operations, Arithmetic operations, Logic operations, branch operations 7. Programming Techniques with Additional Instructions: Programming techniques: Looping, Counting and Indexing, Additional Data transfer instructions 8. Counters and Time delays: Counter and time delays, Illustrative program: Hexadecimal counter 9. Stack and Subroutines: Stack, Subroutine, Restart, Conditional call and Return Instruction 10. Interrupts: 8085 interrupts CONTENT Unit 1: Microprocessors and Microcomputers 1 Gurwinder Kaur, Lovely Professional University Unit 2: Introduction to Assembly Language 20 Gurwinder Kaur, Lovely Professional University Unit 3: Assembly Language Programming of 8085 34 Gurwinder Kaur, Lovely Professional University Unit 4: Microprocessor Architecture 53 Dinesh Kumar, Lovely Professional University Unit 5: Microcomputer System 67 Dinesh Kumar, Lovely Professional University Unit 6: The 8085 Microprocessor Architecture 77 Dinesh Kumar, Lovely Professional University Unit 7: Memory Interfacing 97 Parminder Kaur, Lovely Professional University Unit 8: Interfacing I/O Devices 110 Parminder Kaur, Lovely Professional University Unit 9: Introduction to 8085 Instructions 125 Parminder Kaur, Lovely Professional University Unit 10: Programming Techniques with Additional Instructions 137 Gurwinder Kaur, Lovely Professional University Unit 11: Counters and Time Delays 152 Gurwinder Kaur, Lovely Professional University Unit 12: The Stacks 166 Dinesh Kumar, Lovely Professional University Unit 13: Subroutines 176 Dinesh Kumar, Lovely Professional University Unit 14: Interrupts 185 Gurwinder Kaur, Lovely Professional University Corporate and Business Law 6 LOVELY PROFESSIONAL UNIVERSITY Gurwinder Kaur, Lovely Professional University Unit 1: Microprocessors and Microcomputers Unit 1: Microprocessors and Microcomputers Notes CONTENTS Objectives Introduction 1.1 Microprocessor 1.2 Microcomputer 1.2.1 Automobile Analogy 1.2.2 Intel MCS-4 4-B Chip Set 1.2.3 Intel 8008 Microprocessor 1.2.4 8080 More and No More 1.3 Historical Perspective 1.3.1 Moore’s Law 1.4 Microprocessor Instruction Set 1.4.1 Implied Addressing 1.4.2 Register Addressing 1.4.3 Immediate Addressing 1.4.4 Direct Addressing 1.4.5 Register Indirect Addressing 1.4.6 Combined Addressing Modes 1.4.7 Timing Effects of Addressing Modes 1.4.8 Decoding 1.5 Summary 1.6 Keywords 1.7 Self-Assessment Questions 1.8 Review Questions 1.9 Further Reading Objectives After studying this unit, you will able to understand the following: • Explain about microprocessor • Describe the important areas of microprocessor • Explain about microcomputer • Understand the microprocessor instruction set LOVELY PROFESSIONAL UNIVERSITY 1 Introduction to Microprocessors Notes Introduction A microprocessor, sometimes called a logic chip, is a computer processor on a microchip. The microprocessor contains all, or most of, the central processing unit (CPU) functions and is the “engine” that goes into motion when you turn your computer on. A microprocessor is designed to perform arithmetic and logic operations that make use of small number-holding areas called registers. Typical microprocessor operations include adding, subtracting, comparing two numbers, and fetching numbers from one area to another. These operations are the result of a set of instructions that are part of the microprocessor design. When your computer is turned on, the microprocessor gets the first instruction from the basic input/output system (BIOS) that comes with the computer as part of its memory. After that, either the BIOS, or the operating system that BIOS loads into computer memory, or an application program is “driving” the microprocessor, giving it instructions to perform. 1.1 Microprocessor Microprocessors are regarded as one of the most important devices in our everyday machines called computers. Before we start, we need to understand what exactly microprocessors are and their appropriate implementations. Microprocessor is an electronic circuit that functions as the central processing unit (CPU) of a computer, providing computational control. Microprocessors are also used in other advanced electronic systems, such as computer printers, automobiles, and jet airliners. Typical microprocessors incorporate arithmetic and logic functional units as well as the associated control logic, instruction processing circuitry, and a portion of the memory hierarchy. Portions of the interface logic for the input/output (I/O) and memory subsystems may also be infused, allowing cheaper overall systems. While many microprocessors have single chip designs, some high-performance designs rely on a few chips to provide multiple functional units and relatively large caches. When combined with other integrated circuits that provide storage for data and programs, often on a single semiconductor base to form a chip, the microprocessor becomes the heart of a small computer, or microcomputer. Microprocessors are classified by the semiconductor technology of their design (TTL, transistor-transistor logic; CMOS, complementary-metal-oxide semiconductor; or ECL, emitter-coupled logic), by the width of the data format (4-bit, 8-bit, 16-bit, 32-bit, or 64- bit) they process; and by their instruction set (CISC, complex-instruction-set computer, or RISC, reduced instruction set computer: see RISC processor). TTL technology is most commonly used, while CMOS is favoured for portable computers and other battery-powered devices because of its low power consumption. ECL is used where the need for its greater speed offsets the fact that Figure 1.1: Chips 2 LOVELY PROFESSIONAL UNIVERSITY Unit 1: Microprocessors and Microcomputers it consumes the most power. Four-bit devices, while inexpensive, are good only for simple control Notes applications; in general, the wider the data format, the faster and more expensive the device. CISC processors, which have 70 to several hundred instructions, are easier to program than RISC processors, but are slower and more expensive. Microprocessors have been described in many different ways. They have been compared with the brain and the heart of humans. Their operation has been likened to a switched board, and to the nervous system in an animal. They have often been called microcomputers. The original purpose of the microprocessor was to control memory. That is what they were originally designed to do, and that is what they do today. Specifically, a microprocessor is “a component that implements memory.” A microprocessor can do any information-processing task that can be expressed, precisely, as a plan. It is totally uncommitted as to what its plan will be. It is a truly general-purpose information processing for microprocessor. Computer’s performance is also influenced by the system bus architecture, memory used, type of the processor and software program being running. Pentium 4 is the fastest type of the Intel’s processor that contains 125,000,000 transistors and operates at the speed of 3.6 GHz. 1.2 Microcomputer The term microcomputer is generally synonymous with personal computer, or a computer that depends on a microprocessor. Microcomputers are designed to be used by individuals, whether in the form of PCs, workstations or notebook computers. A microcomputer contains a CPU on a microchip (the microprocessor), a memory system (typically ROM and RAM), a bus system and I/O ports, typically housed in a motherboard. Intel’s first microcomputer appeared in November 1971: Intel delivered two different microcomputers five months apart: the MCS-4, emphasizing low cost in November 1971, and the MCS-8, for versatility in April 1972. “The MCS-4 and MCS-8 CPU chip sell in quantity for less than ` 1000 each, and are powerful alternatives to random logic”. These two Microcomputer Systems (MCS) were aimed at two very different markets. One would eventually lead to the under ` 4500 controller, the other would be the engine for a versatile personal computer (PC). By analogy it was like creating the “motorbike” and the “station wagon” at the same time. The advertised prophecy of “a new era” became fulfilled over the subsequent 20-year period. 1.2.1 Automobile Analogy Our challenge was how to scale down a general purpose computer to fit on to a chip. Imagine that the only passenger vehicle in existence is an eight-passenger van costing