
- •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

134EMBEDDED CONTROLLER
Hardware Design
External Data Memory Cycles
Data memory read and write cycles are also examined in basically the same way, using the CPU data read cycle data and the SRAM performance specifications. The data read cycle has essentially the same three possible paths as the program read cycle, except that the CPU /RD signal is connected to the SRAM /OE input, and the SRAM chip enable is grounded.
External Memory Data Memory Read
The data memory cycle corresponds closely to the program memory cycle, as shown in the accompanying figures and tables. Figure 6-6 illustrates the timing relationship between the CPU and external SRAM data memory when the CPU
|
ALE |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
PSEN |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TRLRH |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|||
|
|
RD |
|
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||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Variable Clock |
|
|||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
12 MHz Clock |
|
1/TCLCL = 1.2 to 12 MHz |
|
||||||||||||||||||||||||
|
Symbol |
|
Parameter |
|
|
|
min |
max |
units |
|
|
min |
|
|
|
|
|
max |
units |
|||||||||||||||||||||
|
TRLRH |
|
/RD Pulse Width |
|
|
|
400 |
|
|
|
|
|
nS |
|
6TCLCL-100 |
|
|
|
|
|
|
|
|
|
|
|
|
nS |
||||||||||||
|
TWLWH |
|
/WR Pulse Width |
|
|
|
400 |
|
|
|
|
|
nS |
|
6TCLCL-100 |
|
|
|
|
|
|
|
|
|
|
|
|
nS |
||||||||||||
|
TRLDV |
|
/RD To Valid Data In |
|
|
250 |
|
|
nS |
|
|
|
|
|
|
5TCLCL-170 |
nS |
|||||||||||||||||||||||
|
TRHDX |
|
Data Hold After /RD |
|
0 |
|
|
|
|
|
nS |
|
0 |
|
|
|
|
|
|
|
|
|
|
|
|
nS |
||||||||||||||
|
TRHDZ |
|
Data Float After /RD |
|
|
100 |
|
|
nS |
|
|
|
|
|
|
|
2TCLCL-70 |
nS |
||||||||||||||||||||||
|
TAVDV |
|
Address to Valid Data In |
|
|
600 |
|
|
nS |
|
|
|
|
|
|
9TCLCL-150 |
nS |
|||||||||||||||||||||||
|
TAVWL |
|
Addressto /WR or /RD |
|
200 |
|
|
|
|
|
nS |
|
4TCLCL-130 |
|
|
|
|
|
|
|
|
|
|
|
|
nS |
||||||||||||||
|
TQVWH |
|
Data Setup Before /WR |
|
400 |
|
|
|
|
|
nS |
|
7TCLCL-180 |
|
|
|
|
|
|
|
|
|
|
|
|
nS |
||||||||||||||
|
TWHQX |
|
Data Held After /WR |
|
80 |
|
|
|
|
|
nS |
|
2TCLCL-90 |
|
|
|
|
|
|
|
|
|
|
|
|
nS |
NOTE: There are 2 to 8 ALE cycles per instruction. Clocks and state timing are shown on the timing diagram for reference purposes only. They are not accessible outside the package. TCY is the minimum instruction cycle time that consists of 12 oscillator clocks or two ALE cycles. Address setup and hold times are the same for data and program memory.
Table 6-4: 8031 data memory timing parameters.

135CHAPTER SIX
A Detailed Design Example
reads from the SRAM while Figure 6-7 shows the SRAM read cycle timing diagram. Table 6-4 gives the data memory timing parameters for the 8031, and Table 6-5 lists the SRAM’s ready cycle timing parameters. The CPU’s TAVDV spec places an upper limit on the data memory’s access time, tAA, for path A.
|
tRC |
Address |
Valid Address |
|
tAA |
|
tACS |
CS |
|
|
tOH |
|
tOE |
|
tOLZ |
OE |
|
|
tOHZ |
|
tCHZ |
Dout |
High Impedance |
Valid Data |
Figure 6-7: SRAM read cycle timing diagram.
|
|
-8 |
|
-10 |
|
-12 |
|
-15 |
|
|
Parameter |
Symbol |
min |
max |
min |
max |
min max |
min |
max |
Units |
|
Read Cycle |
tRC |
85 |
|
100 |
|
120 |
|
150 |
|
nS |
Address access |
tAA |
|
85 |
|
100 |
|
120 |
|
150 |
nS |
/CS access |
tACS |
|
85 |
|
100 |
|
120 |
|
150 |
nS |
/OE to Output Valid |
tOE |
|
45 |
|
50 |
|
60 |
|
70 |
nS |
Output hold from addr |
tOH |
5 |
|
10 |
|
10 |
|
10 |
|
nS |
/CS to output enable(low Z) |
tCLZ |
10 |
|
10 |
|
10 |
|
10 |
|
nS |
/OE to output enable(low Z) |
tOLZ |
5 |
|
5 |
|
5 |
|
5 |
|
nS |
/CS hi to out disable(hi Z) |
tCHZ |
0 |
30 |
0 |
35 |
0 |
40 |
0 |
50 |
nS |
/OE hi to out disable(hi Z) |
tOHZ |
0 |
30 |
0 |
35 |
0 |
40 |
0 |
50 |
nS |
Table 6-5: SRAM read cycle timing parameters.
A)The delay from when the CPU provides a valid address A8..15 on Port 2 until the end of the SRAM address access time, resulting in valid data from the SRAM on the data bus. The CPU requires that the data from the SRAM be available 600 nS (TAVDV) after being presented with a valid

