0% found this document useful (0 votes)
20 views47 pages

Print Microprocessor

microbhyvgt

Uploaded by

SUMAN YADAV
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download as pdf
0% found this document useful (0 votes)
20 views47 pages

Print Microprocessor

microbhyvgt

Uploaded by

SUMAN YADAV
Copyright
© © All Rights Reserved
Available Formats
Download as PDF or read online on Scribd
Download as pdf
Download as pdf
You are on page 1/ 47
Microprocessors, Microcomputers, and Assembly Language The mictocomputer plays a significant role in the everyday functioning of industrialized societies. The auicrocomputer is no different from any other com- puiter in its basic structare. In the 1960s, computers were accessible and affordable only to such institu- tions as large corporations, universities, and govern- iment agencies. Today because of advances in semi- conductor technology, the million-dollar computing capacity of the 1960s is now available for tess than five doltars in an integrated circuit called the micro- Processor. The microprocessor can be defined as & programmable logic device that can be used to con- trol processes, to turn devices on or off, or as a data processing unit of a computer. A computer that is designed using the microprocessor is called a micro computer. This chapter introduces the basic struc- ture of a computer and shows how the same structure is applicable to microprocessor-based products. Lat- er in the chapter, microcomputer applications in an industrial environment are presented in the context of the entire spectrum of various computer applica tions. ‘The microprocessor communicates and oper ates in the binary numbers 0 and 1, called bits, Each microprocessor has a fixed set of instructions ia the form of binary patterns called a machine language. However, it is difficult for humans to communicate in the language of Os and 1s. Therefore, the binary insteuctions are given abbseviated names, called mnemonics, which form the assembly Language for a given microprocessor. ‘This chapter explains both the machine language and! the assembly Language of the microprocessor known as the Z80. The sdvan- tages of assembly language ae compared with such English-like Languages as BASIC and FORTRAN. 4 MIGROPROGESSOR ARCHIFECTURE AND INTERFACING OBJECTIVES 3 Draw a block diagram of a microprocessor-based 9 Explain the difference between the machine Jan- system and explain the functions of each compo- guage and the assembly language of a com- nent: microprocessor, memory, and 1/0, and their puter. lines of communication (the bus). (3 Explain the terms jow-level and high-level han- © Bsplain the terms SST, MSL, and LSI guages. i Define the terms bit, byte, word, instruction, soft- G Explain the advantages of an assembly language ware, and hardware. over high-level languages. ] ] MICROPROCESSORS ce A microprocessor is a multiparpose, progranmable logic device that reads hinary instruc tions from a storage device called memory, accepts binary data as input and processes data according to those instructions, and provides results as omput. A typical programmable machine can be represented with three components: microprocessor, memory, and YO as shown in Figare 1.4. These three components work together or interact with each other to perform a given task; dius, they comprise a system. The physical components of this system are called hardware, A set of instructions written for the microprocessor fo per form a task is called a program, and a group of programs js called software, The machine {system} represented in Figure 1.1 can be programmed to tum traffic lights on and off, compute mathematical functions, or keep track of a guidance system. This system may be simple or sophisticated, depending on its applications, and it is recognized by various names depending upon the purpose for which it is designed. When the microprocessor system is used for contro! applications such as turning devices (or machines) on and of, it is generally known as a microcontrolter. When itis used for computing or data processing, it ig known as microcomputer BINARY DIGITS ‘The microprocessor operates in binary digits, 0 and 1, also known as bits. Bit is an abbreviation for the term binary digit. These digits are represented in terms of electrical voltages in the machine: generally, O represents one voltage level, and 1 represents an- other. The digits @ and 1 are also synonymous with low and high, respectively. FIGURE 1.1 FR Progtanmabio Noche - Mieco. processor vo MICROPROCESSORS, MIOROCOMIPUTERS, AND ASSEMBLY LANGUAGE Each microprocessor recognizes and processes a group of bits called the word, and microprocessors are classified according to their word length. For example, a processor ‘with an 8-bit word is known as an 8-bil microprocessor, and a processor with a 16-bit word is known as a 16-bit microprocessor. A MICROPROCESSOR AS A. PROGRAMMABLE DEVICE ‘The fact that the microprocessor is programmable means it cam be idstructed to perform given tasks within its capability. A toaster is an example of an elementary programmable machine. It can be programmed to remain on for a given length of time by adjusting mechanical lever to a “light"” or “dark” setting. The toaster is designed tounderstand and execute one instruction, On the other band, the present-day microprocessor is designed to understand and execute many binary instructions. It can be used to perform sophisticated computing functions as well as to perform such simple cootcol tasks as tuning devices on and off. The person using a muicroprocessor selects appropriate instructions and asks the micsoprocessor te perform various tasks on a given set of data. ‘The engineer who designs a toaster determines the timing for tight and dark toast, and the manufacturer of the toaster provides the necessary instructions to operate the toaster. Similarly, after the engineers designing a microprocessor determine a set of tasks the microprocessor should perform and design the necessary Jogic circuits, the manuface turer of the inicroprocessor provides the user with 4 fist of the instructions the processor ‘will understand, For example, an instruction for adding two numbers may leok like a group of eight binary digits, such as 1000-0000. These instructions are simply a pattern of Os and Is. The user {programmer} selects instructions from the list and determines the sequence of execution for a given task. These instructions are entered or stored in a storage device calic! memory, which can be read by the microprocesser. MEMORY Memory is like the page(s) of a notebook with space for a fixed number of binary numbers ‘on each line. However, these pages are generally made of semiconductor mateiial, Typ- ically, each fine is an 8-bit register that can store eight binary bits, and several of these registers are arranged in a sequence called memory. These registers are always grouped together in powers of two. For example, a group of 1024 (2!) 8-bit registers on at semi- conductor chip is known as 1K byte of memory; IK is the closest approximation in thousands. The user writes the necessary instructions and data in memory through an input device (described below}, and asks the microprocessor to perform the given task and find an answer. ‘The answer is generally displayed! at en output device (described below) or stored in memory. ANPUT/OUTPUT ‘The user can enier insiructions and data into memory through such devives as a keyboard or simple switches. These devices are called input devices. The microprocessor reads the instructions from the memory and processes the data according to those instructions. The result can be displayed by such a device as seven-segment LEDs (Light Emitting Diodes) or printed by a printer. These devices are called output devices. MICROPROCESSOR ARCHITECTURE AND INTERFACING MICROPROCESSOR AS A CPU We can also view the microprocessor as a primary component of « computer, ‘Tradition- ally, the computer is represented in block diagram as shown in Figure 1.2 (a). The block diagram shows that the computer has four components: Memory, Input, Outpat, and the ceniral processing unit (CPL), which consists of the ALU (Arithmetic/Logic Unit) and Control Unit, The CPU contains various registers to store data, the arithmetic/logic unit (ALU) to perform arithmetic anid logical operations, instruction decoders, counters, and control lines, The CPU reads instructions from the memory and performs the tasks spec iffed. It communicates with input/ontpat devices either to accept or to send data, These devices are also known as peripherals, The CPU is the primary and central player in communicating with such devices as memory, input, and output. However, the timing of the communication process is controled by the group of circuits called the control vanit, Jn the 1960s, the CPU was designed with discrete components on various boards. With the advent of the integrated circuit technology, it became possible to buitd the CPU on a single chip, this came to be known as a microprocessor, and the traditional block diagram shown in Figure 1.2(a) can be replaced by the block diagram shown in Figure 1.2{b). FIGURE 12 (@) ‘Traditional Block Diagram of a Competer (b) Blook Diagram ofa Computer with the Micro- processor a8 CPU Curput Micro: oe foo] a cpu Memory rc) MICROPROCESSORS, MICROCOMPUTERS, AND ASSEMBLY LANGUAGE LU Advances in Semiconductor Technology In the last thirty years, semiconductor technology has undergone unprecedented changes. After the invention of the lansistor, integrated circuits (ICs) appeared on the scene at the end of the 1956s; an entire circuit consisting of several transistors, diodes, and resistors could be designed oni asingle chip. in the early 1960s, iogic gates known as the 7400 series were commonly available as ICs, and the technology of integrating the ereuits of a logic gale on a single chip became known as Small-Scale Integration (SSD), As semiconductor technology advanced, more than 100 gates were fabricated on ane chip; this was called Medium-Scale Integration (MSI). A typical example of MSI is a decade counter (7490). Within a few years, it was possible to fabricate more than 1600 gates on a single chip; this came 0 be known as Large-Scale Integration (LSI). Now we ate in the era of Very Large-Scale Integration (VLSI} and Super-Large-Seale Integration (SLSD). The lines of demareation between these different scales of integration are rather ill-defined and arbi- trary 4s the technology moved from $81 to LSI, more and more logic efcuits were built ‘on one chip, and they could be programmed to do different functions through hard wired connections, For example, a counter chip can be programmed to count in Hex os deciraal by providing logic G or 1 through appropriate pin connections. The next step was the idea of providing 0s and Is through a register. The necessary signal patterns 070s and is were stored in sepisters and given to the programmable chip at appropriate times; the group of registers used for storage was called memory. Because of the LST technclogy, it became possible to build many computing functions and their related timing on a single chip. The Intel 4004 was the Grst 4-bit programmable device that was p-imatily used in calculators. It was designed by Intel Corporation and became known as the 4-bit micro- processor. It was quickly replaced by the B-bit microprocessor (the Intel 8008), which was in turn superseded by the Intel 8080, Iu the mid-1970s, the Intel 8080 was widely used in control applications, and smali computers also were designed using the 8080 as the CPU; these computers became knows as microcomputers. Within 2 few years after the emer- gence of the 8080, the Motorola 6800, the Zilog 780, and the Intel 8085 microprocessors ‘were developed as improvements over the 8080, The 6860 was designed with a different atchitecture and the instruction set from the 8080, On the other hand, the 8085 and the 280 ‘were designed as upward software compatible with the 8080; that is, they included all the instructions of the 8080 plus additional instructions. In scrms of the instruction set, the 8080 and the 8055 are almost identical; however, the Z80 has a powerful instruction set containing twice as many instructions 2s the 8080. As the microprocessors began to acquite more and more computing functions, they were viewed more as CPUs rather then. as programmable logic devices. Most microcomputers are now built with 16 and 32-bit anicroprocessors, and 64-bil microprocessors are also being used in some prototype computers. The &-bit microprocessors are aot simply being replaced by more powerful inicroprocessers, however; each microprocessor has begun to cacve 2 niche for its own applications. The &-bit microprocessors are being used as programmable logie devices in control applications, and the 16- and 32-bit micropracessors are being used for mathe- ‘matical computing (number crunching) and data processing applications. Our focus here is in using 8-bit microprocessors as programmable devices. MICROPROCESSOR ARCHITECTURE AND INTERFACING 1.12 Microcomputer Organization Figure 1.3 shows a simplified but formal structure of a microcomputer, It includes four components: microprocesser, input, output, and memory (Read/Write Memory and Read- Only Memory). These components are organized around a common communication path called a bus, The entire group of components is also referred to as a system or a micto- computer system, and the components themselves are referred to as sub-systems. At the outset, it is necessary 10 differentiate between the terms microprocessor and microcom- paler because of the common misuse of these terms in poputar literature. The micropro- cessor is one component of the microcomputer. On the other band, the microcomputer is a coraplete computer similar to any other computer, except that the CPU funetions of the microcomputer are performed by the microprocessor, Similarly, the term peripheral is ‘used for inpuvoutpat devices. The various components of the microcomputer shown in Figure 1.3 and their functions arc deseribed in this section MICROPROCESSOR “The microprocessor is a semiconductor device consisting of electronic logie citcaits man- ufactared by using either a large-scale (LSI) or very-large-scate integration (VLSI) tech nique. The mictoprocessor is capable of performing various computing functions and making decisions to change the sequence of program execution. In large computers, a CPU implemented on one or more circuit boards performs these computing functions. The microprocessor is in many ways similar fo the CPU, fut includes alt the fogie circuitry, including the control unit, on one chip. The microprocessor cen be divided into three segments for the sake of clarity, as shown in Figure 1.3: Arithmetic/Logic Unit (ALU), Register Array, and Controt Unit. Arithmetie/LLogic Unit This is the area of the microprovessor where various computing functions are performed on data. The AJ.U unit performs such arithmetic operations as addition and subtraction, and such logic operations as AND, OR, and exclusive OR. Results are stored either in registers or in metnory. Memory FIGURE 13 Microcomputer with Bus Architecture MICROPROCESSORS, MICROCOMPUTERS, AND ASSEMBLY LANGUAGE Register Array This area of the microprocessor consists of various registers. These registers are primarily used to store duta temporarily during the cxecution of a program. Some of the registers are accessible to the user through instructions. Control Unit The contro! unit provides the necessary timing and contro! signals to all the operations in the microcomputer, It controls the Bow of data between the micropro- cessor and memory and peripherals, ‘Now the question is: what is the relationship among the programmer's instruction binary pattern of Os and 1s), the ALU, and the contro! unit? This can be explained with the example of a Full Adder circuit. A Full Addex circuit can be designed with registers, logic gates, and 2 clock. The clock initiates the adding operation. Similarly, the bit pattern of an instruction initiates a sequence of clock signaés, activates the appropriate logic circuits in the ALU, and performs the task. This is called microprogramming, which is done in the design stage of the microprocessor. The bit patterns required to initiate these micrapro- gram operations are given to the programmer in the form of the instruction set of the microprocessor. The programmer selects appropriate bit patterns from the set for a given task and enters them sequentially in memory through an input device. When the CPU reads these bit patterns one at a time, it initiates appropriate microprograms through the control unit, and performs the task specified in the instructions. AL present, various microprocessors ate available from different manufacturers. Examples of widely used 8-bit microprocessors include the Intel 8085, Zilog Z80, and Moforola 6800 and 6809. Earlier microcomputers such as the Radio Shack ‘TRS-80, the “Televideo 803, and the Kaypro 4 are designed around the 280 microprocessor. The recent versions of {BM personal computers, Personal System/2, are designed around 16-bit and 32-bit microprocessors; the model 60 is based on the Intel 80286 ({6-bit} and the model 80 is based on the Intet 80386 (32-bit). Single-board microcomputers such as the Intel SDK- 85, the Motorola MEK-6800-D2, the Muttitech Micro-Professor, and the CAME Research Micro-Trainer are commonly used in college laboratories; the SDK-85 is based on the 8085 microprocessor, the MEK-6800-D2 on the 6800 microprocessor, and the Micro- Professor and the Micro-Trainer on the Z80 microprocessor. INPUT ‘The input section transfers data and instructions in binary from the outside world to the microprocessor. It includes such devices as a keyboard, 2 teletype, ant an analog-to- digital converter. Typically, a microcomputer used in college laboratories includes either a fiexadecimal keyboard or an ASCH keyboard as an input device. The hexadecimal (Hex) keyboard has 16 data keys (0 t09 and A to F) and some additiona! function keys to perform such operations as storing dats and executing programs, The ASCH keyboard (expiained in Section 1.3) is simiar to a typewriter keyboard, and it is used to enter progeams in an English-like language. Although the ASCH keyboard is found in most rsieracomputers, single-board snicrocoraputers generally have Hex keyboards. OUTPUT ‘The output section transfers data from the microprocessor to such output devices as light cemiting diodes (1810s), 2 cathode-ray tube (CRT), a printer, a magnetic “ape, or another 10 MICROPROCESSOR ARCHITECTURE AND INTERFACING computer, Typically. single-board computers inciude LIEDs and seven-segment LEDs as oulpui devices, ‘MEMORY Memory stores such binary information as insteuctions and data, and provides that infor- mation to the microprocessor whenever necessary. To execute programs, the micropro- cossor reads instructions and data from memory and performs the computing operations in its ALU section. Results are either transferred to the output section for display or stored in memory for later use. The memory block (Figure 1.3) has two sections: Read-Only ‘Memory (ROM) and Read/Write Memory (R/WM), popularly known as Randoms ‘Access Memory (RAM). “The ROM is used to store programs that do not need alterations. The monitor pro- gram of a single-board microcomputer is generally stored in the ROM. This program interprets the information entered through 2 Keyboard and provides equivalent binary digits to the microprocessor. Programs stored in the ROM can only be read; they cannot be altered. “The Read/Write Memory (R/WM) is aiso known as user memory. It is used to store user programs and data. In single-board microcomputers, the monitor program monitors the Hex keys and stores those instructions and data in the RAV memory, ‘The information stored in this memory can be easily read and altered. SYSTEM BUS The system bus is a communication path between the mictoprocessor and peripherals; it is nothing but 9 group of wires to carry bits. In fact, there are several buses in the system that will be discussed in the next chapter, AM peripherals (and memory) shave the same bus; however, the microprocessor communicates with only one peripheral at a time; the timing is provided by the control unit of the microprocessor. 1.13 How Does the Microcomputer Work? Assume that a program and data are already entered in the R/W memory. (How t0 write and execute & program will be explained later.) The program includes binary instrections to add given data and to display the answer at the seven-segment LEDs. When the micro computer is given a command to execute the program, it reads and executes one instruction. at a time and finally sends the result to the seven-segment LEDs for display. This process of program execution can hest be deseribed by comparing it to the process of assembling a radic kit. The instructions for assembling the radio are printed ina sequence on a sheet of paper, One teads the first instruction, then picks up the necessary components of the radio and performs the tesk. The sequence of the process is read, interpret, and perform. The microprocessor works the same way. The insthuctions are stored sequentially in the memory. The microprocessor fetches the first instruction from its memory sheet, decodes it, and executes that instruction. The sequence of fetck, decode, and execute is continued until the microprocessor comes across an instruction 10 stop. During the entire process, the microprocessor uses the system bus to fetch the binary instructions and data from the memory. It uses registers from the register section to store MICROPROCESSORS, MICROCOMPUTERS, AND ASSEMBLY LANGUAGE ata temporarily, and it performs the computing function in the ALU section, Finally, it sends out the result in binary, using the same bus fines, to the sevon-segment LEDs. 1.14 Summary of Important Concepts ‘The functions of various components of a mitrocomputer can be summarized as follows: 4. The microprocessor © communicates with all peripherals (mesmory and /Os) using the system bus, © controls timing of information flow. © performs the computing tasks specified in a program. 2. The memory © stores binary instructions and data, called programs. © provides the instructions and data to the microprocessor on request, © stores resulls and data for the microprocessor. 3. The input device © enters dats and instructions under the control of a program such as a monitor pro- gram. 4, The output device 1 accepts data from the microprocessor as specified in a program. 5. The bus © carries bits between the microprocessor and memory and £/Os, FROM LARGE COMPUTERS TO SINGLE-CHIP MICROCOMPUTERS 38 La Ii the jast thirty years, adtvances in semiconductor technology have hed an unprecedented impact on computers. Thirty years ago, computers were accessible only to big compora- tions, universities, and government agencies. Now, “computer” has become a common word. The range of computers now available extends from such sophisticated, multi- tuillion-doliar machines a5 the IBM 3090 to the lesé-than-§200 home computer. All the computers now avaiiable on the market include the same basic components shown in Figure 1.3. Nevertheless, it is obvious that these computers are not all the same. ferent types of computers are designed to serve different purposes. Some are suitable for scientific calculations, while others are used simply for turning appliances on and off. Thus, it is necessary to have an overview of the entire spectrum of computer appiications as a context for understanding the topics and applications discussed in this text. Until 15 years ago, computers were broadly classified in tree categoz.es: mainframe, mini-, acd microcomputers. Since then, technology has changed considerably, and the dlstinctions between these categories have been blurred. Initially, the microcomputer was recognized as a computer with a microprocessor as its CPU. Now practically all computers have various types of microprocessors pexforming different functions within the large oe] ‘MICROPROCESSOR ARCHITECTURE AND INTERFACING CPU. For the sake of convenience, computers are classified here as large computers. medium-sized computers, and microcomputers 121 Large Computers ‘These are large, general-purpose computers designed to perform such data processing tasks as complex scientific and engineering calculations and handling of records for large corporations or government agencies. The price is generally beyond $ million and can go as high as $10 million. Typical examples of these compaters include TBM 3090 or IBM 9370 series, Burroughs 6700, and Univac 1100. These are high speed computers, and their word lengths range from 32 to 64 bits They are capable of addressing megabytes of memory and handling all types of periph- erals. For the more expensive, the CPU alone may cost more than one million dojJars. For example, the IBM 3000/81 CPU, capable of addressing 32 megabytes of memory, may cost more than $3 million; the price of the total system may go as high as $6 miltion However, IBM also has medium-sized systems, called 4300 series, costing around $100,000, avd they are also known as mainframe computers. 122 Medium-Sized Computers In the late 1960s, these computers were designed to meet the instructional needs of small colleges, the manufacturing problems of small factories, and the data processing tasks of mediun-sized businesses, sich as payroll and accounting. They were calfed minicom: puters. The price range was anywhere from $25,000 to $100,000. Typical examples include such computers as Digital Equipment PDP 11/45 and Data General Nova. ‘These computers were slower than the large computers, and their word length gen- erally ranged from 12 to 32 bits. ‘They were capable of addsessing 64K to 256K bytes of memory. Some of the larger minicomputers were known as midicomputers. However, these classifications are no longer valid. For example, Digital Equipment’s new VAX 11 system is a 32-bit machine with megabytes of memory addressing capacity. The price ranges from $50,000 to $450,000, The high end of the VAX 11 system is almost in the territory of the large computers. 1.23 Microcomputers “The 4-bit and 8-bit microprocessors became available in the mid 1970s, and initial appli- cations were primarily in the areas of machine control and instrumentation. As the price of the microprocessors and memory began to dectine, the applications mushroomed in almost all areas, including video games, word processing, and sroall business applications. Early arrivals in the microcomputer market, sch as Cromemeo, Noth Star Horizon, Radio ‘Shack TRS-80, and Apple were designed around 8-bit microprocessors. Since then, 16-bit and 32-bit microprocessors such as Intel 8086/88, 80286, and 80386, Motorola 68000, and Zilog Z8000 have been introduced, and recent microcomputers have heen designed arouad these microprocessors. Present day snicrocomputers can be classified into four groups: business (or personal), home, single-board, and single-chip microcomputers. ‘MICROPROCESSORS, MICROCOMPUTERS, AND ASSEMBLY LANCUAGE BUSINESS MICROCOMPUTERS ‘These microcomputers are being used for & variety of purposes, such as payroll, business accounts, word processing, legal and medical recordkeeping, personal finance, and instruction, They are also known as personal computers. Typically, the prive ranges from $1,000 to 38,000 for a single-user system, and it can go higher for a rau Exaraples include such microcomputers as (8M Personal Computers (IBM PC, XT, AT, System/2), the AT&T 6300 series, Apple Computers, and Zenith or Compaq com- puters. At the low end of the microcomputer spectrum, a typical configuration includes an. S-bit or 16-bit microprocessor, 64K (or 128K} bytes of memory, a CRY terminal, 2 printer, and dual disk drive for 5%-inch floppy disks. The floppy disk is a magnetic medium similar to a cassette tape except that itis round in shape, tike a record. Information recorded on these disks can be accessed randomly using disk drives, white information stored on a cassette tape is accessed serially. In order te read information st the end of the tape, the user must run the entire tape through the machine. Floppy disks are used to store such programs as congpilers, interpreters, system programs, user programs, and data, Wienever the user needs to weite a program, the necessary software is transferred from the floppy disk to the system's memory. At the high exd of the microcomputer spectrum, the basic configuration remains essentially similar. it may include 2 16-bit or 32-bit micro- processor, @ hard disk with megabytes of storage, two floppy disks, an expensive terminal, and a printer. FIGURE 14 Microcomputer with Disk Storage. IBM Personal Syston SOURCE: Phoiogaph courtesy of IBM Caxpa- re 13 4 MICROPROCESSOR ARCHITECTURE AND INTERFACING HOME COMPUTERS Home computers are differentiated from basiness microcomputers in terms of their mem- ory storage. Typically, these computers have an 8-bil microprocessor, a CRT terminal with an ASCH typewriter, 16K to 64K memory, and a cassette tape as a storage medium. Some of these computers can be used with television as a video monitor. The prices of these computers may range from less than $200 t0 $500, Typical examples include Com- modore 64, Tandy 100, and Atari 130XE. These microcomputers are used primarily for playing video games, leasing simple progamming, and renning some instructional pro~ grams. SINGLE-BOARD MICROCOMPUTERS These microcomputers are used primarily in college laboratories and industries for instruc- tional purposes or for evaluating the performance of a given microprocessor. They can also be part of some larger systems. Typically, these microcomputers includs an 8-bit micro- processor, from 256 to 2K byies of user memory, a Hex keyboard, and seven-segment LEDs for display. The system monitor programs of these computers are generally small, FIGURE 18 Single-Boatd Microcomputer Micro-Trainer SCURCE: Phorgtoph courtesy of CAN Reseach. nc MICROPROCESSORS, MICROCOMPUTERS, AND ASSEMBLY LANGUAGE they ate stored in less than 2K. bytes of ROM. The prices of these single-twurd computers range from $100 to $800, with the average price being about $300. Exarnples of these computers include such systems as Intel SDK-85, Motorola Eval- vation Kit, and CAMI Research Micro-Trainer (Figure 1.5). These are generally used to write and execute assembly language programs and to perform interfacing experiments SINGLE-CHIP MICROCOMPUTERS ‘These microcomputers are designed on a single chip, which typicaily includes a micto- processor, 64 bytes of R/W memory, from IK to 2K bytes of ROM, and several signal lines to connect I/Os. These are complete microcomputers on a chip; they ate alse known as microcontrollers. They ate used primarily for such functions as conivo'ling appliances and traffic lights. Typical examples of these microcomputers include the Zilog Z8, Intel MCS 53 and 96 series, Paischild £8, and Motorola 6802 ‘The entire spectrum of computer applications is shown in Figure 1.6, and various applications und categories of the microcomputer are fisted in Table L.1. cone sisyadory pag -omipop hey sami, ssndnooosoy Applications: + Scientific Calculations + Large Business Dana Processing + Real-Time Applications (guidance control) + festructionat System in Universities + Multiuser Business Systeras + Instrumentation + Manufacturing Processes + Hospitst Puient-Core Systems + Applications in Legat Fields + festrsctional Systems in Colleges + Ofiive Automation + Wont Processing «+ Small-Business Systems *» Eoteriaamnest (Video Games) *» Persoast Computing > Sebsystems STS NODES > OS ‘yoDES Bxteraal Roxes Pa Memory Read Conicot Memory Write and HO Read Request ‘Stanny Sigaats,// UO Write Acknowledge i Status Signals FIGURE 2.1 Generalized Microprocessor Unit (MPU) 30 MICROPROCESSOR ARCHIPECTURE AND INTERFACING However, the present microprocessors inciude all the data processing and timing circuitry on one chip: therefore, they can be viewed as MPUs. Now we shall examine what is inside the microprocessor to understand how it processes data. 2.14 Microprocessor as a Processing Unit ‘When the microprocessor executes instructions, it does so in a continuous sequence of fetch, decode, and execute operations. After examining these operations in more detail, ‘we can describe the requirements of the internal architecture of our generalized micropro~ cessor. FETCHING AN INSTRUCTION “To fetch an instruction, the microprocessor places a memory address on the address bus and reads binary information using the data bus. Therefore, if needs a register that can hold memory addresses and increment these addresses after the fetching is completed, a sort of memory pointer, DECODING AN INSTRUCTION Once an instruction byte is fetched, it needs to be decoded to answer the following: © Is it a complete instruction? If not, how many more bytes need to be fetched? 1 What type of operation is required and on what data? ‘To perform these functions, the microprocessor needs an instruction decoder that can interpret the fetched binary information EXECUTING AN INSTRUCTION ‘The type of data manipulation the microprocessor can perform depends on its internal mnicroprograrns, that is, on ils instruction set. These operations can be classified as data copy (transfer), arithmeticflogic operations, and decision making, For example, to subs tract two numbers, both nombers rast be loaded into registers. After the subtraction, itis necessary t0 indicate whether the sesult is positive, negative, or zero. This can be indicated by setting or resetting flip-flops called flags. To perform these arithmetic and logic oper- ations, the microprocessor needs a group of logic circuits called ArithmeticiLogic Unit (ALU). ‘This description of the requirements of the microprocessor to process data can be summarized in a simplified block diagram shown in Figure 2.2. From this block diagram, ‘we can derive a programming model for a specific microprocessor. 2.15 Review of Important Concepts The description and the requirements of a generalized microprocessor unit can be sum- marized as follows (sec Figure 2.3): To communicate with memory and 1/0 devices, the MPU should have the following 1, Address bus to send the address of a memory register or an YO. ‘MICROCOMPUTER SYSTEM: MPU, MEMORY, AND LO. FIGURE 2.2 MPU intemal Structure esieustion Decoder ‘Arithenatic Logie Unit “AWW | wears Tiemary famm| Pointer Registers invormal Ba cee [| struction | Desoder Address Bus Data Bus Real aw topes —— Vey Pome Resor Tou iegec | Some > Ackrovlesge FIGURE 2.3 MPU Architecture 2. Data bus to transfer data between the MPU and memory and /O devices, 3. Control signals to identify its operations and provide timing. 4, External Request signal lines to interrupt the MPU operations. 5. Request Acknowledge signals to respond to the requests by petiphera's. 6. Clock signals to provide timing and power to operate circuits. 31 32 MICROPROCESSOR ARCHITECTURE AND INTERFACING ‘To process data internally, the MPU should include the following: 1, Instruction Decoder to decode the fetched binary information. 2. Registers to store binary data, 3. Registers as memory pointers for addressing memory segisters. 4. ALU to perform arithmetic and logic operations, 5. Flags (lip-Gops) to indicate data conditions for decision making. a 6 a MEMORY ‘Memory is an essential component of a micracomputer system; it stores binery instructions and data for the microprocessor, There are various types of memory, and they can be classified in two groups: prime (or main) memory and storage memory, In the last chapter, We saw two examples of prime memory: Read/Write Memory (R/WM) and Read-Only ‘Memory (ROM). Magnetic tapes and disks can be cited as examples of storage memory. First, wo will focus on prime memory and then briefly discuss storage memory when we exarnine various types of memory. ‘The R/W memory is made up of registers, and each register has a group of flip-flops or field-effect transistors that stose bits of information, The user can use this memory to hold programs and store data. On the other hand, the ROM stores information permanently in the form of diodes; the group of diodes can be viewed as a register. In a memory chip, all segisters are arranged in a sequence and identified by binary numbers called memory addresses. The MPU uses ifs address bus to send the address of a memory register and uses data and control buses to read from or write into that register. In the following sections, we examine the basic concepts related to memory—its structure, its addresses, and its require- ments for communication with the MPU—and buitd a mode! for R/W memory. However, the discussion is equally applicable to ROM except for slight differences in Read/Write control signais. 2.21 Flip-Flop or Latch as a Storage Element ‘What is memory? It is a circvit that can store bits —generally high or low voltage levels representing | and 0. A flip-flop ora latch is a basic element of memory. To write or store 2 bit in the Iatch, we need an input data bit and an enable signal (Figure 2.4(2)). In this latch, the stored bit is always available on the ontput fine, Ifa tri-state buffer is connected to the output of the latch (as shown in Figure 2.4(b)), the stored bit can be read only when the buffer is enabled. Similarly, we can also use a tri-state buffer on the input of the Jatcb, Now we can write into the latch (Figure 2.4(c)) by enabting the input buffer and read from it by enabling the output buffer. This latch, which can store one binary bit, is called a ‘memory cell. Figure 2.5(a) shows four such cells or latches grouped together to form a register which has four input fines and four output lines and can store four bits. The size of this register is specified as either 4-bit or 1 X 4 bit, which indicates one register with four cells or four 1/0 lines. The number of bits stored in a register is called a memory word, Figures 2.5(b) and {c) show simplified block diagrams of the 4-bit register. ‘MICROCOMPUTER SYSPEM: MPU, MEMORY, AND 10, e wo 9 FIGURE 2.4 Latches as Storage Elements Jn Figure 2.6(a), four registers with eight cells (or 8-bit memory word) are arranged in a sequence. To write into ot read from any one of the registers, a specific register should be identified or eaabied. This is a simple decoding function; a 2-t0-4 decoder can perform that function. However, two more input ines A, aud Ao, called address lines, are zequired to the decoder, These two input lines can carry four different bit combinatcons (00, 01, 10, 11), and each combination can identify or enable one of the registers named as Register 0 through Register 3. In Figure 2.6(a), the chip has an 8-bit memory word, and its size can be specified as 32 bits, 4X 8 bits, or 4 bytes. If we have a memory chip with a 4-bit memory word, We can combine ovo such chips in parallel to make an 8-bit memory word as shown in Figure 2.6(0), The adldzess lines and RD/WR controt signals (~ indicates active low) will be connected in paratiel, but the memory word will consist of 4 bits from each chip as shown. Now we can expand the number of registers. If we have eight registers on one chip, ‘we need tree addiess lines and a 310-8 decoder, An interesting problem is how fo deal with two chips with four registers each. We have a total of eight registers; therefore, we need three address lines. One address line, Az, is used to select a chip, and the address lines Ay and Ao are connected to both chips. Figure 2.7(b) shows that the Chip Select, signal CS is active low, so that when Az is O (low), Chip My is selected and when Az is 1 (high), Chip Mz is selected. The addresses on A; and Ao will determine the registers to be selected; thus, by combining the logic on A,, Ay, and Ao, the memory addresses range from 000 te 111. The concept of the Chip Select signal gives us more flexibility in designing chips and allows us to expand memory size by using multiple chips. Now fet us examine the problem from a different perspective. Assume that we have available four address lines and two memory chips with four registers each as before. Four address fines are capable of identifying sixteen (2°) registers, however, we need only three address lines to identify eight registers. What should we do with the fourth fine? One of the solutions is shown in Figure 2.8. Memory chip M; is selected when Ay and Ap are both 0; therefore, registers in this chip are identified with the addresses ranging from 0000 to O01 (Oto 3). Sinnilarly, the addresses of memory chip Mz range from 1000 to 1041 (8 to B); this chip is selected only when As is 1 and Az is 0. In this example, we need three lines to 33 eystBayy yig-p 2 JO sureibeIG Aoolg (9) pue (q) sewiSey lg © se seyoreT MOY fe) s¢ gun 8 @ *%9 10 to ca Na blk ls bb he ty ly hele i ae We Topat Boer we—ld iw ms : Regie 3 Ay eRe Register ” 7 ee sea axe ior Aa Hoo is a a ser = oa Itt | I ©; 04 050. &% 0,04 0s 0, 0,0, 9, ®D ay io FIGURE 26 (a) 4x 8 Bit Register (b) Two 4 x 4 Bit Registers WO Lines @ FIGURE 27 mr ra 8 (@) Memory Chip with Eight Registers (b) Two Memory Chips with Four Registers Each 35 36 MICROPROCESSOR ARCHTFECTURE AND INTERFACING oe re cs a——tord Re aoe ® a—ooi & ooo] Re Foo oR T-v0-T T0—F FIGURE 28 Addressing Eight Registers with Four Address Lines identify eight registers, two for registers and one for Chip Select, However, we used also the fourth line for Chip Select. This is called complete or absolute decoding. Another option is to leave the fourth tine as “don't care"; we will further explore this concept Tater. After reviewing the above explanation, we can summarize the requirements of memory chip as follows: 1. A memory chip requires address tines to identify a memory register, a Chip Select CS. signal to enable the chip, and control signals to read from and write into memory registers. 2, ‘The number of address fines required is determined by the number of registers in a chip (2" = Number of registers where. m is the number of address Lines). 3, If additional address lines are available in a system, they are used to enable the Chip Select CS signal. The memory address of a register is determined by the logic levels (O11) of all the address lines (inciuding the address lines used for CS). 4, The control signal Read (RD) enables the output buffer, and data from the selected register are made available on the output lines. Similaily, the control signal Write (WR) enables the input buffer, and data on the input lines are written into memory cells. A. model of a typical memory chip representing the requirements just stated is shown in Figure 2.9. Figure 2,9(a) represents the R/W memory and Figure 2.905) represents the Read-Only Memory; the only difference between the two as far as addressing is concerned is that ROM does not need a WR signal. Internally, the memory cells are arranged in a matrix format (in rows and colurnns), because as the size increases the internal decoding, scheme we discussed becomes itmpractical. For example, a memory chip with 1024 reg- isters would require a 10-t0-2024 decoder, If the cells are arranged in six rows and four columns, however, the internat decoding cizcuitry can be designed with two decoders, one for selecting a row and the other for selecting a columnn. The intemal row and coluna arrangement does not affect our external interfacing logic. MICROCOMPUTER SYSTEM: MPU, MEMORY, AND YO. Address Adiess Lines Lines 10-7 Lines @ FIGURE 29 {@) B/W Memory Model (b) ROM Model 2.22 Memory Map Typicaily, in an 8-bit microprocessor system, 16 address lines are available for memory. ‘This means it is a numbering system of 16 binary bits and is capable of identifying 2'° (65,536) memory registers, each register with a 16-bit address, The entire memory addresses can range from 0000 10 FEFE in Hex. Memory map is like a pictorial represen- tation in which memory devices are located in the entire range of addresses. Memory addresses provide the locations of various memory devices in the systera, and the inter- facing logic defines the range of memory addresses for each memory device ‘Now let us assume that we have a memory chip with 256 registers which needs only eight address lines (2° = 256). How can we assign 16-bit addresses to 256 registers? This can be accomplished by using the remaining eight lines for the Chip Select through appro- priate logic gates as illustrated in the next example. Kya fustrate the memory map of the chip with 256 bytes of memory, shown in Figure 2.10(a), and explain how the memory map can be changed by modifying the hardware of the Chip Select CS line in Figure 2.10(b). Figure 2. 10a) shows a memory chip with 256 registers with 8 1/0 Fines; tke memory size of the chip is expressed as 256 X 8. It has eight address lines A7-Ag, one Chip Select CS. signal (active 1ow} and two control signals Read (RD) and Weite (WR). The eight address lines (A7~Ap) of the microprocessor are required to identify 256 memory registers. The remaining eight lines (Ais~Ag) are connected to the Chip Select (CS) line shrough invest- ers and the NAND gate. The memory chip is enabled or selected when CS goes low. ‘Therefore, to select the chip, the address lines A;s~As should be at logic 0, which will cause the output of the NAND gate to go low. No other Jogic levels on the lines Ais~Ag ‘can select the chip. Once the chip is selected (enabled), the remaining addvess tines Ay~Ao Example al Solution FIGURE 2.10 Memory Maps. 256 Bytes of Memory ‘MICROCOMPUTER SYSTEM: MPU, MEMORY, AND 10. ‘can assume any combination from G0, to FF, and identify any of the 256 memory registers through its decoder. Therefore, the memory addresses of the chip in Figure 2. 10(a) will range from 0000, to OOFFy as shown below. Ais Aw Ag Az Au Aw Ao Ag Ay As As Aa Ay Ay Ay Ag o 0 0 0 0 0 00 0 6 G 6 8 0 DO 0 +0000, t + Pobiob db rid Chip Enable or Chip Select Register Select a Fy ‘The entire range of the memory addresses from 00004 to OFF: is known as the memory map of the chip in Figure 2. 10(a). ‘The Chip Select addresses are determined by the hardware (the inverters and NAND gate): therefore, the memory map of the ebip can be changed by modifying the iuardware. For example, if the inverter on line Ays is zemoved as shown in Figure 2.10(b), the address required on Ays~Ag to enabie the chip will be as follows Ais Au An Az An Ap As Bs 1 o o 0 oO o a 0 = 804 The memory map for Figure 2.10(6) will be 8000), to SOFFie ‘The memory chips in Figures 2.10(a} and (b) are the same chips. However, by changing the hardware of the Chip Select logic, the location of the memory in the map can bbe changed, and memory can be assigned addresses in various locations over the entire range of 0000 to FREF. In a memory system, a. 16-bit address can be conceptually organized into to groups of Hex numbers, With two Hex digits, 256 registers can be numbered from 00y to FF as shown in the previous example. This is defined as a page with 256 lines (registers) to read from or write on, Similarly, high-order Hex digits in an address can be used to number the pages from 00s; to FF; thus the total range of 64K can be conceptually divided into 256 pages with each page having 256 lines. Por example, the memory address 020Fy repre- sents line (register) 15 on page 2, and the address O7FFi, represents register 255 on page 7. A memory chip with TK (1,024) byte can be viewed as a chip with four pages. This is just a convenient way of thinking memory maps. Another way of viewing a memory address is in terms of high-order and low-order addresses, The lines used for chip select are called high-order address lines, and the lines comnected to memory address fines are called low-order address lines. Let us use en example of a four-digit (decimal) numbering sysiem in a high-rise apartment building. Generally, the first two digits (high-order) represent a floor and the last two digits (low- order) represent an apartment number. To focate apartment 1241, we go first to the twelfth floor (similar to Chip Select in memory addressing), and then we fook for the apartment 44 {simidar to selecting a register). Now let us use the example of an apartment complex. Let 40 ‘MICROPROCESSOR ARCHITECTURE AND INTERFACING 1us assurne the complex is divided into sections 1 to 9 and each section has up to 999 apartments. In this situation, the number 2451 would represent Seotion 2 and apartment number 451; the digit 2 is a high-order address and 451 is a low-order address. This is similar to memory addresses of 1K memory. The 1K memory chip will require 10 address lines, and the remaining six fines of the address bus will be used for the CS. Thus, the group of six addvess lines will be high-order, and the remaining ten address fines will be low-order, The memory addresses will be determined by combining the logic levels of these address lines. If the number of address lines in a microprocessor is larger than 16, we will use a five-digit Hex numbering scheme. 2.23 How the MPU Writes into and Reads from Memory ‘To store (write) a byte into a memory location (Figure 2.11), the MPU 1. places the 16-bit address on the address bus of the memory location where a byte is to be stored, This address is decoded to select the memory chip, and the memory register is identified, 2, places the byte on the data bus. 3. sends the control signal Memory Write to enable the input buffers of the memory and hen stores the byte. ‘To read from memory, the steps are similar, 4, The MPU places the 16-bit address on the address bus: and sends the contro} signal ‘Memory Read to enable the output buffer of the memory chip. [“W6HR Memory Address ——SSS™S™*~*~*~S~S~S~S rs Bs Memory Chip FIGURE 2.11 Memory Write Operation MICROCOMPUTER SYSTEM: MPU, MEMORY, AND LO 2. The interfacing logic of the memory chip decodes the address and selects the appro- priate memory register. 3. The memory chip places the data byte on the data bus, and the MPU reads the data byte. 2.24 Memory Classification Memory can be classified into two groups: prime (or main) memory and storage memory. The R/WM and ROM discussed in the last section are examples of prime :nemory: this is the memory the microcomputer uses in executing and storing programs. This memory should be able to respond fast enongh to keep up with the execution speed of the micro- processor. Therefore, it should be Random-Access Memory, meaning that the micropro- ‘cessor should be able 10 access information from any register with the same speed (inde- perdent of its place in the chip). Storage memory includes examples such as magnetic disks and tapes (soe Figure 2.12). This memory is used to store programs and resulis after the completion of program execution. Information stored in these memories is nonvolatile, meaning information remains intact even if the system is turned off. Generally, these memory devices are not a part of any system; they are made part of the system only when stored programs need to be aecessed. The microprocessor cannot execute of directly process programs stored in these devices; programs must be copied into the prime memory first. Therefore, the size of the prime memory (¢.g., 64K or 128K) determines how large a program the system can process. The size of the storage memory is unlimited; when one disk or tape is full, another can be used. Figure 2.12 shows two subslivisions of storage memory; secondary storage and backup storage. The secondary storage is similar to what you put on your shelf in your study, and the backup is similar to what you store ia your attic, Storage memory includes such devices as disks, magnetic tapes, magnetic bubble memory, and charged-coupled devices (CCD). The primary features of all these devices are bigh capacity, low cost, and slow access, A disk is similar to a record; the access fo the stored information in the disk is semi-random. The remaining devices shown in Figure 2.12 are serial: if information is stored in the middie of the tape, it can be accessed only after running half the tape. We will discuss some of these memory storage devices again in Chapter 7. In this chapter, we will focus on various types of prime memory. Figure 2.12 shows that the prime memory is divided into two main groups: Read Write Memory (R/AWM) and Read-Only Memory (ROM), and each group includes several different types of memory, R/WM (READ/WRIYE MEMORY) AAs the name suggests, the microprocessor can write into or read from this memory, and it is popularly known as Rundom-Access Memory (RAM). itis used primarily for informa- tion that is likely to be altered, such as writing programs or receiving data, This memory is volatile, meaning that when the power is turned off, all its contents are cestroyed. ‘Two types of R/W memories—static and dynamic—are available, Staie memory is 41 42 MICROPROCESSOR ARCHITECTURE AND INTERFACING Sen , cin || Se — a Ferns , S=] ES] & > Sate 7 EPROM Thiasos ROM] [> Feppr | [> Mawes wae oe hed Tape Zara Power + Mapntc 1 Nooo scco RAM FIGURE 2.12 Memory Classification made up of flip-flops, and it stores the dit as a voltage, Dynamic memory is made op of MOS tiansistor gates, and it stores the bit as a charge. The advantages of the dynamic memory are. that it has higher density, lower power consumption, and is cheaper thor the static memory, The disadvantage is that the charge (bit information) leaks; therefore, stored information needs to be read and written again every few milliseconds. This is calied refreshing the memory, and it requires extra circuitry, which adds to the cost of the system. It is generally economical to use dynamic memory when the system emory size is larger than 16K; for smaller systems, the statie memory is appropriate. ROM (READ-ONLY MEMORY) ‘The ROM is a nonvolatile memory; it retains stored information even if the power is turned off. This memory is used for programs and data that need not be altered because, as the ‘MICROCOMPUTER SYSTEM: MPU, MEMORY, AND YO. name suggests, the information can be read only so thai once a bit pattem is stored, it is ‘permanent of at feast semi-permanent, The permanent group includes two types of mem- ‘ory; masked ROM and PROM, and the semi-permanent group also includes two types of memory: EPROM and EE-PROM ag shown in Figure 2.12. MASKED ROM In this ROM, « bit pattern is permanently reconled by the masking ard metallization process, which memory manufacturers are generally equipped to do. It is an expensive and specialized process, but economical for large production quantities PROM (PROGRAMMABLE READ-ONLY MEMORY) This memory has nichrome of polysilicon wites atranged in a matcix; these wires can be functionally viewed as diodes or fuses. This memory can be programmed by the user with a special PROM programmer that selectively burs the fuses tecording to the bit pattern to be stored. The process is known as “burning the PROM," and the information stored is permanent. EPROM (ERASABLE PROGRAMMABLE READ-ONLY MEMORY) ‘This memory stores a bit by charging the floating gate of a FET. Information is stored by using an EPROM programmer, which applies bigh voltages to charge the gate. All the information can be erased by exposing the chip fo ulitaviolet light through ils quartz window, and the chip can be reprogrammed. Because the chip can he reused many times, this memory is ideally suited for product development, experituental projects, and college laboratories. EE-PROM (ELECTRICALLY ERASABLE PROM) ‘This memory is functionally similar to EPROM, except that information can be sltered by using electrical signals atthe register level rather than erasing all the information, This has an advantage in field and remote controi applications. In micraprocessor systems, soft- ware update is a common occurrence. If EE-PROMS are used in the systems, they can be updated from a central computer by asing 2 remote link via telephooe lives, Similarly, in a process controf in which timing information has to be changed, it can be cone by sending electrical signals from a central place. This memory also includes a chip-erase mode whereby the entire chip can be erased in 10 ms as opposed to 15 to 20 minutes for an EPROM. RECENT ADVANCES IN MEMORY TECHNOLOGY Memory technology bas advanced considerably in recent years. In addition to static and dynamic R/W memory, there are now more options available in memory devices, Recent examples include Zero Power RAM from MOSTEK, Non-Volatiie RAM from Intel, and Integrated RAM from several manufacturers. ‘The Zero Power RAM is a CMOS Read/Write memory with battery backup built internally. 1 includes lithium cells and voktage-sensing circuitry. When the external power supply voltage falls below +3 V, the power switching circuitry connects the fithiur 4 ‘MICROPROCESSOR ARCHITECTURE AND INTERFACING batery; thus, this memory provides the advantages of both R/W and Read-Oaly Memory. ‘The Non-Votatile RAM is a high speed static R/W Memory array backed up, bit for bit, by an EE-PROM array for nonvolatile storage. When the power is about to go off, the contents of RAV memory are quickly stored in the EE-PROM by activating a STORE signal on the memory chip, and the stored data can be sead into the R/W memory segment when the power is tmed on again, This memory chip combines the flexibifity of static RAW memory with the nonvolatility of EE-PROM. ‘The Integrated RAM (RAM) is a dynamic memory with the refreshed circuitry built on the chip. For the user, it is similat to the static R/W memory. The ser can derive the advantages of the dynamic memory without having to build the external refreshing cir- cuitry. At present, this memory is economical for a system with medium-sized memory (between 8K and 64K). 2. 3 INPUT AND OUTPUT (/O) DEVICES InpuvOutput devices are the meuns through which the MPO communicates with “the outside world.” The MPU accepts binary data as inpat from devices such as keyboards and A/D converters and sends data to output devices such as LEDs ot printers. There are two different methods by which an MPU can identify VO devices: one uses an &-bit address and the other a 16-bit address, These methods are described briefly in the follow- ing sections. 2.31 Os with 8-Bit Addresses (Peripheral-Mapped I/O) In this type of VO, the MPU uses eight address lines to identify an input or an output device; this is also known as peripheral-mapped I/O, The eight address fines can have 256. (2% combinations) addresses; thus, the MPU can identify 256 input devices and 256 output devices with addresses ranging from 00); to FFy. The input and output devices are dif ferentiated by the control signals YO Resd for input devices and iO Write for output devices. The entire range of 1/O addresses from 004 to FFy is also known as VO map, and individual addresses are. also referred to as YO device addresses of VO port numbers. If we use LEDs as output or switches as input, we need {o resolve two issues: how to assign addresses and how to connect these VO devices to the data bus. In a bus architec- ture, these devices cannot be connected directly to the data bus or the address bus; afl connections must be made through tri-state interfacing devices so they will be enabled and connected to the buses only when the MPU chooses to communicate with them. in the case. ‘of memory, we did not have to be concerted with these problems because of the intemal adelress decoding, Read/Write buffers, and availability of TS and control signais of the memory chip. In the case of VO devices, we need to use extemal interfacing devices “The steps in communicating with an VO device are simitar 20 those in communi- cating with memory and can be sammarized as follows:

You might also like