- •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
153CHAPTER SEVEN
Programmable Logic Devices
be shared inputs and outputs. Not all of the outputs are necessarily of the same type, however. The 16R4, for example, has four registered outputs and four asynchronous (un-registered) outputs. The V parts have a special output “macro-cell” that can be programmed to be asynchronous (un-clocked), synchronous (clocked), inverted, non-inverted, feedback internally to the AND array, and so on.
Design Examples
Probably the most common applications of simple PLDs are as address decoders in microcomputer and microprocessor systems. A device such as the 16L8 PAL, with active low outputs is well suited to drive the active low enable inputs of most memory and I/O
devices. Because a PAL |
|
PLD |
EPROM1CE |
|
|
||
8031 |
|
EPROM2CE |
|
|
|||
can have different logic |
PSEN |
|
|
||||
|
IN_EN |
|
|
+V |
|||
functions on the same |
|
RD |
|
|
|
||
|
RAM1CE |
|
|
|
|||
chip, one PAL can |
|
WR |
|
|
|
||
|
RAM2CE |
|
|
|
|||
decode both memory |
|
A15..A8 |
|
|
D0 |
SW1 |
|
|
|
|
|
||||
and I/O addresses. |
|
|
OUT_CK |
|
|
||
|
|
|
Input Port |
||||
Figure 7-7 shows an |
Address |
16 |
|
|
|
+V |
|
|
|
|
|
||||
example of this. The |
A0 ..15 |
A0 ..15 |
|
|
Output Port |
||
|
|
|
|||||
program memory |
RD |
To RAM OE |
|
|
C |
LED |
|
map for Figure 7-7 is |
|
|
|
|
|
||
WR |
To RAM WE |
D0 |
D |
Q |
|||
shown in Table 7-1; the |
|||||||
|
|
|
|
|
|
||
external data memory |
Figure 7-7: PLD decoding of memory and I/O enables. |
|
|||||
map is given in Table |
|
||||||
|
|
|
|
|
|
||
7-2. Address and control lines |
Program Memory Address Space |
|
|||||
can be wired to the input pins, |
Address Range (hex) |
Device Selected |
|||||
and the output pins can drive |
Program 0000 - 7FFF |
2Kx8 EPROM 1 |
|||||
the select and enable lines of |
Program 8000 – FFFF |
32Kx8 EPROM 2 |
|||||
the memory and I/O chips. |
|
|
|
|
|
||
|
Table 7-1: Program memory map for Figure 7-7. |
|
External Data Memory Address Space
Address Range (hex) |
Device Selected |
Table 7-2: External data |
|
Data 0000 |
- 7FFF |
32Kx8 SRAM 1 |
memory map for Figure 7-7. |
|
|||
Data 8000 |
- FEFF |
32Kx8 SRAM 2 |
|
Data FF00 - FFFF Read |
Input port enable |
|
|
|
|
|
|
Data FF00 - FFFF Write |
Output port latch clock |
|
154EMBEDDED CONTROLLER
Hardware Design
An 8031 system with two program EPROMs, two data SRAMs, and memory mapped I/O ports could be connected using gates or decoders, but it would be more efficient to use a 16L8 PAL. The inputs to the PAL are the control and address lines. The outputs are the memory chip enables, the input port drive enable, and the output latch clock.
Note that the program memory is full, using two 32-kilobyte devices. Also, the input and output ports appear in the external memory address space. This is an example partially decoded, memory mapped I/O, since the input and output devices appear repeatedly in a memory address range of FF00 to FFFF hex.
For the program memory, the equations that must be used to program the PLD would be as follows:
/EPROM1CE = /PSEN * /A15 Enabled when PSEN active and A15 = 0 /EPROM2CE = /PSEN * A15 Enabled when PSEN active and A15 = 1
The equations above will enable the EPROMs when the processor is fetching instructions (/PSEN = 0) so that EPROM1 will be enabled for program memory addresses 0-7FFF and EPROM2 will be enabled for addresses 8000-FFFF.
The gates in Figure 7-8 are the equivalent to the equations for the EPROM chip enable equations shown above. Note that the gate used for the EPROM1CE function is equivalent to a simple OR
gate. This is because inverting all the inputs and outputs of a logic function
changes it from an AND to an OR and vice versa.
The RAM addresses are similarly
enabled when the processor is accessing external data memory, except that the input and output ports are memory mapped into addresses FF00 to FFFF. In order to avoid bus contention, SRAM 2 is disabled between FF00 and FFFF.
/RAM1CE = /A15 Enabled when A15 = 0 /RAM2CE = A15 * /A14 * /A13 * /A12 * /A11 * /A10 * /A9 * /A8
Enabled when address > 8000 and < FFxx
/IN_EN = /RD * A15 * A14 * A13 * A12 * A11 * A10 * A9 * A8 Input Enabled when RD low and address = FFxx
/OUT_CK = /WR * A15 * A14 * A13 * A12 * A11 * A10 * A9 * A8 Output latch clock when WR address FFxx
155CHAPTER SEVEN
Programmable Logic Devices
This PLD implements a system with 64 kilobytes of program EPROM, and 64 kilobytes-256 bytes of data RAM. Note that 256 bytes of the external data memory address space are dedicated, or mapped, to the input/output port. The input port can be read as if it were data memory at locations FF00 to FFFF hex. This incomplete, or partial address decoding, decodes 256 different addresses to access the same input/output port (partial I/O address decoding). Similarly, the output port can be written to by writing data to data RAM addresses FF00 to FFFF hex. Note that changing the I/O addresses to different values requires only changing the equations and burning the corresponding fuse map patterns into another PLD. If the address map should need to be changed, it is possible
to do so by using a different PAL |
|
Program |
|
External |
|
device programmed with a |
|
|
Data |
||
different fuse map representing |
|
Memory |
|
Memory |
|
FFFF |
FFFF |
I/O |
|||
different equations. |
|||||
|
|
FF00 |
|||
|
|
|
FEFF |
|
Tables 7-1 and 7-2 above can also be represented graphically with an address map, as shown in Figure 7-9.
8000
7FFF
0000
PLD Development Tools
Because of the complexity that results from flexibility in defining PLD functions, it is not practical to manually define the fuse map that is used to program a PLD. Automated translation programs are used to convert a higherlevel description of the logic to the low-level fuse map that is required. The software that performs that task is referred to as a PLD assembler or compiler because it is equivalent to a programming language translator used on a general-purpose desktop personal computer. PLD development software is available from both PLD vendors and other software houses, in versions that run on PCs and workstations. PLD assemblers input Boolean equations and generate the corresponding fuse map for programming. PLD compilers, on the other hand, take higher-level circuit descriptions such as logic schematics, state diagrams, and truth tables as input in addition to Boolean equations. The equation notation and syntax are unique to each particular translator. Some of the translators will perform additional functions such as selecting the appropriate type of PLD for the design, and logic minimization that is intended to reduce the complexity and cost of the device that will ultimately implement the design.
156EMBEDDED CONTROLLER
Hardware Design
The two most common high-level logic compiler languages are VHDL and Verilog. Both of these hardware description languages are in common use for the design and definition of large, complex logic designs, as are commonly implemented in large custom logic ICs, and FPGAs. Because the larger FPGAs are difficult to program and modify using standard gate and module level design, the high-level hardware description languages are gaining popularity. The advantages and disadvantages of using a high-level hardware description language are very similar to those of a high-level computer language. By implementing a design using these high level descriptions, it is possible to take a chip design from one type of device to another with less effort than if
it was done at the gate level. Of course, similar trade-offs exist as they do for high-level language programs. They are less compact and efficient in the way they utilize the hardware, and tend to result in somewhat slower performance than hand optimized gate level designs.
Other design tools, such as logic simulators, allow the logic functions to be tested against known input and output logic patterns. The test patterns, referred to as test vectors, are presented to the software simulation of the PLD logic design in sequence and the simulated outputs are compared with the desired outputs for discrepancies. The test vectors for design verification are generated by the design engineer to verify that the design will perform as intended. Unfortunately some of the most common problems and errors are those that were not planned for and only show up upon plugging the PLD into the circuit. Unforeseen conditions often cause erroneous outputs, requiring correction of the PLD design.
Test vectors are also important in verifying that the PLD is fully functional. Even though the fuse map is read back during the programming process, other faults may be impossible to detect by verifying the fuse map. This is particularly true for fuse link devices, since there is no way for them to be fully tested at the factory due to the fact that they cannot be erased. The test vectors that are used for design verification can be applied to the device for testing immediately after being programmed and verified on many PLD programmers. Generating a set of test vectors that will detect all possible faults (100% fault coverage is virtually impossible, and even approaching that goal can require a lot of effort and many test vectors, particularly for sequential circuits. To address that need, some PLD software vendors have test vector generator programs, which will create a set of test vectors for a given PLD design automatically. Most of the newer, more complex devices also have