Embedded Controller Hardware Design by Ken Arnold
Total Page:16
File Type:pdf, Size:1020Kb
A Volume in the Embedded Technology™ Series Embedded Controller Hardware Design by Ken Arnold www.LLH-Publishing.com www.EmbeddedControllerHardwareDesign.com ii Embedded Control Hardware Design © 2001 by LLH Technology Publishing. All rights reserved. No part of this book may be reproduced, in any form or by any means whatsoever, without permission in writing from the publisher. While every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Neither is any liability assumed for damages resulting from the use of the information contained herein. ISBN: 1-878707-52-3 Library of Congress Control Number: 00-135391 Printed in the United States of America 10 9 8 7 6 5 4 3 2 1 Project management and developmental editing: Harry Helms, LLH Technology Publishing Interior design and production services: Greg Calvert, Model, CO Cover design: Sergio Villareal, Vista, CA www.LLH-Publishing.com www.EmbeddedControllerHardwareDesign.com iii Dedication This book is dedicated in memory of my father, Kenneth Owen Arnold, who always encouraged me to follow my dreams. When other adults discouraged me from entering the engineering field, he told me, “If you really like what you’re doing and you’re good at it, you will be successful.” Nowadays I get paid to have fun doing things I’d do for free anyway, so that meets my definition of success! Thanks, Dad. iv Acknowledgment This book is a direct result of contributions from many of the students I have been fortunate enough to have in my embedded computer engineering courses at the University of California—San Diego extension. They have provided a valuable form of feedback by sharing their notes and pointing out weaknesses in the text and in-class presentations. Some sections of this text were also provided by David Fern and Steven Tietsworth. I would also like to thank my family for supporting me and, Mary, Nikki, Kenny, Daniel, Amy, and Annie for being patient and helping out when I needed it! 1 Review of Electronics Fundamentals.............................. 1 Objectives ........................................................................................... 2 Embedded Microcomputer Applications.............................................. 2 Microcomputer and Microcontroller Architectures............................... 4 Digital Hardware Concepts ................................................................. 6 Voltage, Current, and Resistance ............................................................ 7 Diodes...................................................................................................... 9 Transistors ............................................................................................... 9 Mechanical Switches ............................................................................... 10 Transistor Switch ON ............................................................................... 11 Transistor Switch OFF ............................................................................. 12 The FET as a Logic Switch ...................................................................... 12 NMOS Logic............................................................................................. 13 CMOS Logic............................................................................................. 14 Mixed MOS .............................................................................................. 16 Real Transistors Don�t Eat Q! .................................................................. 16 Logic Symbols..................................................................................... 17 Tri-State Logic.......................................................................................... 18 Timing Diagrams ................................................................................. 19 Multiplexed Bus ................................................................................... 20 Loading and Noise Margin Analysis.................................................... 21 The Design and Development Process............................................... 21 Chapter One Problems ....................................................................... 22 2 Microcontroller Concepts ................................................. 23 Organization: von Neumann vs. Harvard ............................................ 24 Microprocessor/Microcontroller Basics ............................................... 24 Microcontroller CPU, Memory, and I/O .................................................... 25 Design Methodology ................................................................................ 26 The 8051 Family Microcontroller Processor Architecture ................... 27 Introduction to the 8051 Architecture ....................................................... 28 Memory Organization............................................................................... 30 CPU Hardware ......................................................................................... 32 Oscillator and Timing Circuitry ................................................................. 41 The 8051 Microcontroller Instruction Set Summary ............................ 42 Direct and Register Addressing ............................................................... 43 Indirect Addressing .................................................................................. 46 Immediate Addressing ............................................................................. 50 Generic Address Modes and Instruction Formats.................................... 51 Address Modes ........................................................................................ 52 The Software Development Cycle ........................................................... 55 Software Development Tools ................................................................... 55 Hardware Development Tools ................................................................. 56 Chapter Two Problems ....................................................................... 56 3 Worst- Case Timing, Loading, Analysis, and Design .... 57 Timing Diagram Notation Conventions ............................................... 58 Rise and Fall Times ................................................................................. 59 Propagation Delays.................................................................................. 59 Setup and Hold Time ............................................................................... 60 Tri-State Bus Interfacing .......................................................................... 61 Pulse Width and Clock Frequency ........................................................... 62 Fan-Out and Loading Analysis�DC and AC ......................................... 63 Calculating Wiring Capacitance ............................................................... 66 Fan-Out When CMOS Drives LSTTL....................................................... 68 Transmission Line Effects........................................................................ 70 Ground Bounce........................................................................................ 72 Logic Family IC Characteristics and Interfacing.................................. 75 Interfacing TTL Compatible Signals to 5 Volt CMOS ............................... 78 Design Example: Noise Margin Analysis Spreadsheet............................ 82 Worst-Case Timing Analysis Example ..................................................... 90 Chapter Three Review Problems ........................................................ 92 4 Memory Technologies and Interfacing............................ 95 Memory Taxonomy ............................................................................. 96 Secondary Memory.................................................................................. 97 Volatility.................................................................................................... 98 Random Access Memory ......................................................................... 98 Sequential Access Memory ..................................................................... 99 Direct Access Memory ............................................................................. 99 Read/Write Memories ......................................................................... 100 Read-Only Memory ............................................................................. 101 Other Memory Types .......................................................................... 104 JEDEC Memory Pin-Outs ................................................................... 105 Device Programmers .......................................................................... 106 Memory Organization Considerations................................................. 107 Parametric Considerations.................................................................. 109 Asynchronous vs. Synchronous Memory............................................ 110 Error Detection and Correction ........................................................... 111 Error Sources ........................................................................................... 111 Confidence Checks.................................................................................. 111 Memory Management ........................................................................