Файл: Embedded Controller Hardware Design (Ken Arnold, 2000).pdf
ВУЗ: Не указан
Категория: Не указан
Дисциплина: Не указана
Добавлен: 13.06.2025
Просмотров: 2698
Скачиваний: 0
2EMBEDDED CONTROLLER
Hardware Design
the guidelines set forth in this book to real world hardware, you can learn to design reliable embedded hardware into other products. Information on obtaining the SDK can be found in the Preface.
Objectives
Several different skills are required for successful embedded hardware design. Here are some of the things you will know how to do when you finish this book:
•Interpret design requirements for the design of an embedded controller.
•Read and understand the manufacturer’s specification sheet.
•Select appropriate ICs for the design.
•Interface the CPU, memory, and I/O devices to a common bus.
•Design simple I/O (input/output) interfaces.
•Define the decoding and interconnection of the major components.
•Perform a worst-case analysis of the timing and loading of all signals.
•Understand the software development cycle for a microcontroller.
•Debug and test the hardware and software designs.
These tasks represent the major skills required in the successful application of an embedded micro. In addition, other abilities—such as the design and implementation of simple user programmable logic—will be covered as required to support the proficient application of the technology.
Embedded Microcomputer Applications
There is an incredible diversity of applications for embedded processors. Most people are aware of the highly visible applications, but there are many less apparent uses. Many of the projects my students have chosen turned out to be of practical use in their work. However, they have covered the entire range from the economically practical to the blatantly absurd. One practical example was the use of a microprocessor to monitor and control the ratio of ingredients used in mixing concrete. About a year after the student implemented the system, he wrote to inform me that the system had saved his company between two and three million dollars a year by reducing the number
3CHAPTER ONE
Review of Electronics Fundamentals
of “bad batches” of concrete that had to be jack hammered out and replaced. Another example was that of a student who suspended a ball by airflow generated by a fan and provided closed loop control of the ball’s position with the microprocessor. The only thing that many of the student projects really had in common was the use of a microcontroller as a tool.
Some of the actual commercial applications of embedded computer controls that the author has been directly involved with include:
•A belt measures a person’s heart rate and respiration that signals an alarm when safe limits are exceeded. A radio signal is then transmitted to a microcontroller in a pocket pager to display the type of problem and the identity of the belt.
•An environmental system controls the heating ventilating and air conditioning in one or more large buildings to minimize peak energy demands.
•A system that measures and controls the process of etching away the unwanted portions of material from the surface of an integrated circuit being manufactured.
•The fare collection system used to monitor and control entry to a rapid transit system based on the account balance stored on the magnetic stripe on a card.
•Determination of exact geographic position on the earth by measuring the time of arrival of radio signals received from navigational beacons.
•An intelligent phone that receives radio signals from smoke alarms, intrusion sensors, and panic switches to alert a central monitoring station to potential emergency situations.
•A fuel control system that monitors and controls the flow of fuel to a turbine jet engine.
Selecting a particular processor for a given application is usually a function of the designer’s familiarity with a particular architecture. While there are many variations in the details and specific features, there are two general categories of devices: microprocessors and microcontrollers. The key difference between a microprocessor and a microcontroller is that a microprocessor contains only a central processing unit (CPU) while a microcontroller has memory and I/O on the chip in addition to a CPU. Microcontrollers are generally used for dedicated tasks. Microcomputer is a general term that applies to complete computer systems implemented with either a microprocessor or microcontroller.
4EMBEDDED CONTROLLER
Hardware Design
Microcomputer and Microcontroller Architectures
Microprocessors are generally utilized for relatively high performance applications where cost and size are not critical selection criteria. Because microprocessor chips have their entire function dedicated to the CPU and thus have room for more circuitry to increase execution speed, they can achieve very high-levels of processing power. However, microprocessors require external memory and I/O hardware. Microprocessor chips are used in desktop PCs and workstations where software compatibility, performance, generality, and flexibility are important.
By contrast, microcontroller chips are usually designed to minimize the total chip count and cost by incorporating memory and I/O on the chip. They are often “application specialized” at the expense of flexibility. In some cases, the microcontroller has enough resources on-chip that it is the only IC required for a product. Examples of a single-chip application include the key fob used to arm a security system, a toaster, or hand-held games. The hardware interfaces of both devices have much in common, and those of the microcontrollers are generally a simplified subset of the microprocessor. The primary design goals for each type of chip can be summarized this way:
•microprocessors are most flexible
•microcontrollers are most compact
There are also differences in the basic CPU architectures used, and these tend to reflect the application. Microprocessor based machines usually have a von Neumann architecture with a single memory for both programs and data to allow maximum flexibility in allocation of memory. Microcontroller chips, on the other hand, frequently embody the Harvard architecture, which has separate memories for programs and data. Figure 1-1 illustrates this difference.
Program |
Data |
Program |
||||||
CPU |
and Data |
CPU |
||||||
Memory |
Memory |
|||||||
Memory |
||||||||
Figure 1-1: At left is the von Neumann architecture; at right is the Harvard architecture.
One advantage the Harvard architecture has for embedded applications is due to the two types of memory used in embedded systems. A fixed program and constants can be stored in non-volatile ROM memory while working variable
5CHAPTER ONE
Review of Electronics Fundamentals
The peripherals on a microcon- |
Microprocessor |
Devices |
||||
troller chip are typically timers, |
||||||
Functions |
||||||
counters, serial or parallel data |
||||||
ports, and analog-to-digital and |
||||||
digital-to-analog converters |
||||||
that are integrated directly on |
CPU |
Memory |
I/O |
|||
the chip. The performance of |
||||||
these peripherals is generally |
||||||
less than that of dedicated |
||||||
peripheral chips, which are
frequently used with microprocessor chips. However, having the bus connections, CPU, memory, and I/O functions on one chip has several advantages:
•Fewer chips are required since most functions are already present on the processor chip.
•Lower cost and smaller size result from a simpler design.
•Lower power requirements because on-chip power requirements are much smaller than external loads.
•Fewer external connections are required because most are made on-chip, and most of the chip connections can be used for I/O.
•More pins on the chip are available for user I/O since they aren’t needed for the bus.
•Overall reliability is higher since there are fewer components and interconnections.
6EMBEDDED CONTROLLER
Hardware Design
Of course there are disadvantages too, including:
•Reduced flexibility since you can’t easily change the functions designed into the chip.
•Expansion of memory or I/O is limited or impossible.
•Limited data transfer rates due to practical size and speed limits for a single-chip.
•Lower performance I/O because of design compromises to fit everything on one chip.
Digital Hardware Concepts
In addition to the CPU, memory, and I/O building blocks, other logic circuits may also be required. Such logic circuits are frequently referred to as glue logic because they are used to connect the various building blocks together. The most difficult and important task the hardware designer faces is the proper selection and specification of this “glue logic.” Devices such as registers, buffers, drivers and decoders are frequently used to adapt the control signals provided by the CPU to those of the other devices. While TTL gate level logic is still in use for this purpose, the programmable logic device (PLD) has become an important device in connecting the building blocks. Contemporary microcontroller designers need to acquire the following skills:
•Interpretation of manufacturers specifications
•Detailed, worst case timing analysis and design
•Worst case signal loading analysis
•Design of appropriate signal and level conversion circuits
•Component evaluation and selection
•Programmable logic device selection and design
The glue logic used to join the processor, memories, and I/O is ultimately composed of logic gates, which are themselves composed almost entirely of transistors, diodes, resistors, and interconnecting wires. In order to understand the basic operation of the glue logic, we are going to begin at the component level with a review of basic electronics concepts. These concepts will be presented as fluid flow analogies.
7CHAPTER ONE
Review of Electronics Fundamentals
Voltage, Current, and Resistance
In Figure 1-3, a battery provides |
Voltage Source |
Positive |
Pressure is |
|||||||
a voltage source for electricity, |
Pressure |
analagous |
||||||||
to Voltage |
||||||||||
much like a pump provides a |
||||||||||
pressure source for a fluid. Voltage, |
||||||||||
or pressure, is required to produce |
||||||||||
current flow in the circuit. |
||||||||||
The voltage source provides the |
Negative |
|||||||||
Pressure |
||||||||||
pressure “motivation,” if you will,
for current flow. Resistance pro- |
Figure 1-3: Voltage in an electrical circuit is |
|
analogous to pressure in a fluid. |
||
vides a limiting constraint on the
amount of current that will actually flow. The resistor will allow a current to flow through it that is proportional to the voltage across it, and inversely proportional to the resistance value. Higher resistance is like a smaller aperture for the fluid to flow through. The
resistance results in a voltage, or pressure drop, across the resistance as long as current is
flowing in the resistor. Figure 1-4 illustrates this.
The wiring connecting the components in a circuit is like the piping connecting plumbing components that let a fluid flow. The flow of current in the circuit
is controlled by the magnitude of the voltage (pressure) and the resistance (pressure drop) in the circuit. In Figure 1-5, the battery provides a voltage to force current through the resistor. The magnitude of the voltage (V) generated by the battery is developed across the resistor, and the magnitude of the resistance (R), determine the current (I). Note the “return” current path is often shown as “ground,” which is the reference voltage used as the “zero volts” point. In this case, current flows from the positive battery terminal, through the wire, then the resistor, then through the “ground” connection to the minus terminal of the battery. This is usually not the same as earth ground, which provides a connection to a stake or pipe literally stuck in the ground. The magnitude of the current in this case is I = V / R by re-arranging the