136EMBEDDED CONTROLLER
Hardware Design
address. The -15 version of the SRAM has an address access time of 150 nS max. (SRAM tAA), so there is 450 nS of margin for this memory at this clock speed!
TAVDV - SRAM tAA = 600 - 150 = 450 nS margin
B)Even allowing for an additional 16 nS through the address latch for address bits 0..7, there is still a margin of 434 nS, so there is no problem with address access time.
TAVDV - SRAM tAA - Latch tPmax = 600 - 150 -16 = 434 nS margin
C)This is the time available to the memory after /RD goes low and when valid data is on the bus. The enable access time provided by the CPU is 250 nS (TRLDV). Since the slowest RAM, the -15 version, has an OE access time of 70 nS (tOE), there is 180 nS of design margin.
External Data Memory Write
Figure 6-8 and Table 6-6 show the SRAM write cycle diagram and timing parameters. Figure 6-9 shows a data memory write timing diagram for the 8031.
|
|
tWC |
|
Address |
|
Valid Address |
|
|
|
tACS |
tWR |
OE |
|
tCW |
|
|
|
|
|
CS |
|
|
|
|
tAS |
tWP |
|
WE |
|
|
|
|
tOHZ |
|
|
Dout |
|
High Impedance |
|
|
tDW |
tDH |
|
|
|
||
Din |
High Impedance |
Valid Data |
|
|
Figure 6-8: SRAM write cycle timing diagram.

137CHAPTER SIX
A Detailed Design Example
|
|
|
-8 |
|
-10 |
|
-12 |
|
-15 |
|
|
Parameter |
|
Symbol |
min max |
min max |
min max |
min max |
Units |
||||
Write Cycle |
|
tWC |
85 |
|
100 |
|
120 |
|
150 |
|
nS |
Chip Select to |
end of write |
tCW |
75 |
|
80 |
|
85 |
|
100 |
|
nS |
Addr valid to |
end of write |
tAW |
75 |
|
80 |
|
85 |
|
100 |
|
nS |
Address setup time |
tAS |
0 |
|
0 |
|
0 |
|
0 |
|
nS |
|
Write Pulse width |
tWP |
60 |
|
60 |
|
70 |
|
90 |
|
nS |
|
Write recovery time |
tWR |
10 |
|
0 |
|
0 |
|
0 |
|
nS |
|
Write to output in high Z |
tWHZ |
0 |
30 |
0 |
35 |
0 |
40 |
0 |
50 |
nS |
|
Data to Write time overlap |
tDW |
40 |
|
40 |
|
50 |
|
60 |
|
nS |
|
Data hold from write time |
tDH |
0 |
|
0 |
|
0 |
|
0 |
|
nS |
|
Output disable to out in highZ |
tOHZ |
0 |
30 |
0 |
35 |
0 |
40 |
0 |
50 |
nS |
|
Output active from end of WR |
tOW |
5 |
|
5 |
|
5 |
|
5 |
|
nS |
Table 6-6: SRAM write cycle.
ALE |
|
|
|
|
|
|
PSEN |
|
|
|
|
TWLWH |
|
|
|
|
|
|
|
|
WR |
|
|
|
|
|
|
Port 2 |
|
|
|
|
ADDRESS A15-A8 |
|
|
|
|
|
TAVWL |
|
|
|
|
|
|
|
TQVWH |
|
Port 0 |
INSTR |
IN |
FLOAT |
A7-A0 |
DATA |
OUT |
ADDRESS
OR SFR P2
TWHQZ
ADDRESS
OR FLOAT
Figure 6-9: 8031 data memory write timing.
From the CPU specifications, the address is valid 200 nS (TAVWL) before the /WR line goes low, and the data is valid 400 nS (TQVWH) before the /WR line goes high. The RAM requires an address setup before write time of 0 nS, which is compatible with the 200 nS provided by the CPU. The RAM data setup time before the end of the /WE pulse (SRAM spec tDW) is 60 nS, which is well within the 400 nS available. The latch delay has been ignored here because it is 16 nS, which is insignificant compared to the design margin available. Also, the chip select input of the RAM is grounded, so the chip select access time does not need to be considered. The minimum write pulse width from the CPU is 400 nS (TWLWH), and the RAM requires only a minimum of 90 nS (tWP), so the pulse width is well within the spec. The RAM has a 0 nS hold time requirement (tDH), and the processor provides 80 nS (TWHQX), so the RAM hold time requirement is also met with margin.