
- •Table of Contents
- •Objectives
- •Embedded Microcomputer Applications
- •Microcomputer and Microcontroller Architectures
- •Digital Hardware Concepts
- •Voltage, Current, and Resistance
- •Diodes
- •Transistors
- •Mechanical Switches
- •Transistor Switch ON
- •Transistor Switch OFF
- •The FET as a Logic Switch
- •NMOS Logic
- •CMOS Logic
- •Mixed MOS
- •Real Transistors Don’t Eat Q!
- •Logic Symbols
- •Tri-State Logic
- •Timing Diagrams
- •Multiplexed Bus
- •Loading and Noise Margin Analysis
- •The Design and Development Process
- •Chapter One Problems
- •Organization: von Neumann vs. Harvard
- •Microprocessor/Microcontroller Basics
- •Microcontroller CPU, Memory, and I/O
- •Design Methodology
- •The 8051 Family Microcontroller
- •Processor Architecture
- •Introduction to the 8051 Architecture
- •8051 Memory Organization
- •8051 CPU Hardware
- •Oscillator and Timing Circuitry
- •The 8051 Microcontroller Instruction Set Summary
- •Direct and Register Addressing
- •Indirect Addressing
- •Immediate Addressing
- •Generic Address Modes and Instruction Formats
- •8051 Address Modes
- •The Software Development Cycle
- •Software Development Tools
- •Hardware Development Tools
- •Chapter Two Problems
- •Timing Diagram Notation Conventions
- •Rise and Fall Times
- •Propagation Delays
- •Setup and Hold Time
- •Tri-State Bus Interfacing
- •Pulse Width and Clock Frequency
- •Fan-Out and Loading Analysis—DC and AC
- •Calculating Wiring Capacitance
- •Fan-Out When CMOS Drives LSTTL
- •Transmission Line Effects
- •Ground Bounce
- •Logic Family IC Characteristics and Interfacing
- •Interfacing TTL Compatible Signals to 5 Volt CMOS
- •Design Example: Noise Margin Analysis Spreadsheet
- •Worst-Case Timing Analysis Example
- •Chapter Three Review Problems
- •Memory Taxonomy
- •Secondary Memory
- •Sequential Access Memory
- •Direct Access Memory
- •Read/Write Memories
- •Read-Only Memory
- •Other Memory Types
- •JEDEC Memory Pin-Outs
- •Device Programmers
- •Memory Organization Considerations
- •Parametric Considerations
- •Asynchronous vs. Synchronous Memory
- •Error Detection and Correction
- •Error Sources
- •Confidence Checks
- •Memory Management
- •Cache Memory
- •Virtual Memory
- •CPU Control Lines for Memory Interfacing
- •Chapter Four Problems
- •Read and Write Operations
- •Address, Data, and Control Buses
- •Address Spaces and Decoding
- •Address Map
- •Chapter Five Problems
- •The Central Processing Unit (CPU)
- •Memory Selection and Interfacing
- •Preliminary Timing Analysis
- •External Data Memory Cycles
- •External Memory Data Memory Read
- •External Data Memory Write
- •Design Problem 1
- •Design Problem 2
- •Design Problem 3
- •Completing the Analysis
- •Chapter Six Problems
- •Introduction to Programmable Logic
- •Technologies: Fuse-Link, EPROM, EEPROM, and RAM Storage
- •PROM as PLD
- •Programmable Logic Arrays
- •PAL-Style PLDs
- •Design Examples
- •PLD Development Tools
- •Simple I/O Decoding and Interfacing Using PLDs
- •IC Design Using PCs
- •Chapter Seven Problems
- •Direct CPU I/O Interfacing
- •Port I/O for the 8051 Family
- •Output Current Limitations
- •Simple Input/Output Devices
- •Matrix Keyboard Input
- •Program-Controlled I/O Bus Interfacing
- •Real-Time Processing
- •Direct Memory Access (DMA)
- •Burst vs. Single Cycle DMA
- •Cycle Stealing
- •Elementary I/O Devices and Applications
- •Timing and Level Conversion Considerations
- •Level Conversion
- •Power Relays
- •Chapter Eight Problems
- •Interrupt Cycles
- •Software Interrupts
- •Hardware Interrupts
- •Interrupt Driven Program Elements
- •Critical Code Segments
- •Semaphores
- •Interrupt Processing Options
- •Level and Edge Triggered Interrupts
- •Vectored Interrupts
- •Non-Vectored Interrupts
- •Serial Interrupt Prioritization
- •Parallel Interrupt Prioritization
- •Construction Methods
- •Power and Ground Planes
- •Ground Problems
- •Electromagnetic Compatibility
- •Electrostatic Discharge Effects
- •Fault Tolerance
- •Hardware Development Tools
- •Instrumentation Issues
- •Software Development Tools
- •Other Specialized Design Considerations
- •Thermal Analysis and Design
- •Battery Powered System Design Considerations
- •Processor Performance Metrics
- •Benchmarks
- •Device Selection Process
- •Analog Signal Conversion
- •Special Proprietary Synchronous Serial Interfaces
- •Unconventional Use of DRAM for Low Cost Data Storage
- •Digital Signal Processing / Digital Audio Recording
- •Detailed Checklist
- •1. Define Power Supply Requirements
- •2. Verify Voltage Level Compatibility
- •3. Check DC Fan-Out: Output Current Drive vs. Loading
- •4. AC (Capacitive) Output Drive vs. Capacitive Load and De-rating
- •5. Verify Worst Case Timing Conditions
- •6. Determine if Transmission Line Termination is Required
- •7. Clock Distribution
- •8. Power and Ground Distribution
- •9. Asynchronous Inputs
- •10. Guarantee Power-On Reset State
- •11. Programmable Logic Devices
- •12. Deactivate Interrupt and Other Requests on Power-Up
- •13. Electromagnetic Compatibility Issues
- •14. Manufacturing and Test Issues
- •Books
- •Web and FTP Sites
- •Periodicals: Subscription
- •Periodicals: Advertiser Supported Trade Magazines
- •Index
207CHAPTER TEN
Other Useful Stuff
Benchmarks
Benchmarks are short, self-contained programs which perform a critical part of an application—such as a sorting algorithm—that are used to compare functionally equivalent code on different machine. The programs are run for some number of iterations, and the time is measured and compared with that of other CPUs. The weakness here is that the benchmark is not only a measure of the processor, but also of the programmer and the tools used to implement the program. As a result, the best benchmark is the one you write yourself, since it allows you to discover how efficiently the code you write will execute on a given processor with the tools available. That’s as close to the real application performance as you’re likely to get, short of fully implementing the application on each processor under evaluation.
Device Selection Process
In selecting a device from a field of several devices, there is more to be considered than just the speed of the processor. Some factors, such as the availability of secondary suppliers may be an absolute requirement in some applications. In order to make a systematic evaluation and selection of the best alternative, the following method has proved to be valuable, particularly when the selection process must be documented and justified. The process consists of three major steps: eliminating the alternatives that are completely inappropriate, ranking the remaining options, and evaluating the adverse consequences of a catastrophic event.
The three decision matrices are:
1)Pass/fail criteria for elimination of non-conforming alternative.
2)Weighted scoring of parametric values to rank options.
3)Consideration of adverse consequences, including their probability and severity
The first matrix consists of a table with all the options on one axis and all the “must have” criteria on the other axis. Each criterion is checked off for each option. The second matrix consists of the surviving options from the first matrix on one axis of a table, and a list of quantitative measures on the other
208EMBEDDED CONTROLLER
Hardware Design
axis, along with a weighting factor for each measure, indicating its relative importance. Each option receives a weighted score allowing them to be ranked. Finally, each of the top ranking options is evaluated with respect to probability of occurrence. For instance, a dual source part that both manufacturers produce in the Silicon Valley could become totally unavailable from either source in the event of a major earthquake in that region. In that case, even though the probability of occurrence is very low, the consequences are very severe; production could be interrupted for a very long time from both sources simultaneously, causing the product they’re designed into to stop shipping for an indefinite period of time.
11 |
|
CHAPTER ELEVEN |
209 |
Other Interfaces
Many of the more advanced microcontrollers come with extensive enhancements to simplify their interface with real-world devices. There are a large number of sensors and actuators that can be interfaced to a microcontroller. Common sensors indicate parameters which include temperature, pressure, position, speed, flow rate, strain, torque, volume, density, magnetic compass heading, light level, concentrations of gases, and many more. Because of the application of semiconductor fabrication technology to many of these sensors, the cost, complexity, and accuracy have improved significantly. There are also several low cost output devices and actuators available for use with microcontrollers, including LEDs, LCDs, radio control servos, “muscle wire” that changes length when a current runs through it, and piezoelectric transducers, among others.
In many cases, these sensors and transducers inputs and outputs can be processed using simple I/O devices commonly available on most microcontrollers.
•Non-contact proximity sensors are available which put out a frequency or phase signal that is proportional to position. A simple counter can be used to measure the frequency or timing of the signals from such devices.
•A three-pin IC is available which contains all the circuitry necessary to convert the temperature into a serial digital value that can be read by a micro (Dallas DS1620).
•A simple magnetic compass provides heading information in serial digital format, or as an output voltage proportional to heading.
There are also many different options for connecting and communicating with these devices, including IR (infra-red light), radio, AC carrier current, and several variations on traditional wired connections.
210EMBEDDED CONTROLLER
Hardware Design
Analog Signal Conversion
Many types of embedded computer applications must deal with information that is not inherently digital by nature. Real world signals, such as temperature and pressure, are inherently analog signals. Analog signals are continuously variable in amplitude and must be converted to discrete digital approximations for use in digital processors. Real analog values can only be approximated with a discrete digital value. As noted in previous chapters, devices that convert from the continuously variable form to the discrete form of representation are called analog to digital converters (ADC or A/D). Similarly, there are devices that convert from digital to analog form, called digital to analog converters (DAC or D/A). Since analog values may vary continuously over time, it is also necessary to sample these varying values to allow conversion to a single value. Sampling is like taking a “snapshot” of a changing value at one point in time, similar to the way a moving object is frozen at one point in time by a strobe light. An analog device, known as a sample and hold (S/H or SAH) is used to take the snapshot using a switch and a capacitor to sample and store an analog value. After an analog signal is sampled, it can be converted to digital form by an A/D converter. The digital approximation of the sampled analog value can then be used by the processor and later converted back to an analog value by a DAC, if required. This is the general approach used to record and playback speech in a digital answering machine (this will be discussed later in this chapter).
Some microcontrollers include A/D converter hardware, with as many as eight analog inputs. Most devices do not have an internal DAC, but some have a pulse width modulated (PWM) digital output instead, which can be used in place of a conventional DAC. The PWM waveform is most often generated by operating one or more of the microcontroller’s timer/counters in a special PWM count mode. The PWM output has a rectangular wave output with a duty cycle that can be programmed between 0 and 100%. By averaging or integrating the PWM output with a filter, it is possible to get an analog value from this inherently digital counter output. In some cases the averaging is part of the output device’s inherent characteristics. One example is an electric motor that will respond to the average value of the voltage applied to it. The rotational inertia of the motor provides the averaging of the variable duty cycle digital waveform applied to it. A resistive heating element also responds to the average level applied to it due to a relatively slow thermal time constant.