
- •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
211CHAPTER ELEVEN
Other Interfaces
Another common form of conversion, used for digital signals, is logic level conversion. This is required for serial I/O devices conforming to the RS-232 standard, which uses logic voltages in the -12 to +12 volt range rather than the lower voltages that are standard on digital processors and logic. There are special level translation ICs which have voltage multipliers and negative voltage generators as well as level converters on a single IC. These devices take a +5 volt supply, convert it to + and -12 volts, and translate to and from standard logic levels. Logic level conversion is also required when interfacing two incompatible logic families, such as TTL and ECL.
Special Proprietary Synchronous Serial Interfaces
Many embedded systems require the use of a few specialized I/O devices, and the limited pin count of a microcontroller chip can make it difficult to interface all the desired I/O. In order to allow I/O expansion without using many of the pins on a microcontroller, several manufacturers have adopted a serial bus mechanism. Some of the devices are unique and proprietary, but there are two that are standardized:
•Philips’ serial bus, trademarked as I2C (for Inter-Integrated Circuit bus)
•National’s serial bus, trademarked as MicroWire
The I2C bus is much more flexible because it allows many devices to coexist on the bus. It is also more complex, as it allows for a large number of device addresses and multiple masters. The MicroWire bus is relatively simple, but requires additional I/O pins for multiple devices.
Unconventional Use of DRAM for Low Cost Data Storage
In some applications, static RAM (SRAM) is too expensive for data storage. A low cost alternative is to use dynamic RAM (DRAM) and handle the address multiplexing and refresh under software control. On a cost-per-bit basis, DRAM is significantly less expensive than SRAM. If the cost of address multiplexing and refresh hardware is added to the DRAM cost, it is not cost effective
212EMBEDDED CONTROLLER
Hardware Design
for small memories. In general, interfacing a DRAM directly to a microcontroller under software control is the best way to get extremely low cost-per-bit storage. It’s used for applications like voice storage in low cost digital answering machines. It works well, and there are a lot of tricks you can use, such as refreshing all the rows in one burst. The disadvantage is that a significant amount of processor time has to be used to refresh the memory. In addition, each read or write access has the overhead of multiplexing the address bits and strobing the /RAS and /CAS lines under program control.
In some cases the entire memory is not needed, so it is possible to reduce the number of I/O pins used to interface to the address lines. This would seem to be wasteful, but the price of memory chips must be considered. For current chip designs, larger memories cost more than smaller ones. Once DRAM parts become obsolete, the prices for small, obsolete parts actually become greater than larger memories because the smaller chips are no longer produced in volume. It is possible to use a portion of a larger memory chip by connecting some of the address lines in parallel and ignoring the additional memory. The reason you can’t just fix some of the address lines high or low is that some devices require a changing level on the address lines for internal circuitry that pre-charges the select lines in the array. The locations you can’t access won’t be refreshed, but that won’t matter since they’re not used.
Modern DRAMs have automatic refresh circuits which perform a refresh cycle using /CAS before /RAS refresh cycles, and even include internal refresh address counters. As an example, a 1Mx4 DRAM part provides 512 kilobytes of data four bits at a time. It can be fully refreshed by pulsing /CAS then /RAS low once for every row in the memory array. Having access to four bits at a time reduces the address multiplexing I/O overhead compared to using a 4Mx1 DRAM.
Digital Signal Processing / Digital Audio Recording
A common use for DRAM is in low cost digital voice recording, such as that used in some digital answering machines and toys. A microcontroller could be used in conjunction with a DRAM to record and play back voice. Standard telephone digital voice circuits sample at a rate of 8000 samples per second companded at eight bits per sample, which is 8 kilobytes/second, or 64 kilobits/ second. Telephone circuits have a theoretical 4 kilohertz Nyquist bandwidth
213CHAPTER ELEVEN
Other Interfaces
limit, but a 3 kilohertz practical audio bandwidth due to filter design constraints, which is consistent with the bandwidth of an analog phone system. At 8000 samples per second, it would only be possible to store four seconds of audio in a 32 kilobyte SRAM. Using a 1Mx4 part would allow 512/8 = 64 seconds of speech in one DRAM chip.
Standard telephone CODEC (COder/DECoder) ICs have special logarithmic analog to digital and digital to analog converters as well as low pass anti-aliasing and smoothing filters built in. They’re used in huge quantity in digital telephone equipment. CODECs have serial I/O, but at 64,000 samples per second they’re probably too fast for devices such as a programmable interface controller (PIC). It is also possible to reduce the sample rate if a reduced bandwidth is acceptable.
A four chip system consisting of a microcontroller, a DRAM IC, a CODEC IC, and an audio amplifier IC could be used to store and play back speech at a cost of a few dollars. The length of the recording can be increased using data compression techniques. Special compression algorithms reduce the redundancy inherent in most audio signals, such as voice. There are some very efficient coding schemes such as linear predictive coding (LPC) that have the ability to store compressed speech at rates as low as a few thousand bits per second. They actually model the human vocal tract. The trade off is that the computational load for compression and decompression are fairly large to get high compression ratios. It’s fairly simple to playback and is useful for pre-recorded speech. That’s what is used in many talking toys like Texas Instruments’ “Speak and Spell.” TI developed the LPC algorithm, and was first to sell it in consumer products.
Simpler compression schemes, like adaptive differential pulse code modulation
(ADPCM), can give as much as 4:1 compression ratios without much computation. A compression ratio of 4:1 would result in 2 kilobytes per second of compressed speech. ADPCM encodes differences between samples instead of the raw values. Some applications don’t require high quality audio, so there are quite a few corners that can be cut. For example, it’s possible to reproduce intelligible speech using samples of less than eight bits. Four bits is probably enough for some voice storage applications. It is even possible to reproduce intelligible speech on the one bit digital output of the PC’s speaker! At the other extreme, some signals, such as music, require higher sample rates and more bits per sample. Compact audio discs (standard CDs), for example, use
214EMBEDDED CONTROLLER
Hardware Design
44,100 samples per second at 16 bits per channel per sample to store very high quality audio. This results in 44,100 samples/second * 16 bits/sample/ channel * 2 channels = 1,411,200 bits per second of stereo audio. (Actual data rates are slightly higher, in order to accommodate synchronization and other overhead.)