Staudhammer, J., Chen, S.-L., Windley, P.J., Frenzel, J.F. “Microprocessors” The Electrical Engineering Handbook Ed. Richard C. Dorf Boca Raton: CRC Press LLC, 2000 82 Microprocessors 82.1Practical Microprocessors Types of Microprocessors and Microcontrollers?Software for mP/mC Systems?Packaging and Cost?Programming of mPs? Development Support?Comparison of mP/mC Chips?Trends in mP/mC Developments 82.2Applications Data Collection?Control?Computing 82.1 Practical Microprocessors John Staudhammer and Sue-Ling Chen A microprocessor (mP) is a semiconductor die containing the components of a computer central processor, complete with instruction processing unit, arithmetic, interrupt , and basic communication facilities. Such devices have been around since the early 1970s and have greatly benefitted from the continuing improvements in electronics. As microelectronic technology allows the feature sizes of components to be shrunk, more powerful mP systems are being put on single dies. One of the early microprocessors, the Intel 8080, is still a widely used controller; its understanding and study are recommended for all designers of microprocessor systems [see Gaonkar, 1984]. Early processors contained a few thousands of transistors, while the top-end microprocessor has over 1.5 million. The early processors were 4-bit machines, initially intended for hand-held calculator use; the largest chips today are intended for use as full central processing units of large computers. What makes these devices micro is that they are microelectronic devices. These devices are typically built of NMOS (N-type metal-oxide semiconductor) or CMOS (complementary metal-oxide semiconductor) circuits; the CMOS version is typically a bit more expensive and requires less power. An excellent overview of micro- processors and systems using them is found in Raffiquzzaman [1990]. Application of a microprocessor involves adding memory for program and data, and input/output circuitry, which may involve analog/digital and digital/analog converters. As feature sizes of electronic components shrink, the manufacturer of the chip has three options: 1.Reduce the chip size (the die size)—this may result in a cheaper device of the same capability. 2.Increase the processing power at the same cost. 3.Add peripheral circuits to the processor, thus putting on-chip devices normally added to the mP. Adding the right combination of peripherals has the greatest benefit for system cost. A microcontroller (mC) is a microprocessor with peripherals on the same chip. These include various types of memory, interrupt structures, communication means, timing and data acquisition circuits. All three chip developments listed above occur simultaneously, thus keeping a successful product line going for many years. For example, the Motorola 6800 processor was introduced over 20 years ago; today it is still available, but the manufacturer steers designers to the successor chips, the 6809 mP and the 68HC11 mC. A mP chip communicates to its peripherals by means of three sets of lines: the bidirectional data bus, the memory address bus, and the control bus. In addition, the mP will also send/receive data on communication John Staudhammer University of Florida and Office of Naval Research Sue-Ling Chen Contractor, Allied Signal Phillip J. Windley Brigham Young University James F. Frenzel University of Idaho ? 2000 by CRC Press LLC lines; the number and types of these vary greatly among chips. A mC will have on the same chip a number of memory elements, timers, communication ports and buffers, counters, and analog/digital converters in addition to a processor; communication to the peripheral circuits is through ports assigned to these devices, as well as any needed external memories. A discussion of general mC systems is given in Clements [1987], while Myers and Budde [1988] present the details of a very-high-performance mC. All processors require an external clock, typically a crystal. The processor internal circuits run at this speed, but external devices usually use a submultiple of this rate, the bus clock, which is usually 2 to 4 times slower. The advertised clock rate is usually the external clock rate, not the bus cycle speed. There are well over a hundred different mP systems on the market. They each have peculiarities and may have some advantages. They differ by the kind of data they handle, the amount of processing they do, and the software support they enjoy. What makes mP practical is not so much its claimed prowess, typically stated in peak instruction execution capability (MIPS, millions of instructions per second), but rather its ease of use in a given application, determined to a large degree by the kind and amount of support software available from the manufacturer. Types of Microprocessors and Microcontrollers The yearly compendium of mP/mC chips [Markowitz, 1997] categorizes these chips by the width of the data path: 4, 8, 16, 32, and 64 bits. In addition, high-performance chips include bit/word slice chips—these are meant to implement the functions of a central processing unit for a limited number of bits (4 or 8 bits) and are meant to be concatenated for handling an entire computer word. For a discussion of these chips and their uses, see Mick and Brick [1980]. The most precious resource in a mP chip is the number of connection pins. Great efforts are made to utilize the ones used by various control lines and mode selections for the processor. Hence, a given mP chip may have four or more modes of operation: it is simply cheaper to build a flexible system, rather than several different ones. The vast majority of mPs possess a richness of data access means (addressing modes); they support many different ways of working with memory and external data items. They are complex instruction set computers (CISC). A prime example is the Motorola 68000 with five data groupings and nine addressing modes. Even the simplest 4-bit processor in wide use (National Semiconductor COP400) has a 10-bit address bus (and a 4-bit data bus). The device can have up to 1 K words (1024 bytes) of memory on the chip, which is often enough for a simple dedicated task. Thus, these chips often appear as single items in simple computer- controlled devices. Most of these chips are found in embedded applications, in kitchen appliances, and in toys. By far the largest volume of mPs are 8-bit devices; they use 8-bit-wide (1 byte) data paths, but have address busses usually 16 (or more) bits. Often the data bus is time-multiplexed with the lower byte of the address bus. These types of devices can access as much as 65 K memory locations. The typical instruction execution time is 3 to 7 bus cycles. A widely used 8-bit processor is the Zilog Z-80. The 16-bit mP chips have 16 data and address lines. The typical execution time is 2 to 5 bus cycles. The 32-bit and 64-bit mP chips are the high end of these devices and find application in advanced personal computers, high-performance workstations, and digital controllers. They are characterized by high cost (com- pared to most mC chips) and extensive support circuitry. The typical execution time is 1 to 2 bus cycles. They represent the developing efforts in mP technology. Microcontroller chips contain a mP and various items that make up a mP-based system: there is usually some random access memory (RAM) for holding volatile data, at least one kind of read only memory (ROM) for holding the control program, communication peripherals, including parallel interface(s), serial communication adapter(s), various counting and timing circuits for measuring input pulses, and analog/digital converters. Because each processor has an external clock, usually a crystal clock, timing intervals can be determined to great precision. Many procedures have been developed to take advantage of this precision: voltage-to-frequency converters are used externally to bring pulses to the mP system, which then proceeds to accurately count them. The timing and counting capabilities of mP systems gives them their ubiquitous applicability. Software for mP/mC Systems Manufacturers of mP/mC devices have gone to extraordinary efforts to make their devices attractive to system designers. Much software is offered for use with the chips and to support the design effort. ROM-based monitor ? 2000 by CRC Press LLC THE INTEGRATED CIRCUIT icroelectronics has been the most significant area of development in electrical technology in recent years and has had a profound effect on the course of electrical engineering. The integrated circuit was one of the major developments of its time. The increasing complexity of electronic devices meant that even transistorized circuits could be too large and heavy, especially for aero- M ? 2000 by CRC Press LLC programs are available in most chips so that normal communication tasks can be accomplished easily; programs for usual input/output tasks, data acquisition, timing, and program examples are distributed so that (relatively) error-free software is available for the designers. Most of these are distributed through public-access dial-up bulletin boards. Programming then becomes largely an adaptation of these programs to the tasks that the system is to perform. Of course, the system task analysis and program system design are still the designer’s responsi- bilities, as is the conduct of a software validation. The mP receives instructions, from its internal or external memory, and data, as a combination of zeros and ones; it is this machine code instruction that controls the operation of the system. The writing of such machine code is far too tedious. An English-like language, machine mnemonics, is used to describe each machine operation and this is then translated to the 0’s and 1’s which are stored in the memory. For example ADD 123 may stand for the machine code necessary to perform the addition of the number contained in memory location 123 to the content of the computer’s arithmetic register, leaving the result in the arithmetic register. The manufacturers supply assemblers to accomplish the mnemonic language assembly into code that may be loaded into the mP memory. These assemblers typically will run on personal computers and various minicomputer systems. Pro- grams that monitor the operation of an actual chip through the mP serial port(s) are effective development tools. space applications. In addition, the reliability of such circuits was limited by the ever-increasing number of interconnections. The integrated cir- cuit was a solution to both of these problems. They actually changed the way electrical circuits were designed. Engineers had grown accus- tomed to creating circuits with a minimum of active components, since transistors and diodes were relatively more expensive than resistors and capacitors. However, active components are both smaller and easier to put on a silicon chip than inactive ones. Thus, the circuits most adaptable to integration are digital circuits, with many active components performing “yes-no” logic functions. Since these are the types of circuits used in computers, it actually encouraged engineers to look for digital solutions to design problems. The blending of microelectronics and computers has produced the microprocessor, the computer on a chip. This has made possible tremendous reductions in computer size and cost, and consequently has made computers far more available for previously undreamed-of applications. Not since the develop- ment of electric power systems began over one hundred years ago have engineers produced such a fundamental and far-reaching tool for change. (Courtesy of the IEEE Center for the History of Electrical Engineering.) The Intel 4004, the first commercial microprocessor, was originally designed for a programmable calculator. It repre- sented the first consolidation of the arithmetic and logic functions of several chips onto a single integrated circuit. (Photo courtesy of the IEEE Center for the History of Elec- trical Engineering.) Hence, the typical software includes an assembler, a loader, and a monitor. More user-oriented software for these tasks is available from third-party vendors; many of these extra-cost software packages are highly cost effective. Interactive assemblers and debugging tools are particularly good investments. Packaging and Cost The simplest processors are housed in normal dual in-line packages (DIP) of 16 pins or more, spaced 0.3 inches wide. Thus, they resemble conventional transistor-transistor logic (TTL) packages. The mid-range ones are usually in large DIP packages, 0.8 inches wide, with 40 to 68 pins (2 to 4 inches long.) The high-performance ones come in multirow pin packages and may require 200 connections and may use unusual chip sockets. The high performance chips may require special cooling. Virtually all processors are multisourced, i.e., they are available from more than one manufacturer. This is an important consideration for continued product support. The processors come in various speed grades; the higher speed ones may be 3 to 5 times as costly as the slow-speed versions. The low-end processors, with no memory and a few communication ports, cost less than $1 in quantity. The widely used Z-80, developed about 20 years ago, costs about $1, while the high-end processors (i860, Pentium Pro) cost around $1000, in low quantities. Programming of mPs Most mP systems are programmed in assembly language. Each of the instructions that the processor can execute is given an English-like name (i.e., ADD for the instruction to add two numbers) and translator programs are available from the mP manufacturers to translate the English-like statements (the source code) into the machine codes (which are streams of zeros/ones that the mP interprets). Such assemblers are available from public-access bulletin boards maintained by several vendors; however, convenient assemblers for specific mP systems are usually bought from third-party vendors. Almost all mP assemblers are meant to be used on personal computers; some are available for minicomputer systems. One should check with the chip manufacturer for current software. High-level language compilers are also available for most mPs, typically from third-party vendors. These are usually C-language compilers, but Pascal compilers also may be available. Here again, the best guide is the chip manufacturer. The programming of mP systems usually involves carefully tailored code to control signals that interact with the processor chip. Usually the functions that are required of the processor are time-critical real-time control actions. Programs for such applications can easily become highly intricate and require detailed knowledge of all the functions of the processor chip. For a discussion of these problems, see Chapters 3 and 4 of Peatman [1988]. Development Support Complex mP/mC systems are designed top-down: the task statements are successively refined to a set of smaller tasks, until they can be implemented in relatively short subroutines. The design approach for micro-based systems is described and illustrated in Peatman [1988]. The most important support software for a designer is programs for checking the system, both for logical flow and for cycle-by-cycle activity. Often subtle errors and data dependencies will occur; finding them may be a daunting task. Simulators are the first-level checkout tools for programs. Simulators do not use the actual hardware; rather they use a software model of it. They calculate and show the contents of all computer registers, of ports and selected memory locations, so that an effective check of the internal operations can be made. Most simulators are from third-party vendors. The actual operation of the mP/mC system may be checked with an in-circuit emulator (ICE), an expensive but effective tool that replaces the mP or mC pin-for-pin in the actual circuit. The ICE typically uses a more powerful computer to mimic the performance of the mP/mC being developed. The ICE tracks signals (including many transients) and can be used to effectively show the behavior of the system, as well as the expected response from the mP and its associated software. ? 2000 by CRC Press LLC Comparison of mP/mC Chips As with all computer devices, the advertised speeds and performance figures must be carefully interpreted. These numbers tend to measure only the performance of the manufacturer’s test cases and may not be directly comparable [see Hennessey and Patterson, 1990]. These numbers may not be applicable to any one user’s requirements. Since the market for mP/mC chips is highly competitive, small differences become amplified in advertising. Unfortunately, getting a valid number for comparison purposes requires an extensive effort at benchmarking. The advertised performance figures may be taken as a guide, if the task is similar to the benchmark programs. If the processor does not pass the comparison with a comfortable margin, however, one should opt for a higher- performance version of the same chip (if much programming already has been done) or select a clearly superior other candidate. Trends in mP/mC Developments An entire microprocessor may be used as a building block in an application-specific integrated circuit (ASIC), available from various vendors. ASIC and VLSI design tools may be used to design such systems, tailored to specific user applications. The mP manufacturers are developing mC chips extending the use of their basic processors. For any application, the best procedure is to invite several vendors to propose alternate systems. Current chips are merely indications of devices to come. High-performance mP systems are becoming more RISC (reduced instruction set computer) oriented. The object is to execute one instruction per clock period (versus the prevailing 3 to 7 cycles) and to obtain a more regular processor structure. The most popular mP/mC systems are CISC processors. For a user it makes little difference what the internal structure of the processor is; the availability of user support software is far more critical. The trend is to make processors simpler, thus speeding up program execution, even if some programs may have to use more program steps in replacing many “convenience” instructions. Nevertheless, the very high end mP systems have such a wide data path (32 or 64 bits) that more than one instruction may be accessed at one time. These machines are termed very long instruction word (VLIW) machines. They are able to execute more than one instruction per clock cycle, but they will be more complex internally. For users, both the simpler RISC and the complex VLIW machines will provide increased performance. Microelectronics is able to produce 2 million transistor chips. While they are expensive, they will replace virtually all of the peripheral chips: memory, timers, and communication channels can all be controlled from a single chip. However, the humble 8-bit chip is still be the most cost-effective workhorse of the bulk of mC applications. Defining Terms Die: The piece a silicon wafer containing all electronics. Feature size: The characteristic size of electronic components on a die. Microcontroller (mC): A microelectronic chip incorporating a mP and memory, communication, as well as other computer support functions. Microprocessor (mP): A microelectronic chip that carries out all operations of a computer central processing unit: instruction fetch, execution, interrupt and management of address, data and control lines which are connected to the chip. Peripheral: Device that supports the functions of the processor. The peripheral may be all electronic (a communications adapter) or may contain mechanical parts (a disk memory). To the processor a periph- eral appears as electronics with timing constraints. Related Topic 82.2 Applications ? 2000 by CRC Press LLC References A. Clements, Microprocessor System Design, Boston: PWS Publishers, 1987. R.S. Gaonkar, Microprocessor Architecture, Programming, and Applications with the 8085/8080A, 2nd ed., Colum- bus, Ohio: Merrill Publishing Company, 1984. J.L. Hennessey and D.A. Patterson, Computer Architecture: A Quantitative Approach, Palo Alto, Calif.: Morgan Kaufmann Publishers, 1990. M.C. Markowitz, “EDN’s 24th annual mP/mC chip directory,” EDN Magazine, September 25, 1997. J.R. Mick and J. Brick, Bit-Slice Microprocessor Design, New York: McGraw-Hill, 1980. G.J. Myers and D.L. Budde, The 80960 Microprocessor Architecture, New York: Wiley Interscience, 1988. J.B. Peatman, Design with Microcontrollers, New York: McGraw-Hill, 1988. M. Rafiquzzaman, Microprocessors and Microcomputer-Based System Design, Boca Raton, Fla.: CRC Press, 1990. Further Information The magazine EDN runs an annual microprocessor/microcontroller review, typically late in the year (i.e., September 25, 1997). These are handy compendia of characteristics. The IEEE magazine Micro presents detailed articles on device development and applications of micropro- cessors and systems which embed them. At mid-year the magazine carries a set of articles based on the Hot Chips Symposium, presenting developments in mP and chip technology for high-performance workstations and systems. Specifics of various microprocessor and microsystem chips are found in the respective manufacturer’s reference literature; for any design one must become familiar with the applicable manual and design notes. Even for a modest chip the reference manual may run 300 pages; in addition, the manufacturer’s free-of-charge support software is of comparable size. For example the Motorola 68HC11 reference manual is 512 pages, and there is over 1 megabyte of design support software available from the manufacturer. The Intel i860 data book is 150 pages, hardware and programmer reference manuals are over 300 pages, and the support software is several megabytes. 82.2 Applications Phillip J. Windley and James F. Frenzel Microprocessors are cheap, small, and consume little power. In addition, in recent years their performance has increased at a greater rate than the performance of larger computers. These factors have led to an explosion in the application of microprocessors. A short section could never do justice to every application; therefore, we will view representative applications in three broad areas: ? Data collection, where microprocessors are used to monitor sensors and either record the collected information or communicate the information to some other computer. ? Control, where microprocessors have largely replaced analog electronics for controlling everything from manufacturing robots to home appliances. ? Computing, where microprocessors have transformed the concept of computer and made parallel pro- cessing possible. Admittedly, these categories are not strictly disjoint. They do, however, represent the most pervasive uses for microprocessors at an abstract level. Data Collection In data collection the microprocessor-based system serves primarily as a low-cost data recorder. Basic functions include the polling of sensors, acceptance of data, data storage, and data transmission or display. Additional features might include preprocessing of the raw data. Such a classification spans a broad range of applications, from automotive diagnostics to space-born monitoring stations. ? 2000 by CRC Press LLC Microprocessors are well suited as the controller for such tasks because of their cost and flexibility. Sufficient numbers of processors may be used to allow real-time data acquisition. Because the microprocessor is pro- grammable, sensors may be added, removed, or rearranged without major system impact. Finally, because the microprocessor is a computational device, calculations may be performed on the recorded data to produce useful information, such as calculating speed from distance and time. In the next section we will examine the components of one such system, the retail point-of-sale terminal [Hordeski, 1984]. Point-of-Sale Terminal The function of a point-of-sale (POS) terminal is characteristic of the applications under the category of data collection. The microprocessor is not being used for intensive computations, nor for controlling a complex process, but rather to collect data, perform some processing, and then pass the results on to a central collector. The cost and flexibility of the microprocessor make it an excellent choice over special-purpose hardware. System Components. In addition to the microprocessor and storage capability, the typical retail terminal has one or more input devices for entering prices (e.g., keyboard, bar code scanner) and one or more output devices for displaying totals (e.g., paper tape, display). Often these terminals are part of a large network of terminals and may support additional features beyond totaling purchases such as automated inventory control and credit checking. A complete system is shown in Fig. 82.1, including magnetic tape for storing transactions and a universal asynchronous receiver/transmitter (UART) for communication with a central processing facility. Because of the high unit volume, it is desirable to keep the cost and complexity low. Typically, each terminal will have limited storage capability, relying on a central processor for maintaining store inventory and credit checks. In order to reduce communication traffic with the central processor, however, each terminal generally has in storage the current price for all items. Universal Product Code.The use of the Universal Product Code (UPC) has enabled the development of intelligent POS terminals which can “read’’ the UPC symbol and determine the identity of the item. The UPC symbol consists of ten decimal digits, split into two fields of five digits each. Each digit is encoded using a 7-bit binary number, represented by a group of 7 dark (binary 1) and light (binary 0) bars. The five left-hand digits are encoded using odd parity and the right-hand digits are encoded using even parity. This allows correct recognition of the symbol, independent of its orientation. For groceries, the first five decimal digits identify the manufacturer and the second group of five digits identify the specific product. There are additional codes in use as well, such as the National Drug Code. By using a microprocessor-based system, a POS terminal can be quickly reconfigured to recognize a different code (or multiple codes) through a simple software change. Operation.A typical sale might involve the following steps. The clerk inquires whether the sale is to be a cash purchase or charged to an account. If the latter, the clerk enters the necessary information and the terminal FIGURE 82.1Point-of-sale terminal system. ? 2000 by CRC Press LLC transmits a request to a central processor, inquiring as to the available credit. In the interim, items are entered, either through the bar code scanner or the keypad, and the price and running total are displayed. The identity of the items purchased is also stored for later transmission to the central processor responsible for inventory control. Finally, the terminal checks the available credit against the total and records the transaction for later transmission to the central processor. Digital Tachometer Another example of using a microprocessor for data collection is the implementation of a digital tachometer [Bonert, 1989]. The microprocessor samples the output of a shaft encoder and compares it with a reference signal to determine the rotational speed. The calculated value is passed to a digital-to-analog converter to generate an analog speed signal. The system is shown in Fig. 82.2. Speed Evaluation Methods. Various methods may be used to evaluate the speed value, all of which involve some combination of pulse counting and time measurement. The constant elapsed time (CET) method provides a good compromise between measurement accuracy and response time. The CET method records the number of encoder pulses observed during a fixed time interval. The rotational speed, n, is then given by n = C p /(C t m/T c ) where C p is the number of encoder pulses, C t is the number of clock pulses, m is the number of encoder marks per turn, and T c is the clock pulse period. Implementation.Rather than continuously stopping and resetting external counters, it is possible to take advantage of features often found in modern microcontrollers, microprocessors containing additional interface circuitry. Microcontrollers often contain counters, timers, and capture registers. Capture registers allow the storing of timer or counter values triggered by an external signal. At the start of evaluation, the rising edge of the next encoder pulse triggers the capture of the timer count and the pulse count. After a minimum evaluation time has elapsed, the next encoder pulse again triggers the capture of the current counter values. The rotational speed can then be computed using the difference between the captured values. A flowchart of the algorithm is shown in Fig. 82.3. Performance. Using an encoder with 1024 marks per revolution, a 2-MHz reference clock, and an evaluation period of 2.3 ms resulted in a measurable speed range of 25.5–4883 rpm. The maximum relative error was 0.123%, induced primarily by the encoder tolerance [Bonert, 1989]. Control Microprocessors are ubiquitous in control applications. While some custom analog controllers are still built, the advantages of cost and flexibility inherent in microprocessors make them a natural choice. The advantages of microprocessors are particularly obvious in mass-produced goods where time-to-market can be a significant driving force. FIGURE 82.2Digital tachometer. ? 2000 by CRC Press LLC Microcontrollers Microprocessors designed especially for use in control applications are called microcontrollers. Typically, the major difference between a microcontroller and a standard microprocessor is the presence of scratchpad RAM, input and output ports, timers, and even analog-to-digital (A/D) and digital-to-analog (D/A) converters on-chip. Figure 82.4 shows a simplified microcontroller architecture. The process to be controlled is monitored by means of sensors. The outputs from the sensors are fed to A/D converters which convert the analog signals from the sensors to digital signals appropriate for use in the microprocessor. The microprocessor reads the digital signal from the A/D converter and uses it for input to a control program stored in the microprocessor memory. The program produces digital outputs which are fed to D/A converters. The analog outputs from the D/A converters (which are typically low power) are fed to amplifiers, and the amplified signal is used to control actuators that affect the process being controlled. Control Applications Consumer Electronics. A survey of the typical home will show numerous microprocessors where 10 years ago, there were none. Microprocessors are used for controlling VCRs, TVs, stereo equipment, microwave ovens, sprinkler systems, telephone equipment, heating systems, and virtually every other appliance using electricity. Manufacturing.Microprocessors have found numerous applications in manufacturing. Perhaps none is better known than the robot. Microprocessor technology has made the modern robot possible. Robot arms used in FIGURE 82.3Tachometer program. (Source: Bonert, 1989.) ? 2000 by CRC Press LLC manufacturing typically have five or six joints. Current practice is to treat each joint in the robot arm as a separate servomechanism with its own control system. For example, the PUMA 560 robot arm, manufactured by Unimation, has six rotating joints. Each joint is controlled by an individual microcontroller system. Another computer calculates paths and sends individual joint motion information to the six joint servomechanisms [Fu et al., 1987]. The servomechanism system shown in Fig. 82.5 consists of an 8-bit Rockwell 6503 microprocessor, a D/A converter, an amplifier, a joint motor, and an encoder. The 6503 microprocessor receives joint position infor- mation from the supervisory computer every 28 ms. The microprocessor calculates the joint error information by comparing the current position to the desired joint position using the PID (proportional-integral-derivative) control method. The error is converted to an analog signal by the D/A converter and amplified before going to the joint motor. The encoder is connected to the motor shaft and provides a digital signal to the microprocessor. The microprocessor performs the following functions: 1.Receives the desired joint position from the supervisory computer every 28 ms 2.Reads the position signal from the encoder every 0.875 ms 3.Calculates the error every 0.875 ms 4.Sends the error to the D/A converter The microprocessor calculates joint error and sends the correction signal to the joint motor 32 times for every joint position received from the supervisory computer. Transportation.Microprocessors are used for control applications in every facet of the transportation indus- try. Microprocessors are used to control the operation of the vehicles themselves such as controlling engines, air surfaces in aircraft, antilock brakes in automobiles, and rudders in ships. Microprocessors are also used in wide-area applications such as traffic control. In controllers for motor traffic, the microprocessor has replaced hardwired logic and analog systems to provide systems which are much more capable and typically more reliable [Hordeski, 1984]. A typical traffic light controller is shown in Fig. 82.6. The microprocessor provides the CPU, memory, and I/O ports. The system FIGURE 82.4Typical microcontroller design. FIGURE 82.5Microprocessor-controlled servomechanism from a PUMA 560 robot. ? 2000 by CRC Press LLC includes a real-time clock for timing external events and a power-fail restart unit which restarts the system after a power failure (including restoring volatile data). The system monitors traffic at the intersection through the use of loop detectors and controls the traffic by changing the traffic lights. Other components of the system monitor and control pedestrian traffic and provide an interface to the system for human operators. The loop detectors are paired coils of wire placed under the pavement. The impedance of the loop detectors changes in response to the presence of a car on the roadway. The change in impedance changes the frequency of an RC oscillator, which is converted to a digital signal reported to the microprocessor. Loop detectors can be used to monitor the presence of a car at a traffic light, the length of a line of cars, and the speed of traffic. The function of the traffic controller is to optimize traffic flow. For example, during busy periods of the day, the goal may be to optimize flow through an intersection. Another goal may be to ensure that traffic flows smoothly in certain directions to effectively feed larger roads. Traffic lights can be synchronized to provide a highway through a busy network of roads by ensuring that a car that enters the roadway and maintains a recommended speed can travel along the entire length without stopping at a traffic light. On the other hand, during periods of low use, such as night and early morning, the system may monitor for the presence of a car at an intersection and immediately switch the light to let it pass. Microprocessors offer advantages in traffic control situations in addition to optimized traffic flow. When properly designed, the system can provide a certain degree of fault tolerance. When a loop detector is giving a faulty value, the system can be programmed to ignore its value and use values from adjoining lanes. An error report can be forwarded to a central traffic facility and after repairs are made, the loop brought automatically on-line. The system can also monitor feedback information from the traffic light to ensure that the lights are actually lit. When a problem is detected, the system can enter an emergency mode and report the problem. Social Issues The explosive growth in the use of microprocessors in control applications has caused discussion about the utility and safety of such devices. An issue many people can identify with is feature overload. The advent of cheap microprocessors has turned design upside-down. Designers can add additional features for very little additional increased manufacturing cost. Competition spurs even more features until even the simplest of consumer items come with thick instruction manuals. Naturally, consumers become frustrated with features that are difficult to use. Perhaps more important are the safety hazards that may be engendered by replacing analog control systems with digital control systems. Most analog systems are based on physical properties with continuous behavior. Digital systems, on the other hand, are discrete and are thus much more prone to problems where small errors can result in large changes in behavior due to the digital representation of value; a single bit change can result in a large change in magnitude. Digital control systems are becoming more and more prevalent in systems controlling aircraft, automobiles, nuclear power plants, and other safety-critical systems. Engineers who design FIGURE 82.6 Traffic control system. (Source: M. Hordeski, Microprocessors in Industry, New York: Van Nostrand Reinhold, 1984, p. 398. With permission.) ? 2000 by CRC Press LLC the systems and officials charged with ensuring their safety are still coming to grips with the implications of this trend. New techniques for analyzing computer system designs for errors are being developed which promise to alleviate some of these concerns [Windley, 1995]. Computing While microprocessors have been put to a plethora of interesting special-purpose uses such as data collection and control, perhaps the most visible use of microprocessors has been in the area of general-purpose computing. Microcomputers The advent of microprocessors has resulted in a personal computer on virtually every desktop. Even the slowest of these computers rival the performance of the largest computers available 15 years ago. Figure 82.7 shows the major hardware components of a simple microcomputer. The central processing unit (CPU) is the execution engine of the microcomputer and is most often a microprocessor. One popular family of microprocessors used as the CPU in microcomputers is manufactured by Intel. These chips, with names such as the 8088, 80286, 80386, 80486, and Pentium are used in microcomputers such as the IBM personal computer. Another important family of microprocessors is the Motorola Power Pc series, which is used in microcomputers manufactured by Apple Computer [Matloff, 1992]. In addition to the CPU, there are a number of other components in a microcomputer. General-purpose memory is not typically part of the microprocessor but must be added as a separate component. In simple microcomputers, the memory may be directly attached to the microprocessor. In more complex designs, the memory is attached to the microprocessor by a system bus that allows system components other than the microprocessor to access memory as well. In addition, the memory may have its own controller, called a memory management unit. Other components in the system include input/output (I/O) interfaces to devices such as printers, terminals, disks, mice, and so on. The common feature of all of these devices is that they interface the microprocessor to the outside world. All of the components in the microcomputer are connected together by a system bus. The bus is a set of parallel wires that carry information from one component to another. Multiprocessing The desire for greatly increased computer performance has fueled research in using microprocessors as the computing engines in multiprocessors which would achieve performance gains over single-processor computers through the use of numerous low-cost microprocessors. There are numerous multiprocessor architectures. An example architecture that is well suited to using large numbers of microprocessors is the hypercube. The hypercube architecture was originally developed by Charles Seitz and others at California Institute of Technology in the early 1980s. The hypercube depends on using large numbers of commodity microprocessors, each with private memory, in a hypercube network [Bell, 1989]. In a hypercube network, N microprocessors are arranged in an n-dimensional cube, where N = 2 n . Each processor is connected to n other processors and the longest communications path from any processor to any other is n links. For example, a three-dimensional hypercube contains eight processors and is arranged as a standard cube, where the nodes are the processors and the edges of the cube are the communication paths. FIGURE 82.7Major components of a simple microcomputer. ? 2000 by CRC Press LLC Figure 82.8 shows a four-dimensional hypercube represented as a tesser- act. A four-dimensional hypercube has 16 processors, each is connected to 4 other processors, and the longest path between any two processors (shown in bold in Fig. 82.8) is 4. Thus, doubling the number of processors results in a unit increase in the communications path length. This loga- rithmic relationship results in the great advantage of the hypercube: it scales well. A system with 1024 processors has a maximum communications path length of just 10. There are several manufacturers of hypercube systems including NCUBE and Intel. Most of these systems have between 32 and 1024 processors. NCUBE has a hypercube architecture with 8192 nodes operating at 2.4 megaflops each. Digital Signal Processing Digital signal processing (DSP) may be considered a specific example belonging to the category of computation. Specialized microprocessors are finding widespread application in many areas of digital signal processing such as telecommunications, speech processing, medical imaging, and radar [Aliphas and Feldman, 1987]. These microprocessors are designed for very high data rates and contain specialized circuitry to accelerate computa- tions that are specific to signal processing. Figure 82.9 illustrates the architectural differences between digital signal processors and conventional microprocessors. Architectural Features. A common task among most signal processing algorithms is the summation of multiple products. The most notable distinction between general-purpose microprocessors and digital signal processors is the existence of a high-speed multiplier-accumulator [Allen, 1985]. This circuitry can complete a multiply-add operation in one cycle, as opposed to roughly 25 cycles for a conventional microprocessor. Traditionally, only fixed-point arithmetic was available, but newer DSP chips provide floating-point arithmetic with 32 bits of precision. FIGURE 82.9Digital signal processor architecture. (Source: Aliphas and Feldman, 1987.) FIGURE 82.8 A four-dimensional hypercube. ? 2000 by CRC Press LLC The second most noticeable feature on DSP chips is the existence of multiple data buses and memories. Many chips have two data memories, each with a data bus, allowing the simultaneous fetch of two operands for the multiply-accumulate operation. Furthermore, most chips use the Harvard architecture, characterized by separate program and data memories, so that instructions and data can be fetched simultaneously. Others use a modified Harvard architecture, where data can be stored in slower, cheaper program memory and moved to the faster data memory as needed. Finally, DSP chips typically have separate arithmetic-logic units (ALU) for data arithmetic and address calculations. This serves two purposes: (1) data calculations can proceed unhindered by address calculations, maintaining a high throughput, and (2) each unit can be specialized for its particular task. For example, the data ALU may have additional circuitry to support saturation arithmetic, whereas the ALU used for address calculations may provide indexing, auto-increment, or even bit-reversal, an operation required for the fast Fourier transform (FFT). Dedicated digital signal processors offer an excellent alternative or supplement to general-purpose micro- processors for signal processing applications. As a slave to a conventional processor, the DSP chip is freed from communicating with peripherals, increasing throughput. For additional performance, DSP chips may be oper- ated in a multiprocessor configuration, controlled by a central processor. Such an arrangement would be appropriate for applications such as phased-array radar, where the volume of data and uniformity of the calculations lend themselves to distributed processing. Defining Terms A/D: Analog to digital. Usually a device that changes an analog signal to a digital signal of corresponding magnitude. Capture registers: Internal registers which, triggered by a specified internal or external signal, store or “capture’’ the contents of an internal timer or counter. D/A: Digital to analog. Usually a device that changes a digital signal to an analog signal of corresponding magnitude. Encoder: A sensor that directly creates a digital signal for use in a control application. An example is a shaft encoder that turns an angular shaft position into a digital signal. Interrupts: Special hardware on a computer that suspends the executing program so that another procedure can be run to service an external device. Microcontroller: A special-purpose microprocessor with scratchpad RAM, input and output ports, timers, and even analog to digital (A/D) and digital-to-analog (D/A) converters on-chip used in control applications. Universal asynchronous receiver/transmitter (UART): Circuitry (often a separate module), which provides all of the interface functions necessary for a microprocessor to communicate with a serial device. Related Topic 82.1 Practical Microprocessors References A. Aliphas and J. Feldman, “The versatility of digital signal processing chips,’’ IEEE Spectrum, vol. 24, no. 6, pp. 40–45, June 1987. J. Allen, “Computer architecture for digital signal processing,’’ Proceedings of the IEEE, vol. 73, no. 5, pp. 852–873, May 1985. G. Bell, “The future of high performance computers in science and engineering,’’ Communications of the ACM, 32(9), pp. 1091–1099, September 1989. R. Bonert, “Design of a high performance digital tachometer with a microcontroller,’’ IEEE Transactions on Instrumentation and Measurement, vol. 38, no. 6, pp. 1104–1108, December 1989. K.S. Fu, R.C. Gonzalez, and C.S.G. Lee, Robotics: Control, Sensing, Vision, and Intelligence, New York: McGraw- Hill, 1987. ? 2000 by CRC Press LLC M. Hordeski, Microprocessors in Industry, New York: Van Nostrand Reinhold, 1984. N. S. Matloff, IBM Microcomputer Architecture and Assembly Language, Englewood Cliffs, N.J.: Prentice-Hall, 1992. P. J. Windley, “Formal modeling and verification of microprocessors,” IEEE Trans. on Computers, vol. 44, no. 1, January 1995. Further Information Byte magazine is a good resource for entry-level articles on microprocessor applications. For subscriptions contact: BYTE, One Phoenix Mill Lane, Petersborough, NH 03458. The Institute of Electrical and Electronics Engineers (IEEE) publishes several magazines and journals that frequently contain articles concerning microprocessor applications. IEEE Micro is a bimonthly magazine which addresses the design and use of microprocessors and minicomputers. IEEE Computer is a monthly magazine covering all aspects of computing. Three pertinent journals published bimonthly by the IEEE are Transactions on Industry Applications, Transactions on Industrial Electronics, and Transactions on Instrumentation and Mea- surement. The address for the IEEE Service Center is 445 Hoes Lane, Piscataway, NJ 08855. ? 2000 by CRC Press LLC