TEAM LRN TEAM LRN Analog and Digital Circuits for Electronic Control System Applications TEAM LRN This page intentionally left blank TEAM LRN Analog and Digital Circuits for Electronic Control System Applications Using the TI MSP430 Microcontroller by Jerry Luecke AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO Newnes is an imprint of Elsevier TEAM LRN Newnes is an imprint of Elsevier 200 Wheeler Road, Burlington, MA 01803, USA Linacre House, Jordan Hill, Oxford OX2 8DP, UK Copyright © 2005, Elsevier Inc. All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permission of the publisher. Permissions may be sought directly from Elsevier’s Science & Technology Rights Department in Oxford, UK: phone: (+44) 1865 843830, fax: (+44) 1865 853333, e-mail: [email protected]. You may also complete your request on-line via the Elsevier homepage (http://elsevier.com), by selecting “Customer Support” and then “Obtaining Permissions.” Recognizing the importance of preserving what has been written, Elsevier prints its books on acid-free paper whenever possible. Library of Congress Cataloging-in-Publication Data Luecke, Gerald. Analog and digital circuits for electronic control system applications : using the TI MSP430 microcontroller / by Gerald Luecke. p. cm. ISBN 0-7506-7810-0 1. Electronic circuit design. 2. Electronic control. 3. Programmable controllers. I. Title. TK7867.L84 2004 629.8'9--dc22 2004054669 British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library. For information on all Newnes publications visit our Web site at www.books.elsevier.com 04 05 06 07 08 09 10 9 8 7 6 5 4 3 2 1 Printed in the United States of America. TEAM LRN The book is dedicated to my wife Velma and our grandchildren: From the Luecke side: Cameron, Graham, Andy, Alex, Alyssa, Brent, Jacob, Harper, Arielle, Emery. From the Hubbard side: Jared, Garrett, Matthew, Ashton, Audrey. TEAM LRN This page intentionally left blank TEAM LRN Contents Foreword ..........................................................................................................................................xi Preface .............................................................................................................................................xii Acknowledgments .............................................................................................................................xiii What’s on the CD-ROM? ..................................................................................................................xiv Chapter 1: Signal Paths from Analog to Digital ......................................................................................1 Introduction ..................................................................................................................................................................1 A Refresher ..................................................................................................................................................................1 Accuracy vs. Speed—Analog and Digital ...................................................................................................................5 Interface Electronics ....................................................................................................................................................6 The Basic Functions for Analog-to-Digital Conversion ..............................................................................................6 Summary ......................................................................................................................................................................8 Chapter 1 Quiz .............................................................................................................................................................9 Chapter 2: Signal Paths from Digital to Analog ....................................................................................11 Introduction ................................................................................................................................................................11 The Digital-to-Analog Portion ...................................................................................................................................11 Filtering ......................................................................................................................................................................13 Conditioning the Signal .............................................................................................................................................13 Transducing the Signal ...............................................................................................................................................13 Summary ....................................................................................................................................................................15 Chapter 2 Quiz ...........................................................................................................................................................16 Chapter 3: Sensors ...........................................................................................................................18 Introduction ................................................................................................................................................................18 Temperature Sensors ..................................................................................................................................................18 Angular and Linear Position ......................................................................................................................................21 Rotation ......................................................................................................................................................................24 Magnetoresistor Sensor ..............................................................................................................................................24 Pressure ......................................................................................................................................................................25 Light Sensors .............................................................................................................................................................27 Other Sensors .............................................................................................................................................................32 Summary ....................................................................................................................................................................32 Chapter 3 Quiz ...........................................................................................................................................................32 Chapter 4: Signal Conditioning ...........................................................................................................35 Introduction ................................................................................................................................................................35 Amplification .............................................................................................................................................................35 Bipolar NPN Amplifier ..............................................................................................................................................36 Amplifier Frequency Response ..................................................................................................................................39 Coupling .....................................................................................................................................................................40 Small-Signal vs. Large Signal ....................................................................................................................................41 Classes of Amplifiers .................................................................................................................................................42 Field-Effect Transistor Amplifiers .............................................................................................................................42 A N-Channel JFET Amplifier Design ........................................................................................................................43 An NPN MOSFET Amplifier ....................................................................................................................................45 TEAM LRN vii Contents Operational Amplifiers ...............................................................................................................................................47 Conditioning the Output of a Pressure Sensor ...........................................................................................................50 A More Sophisticated Pressure Sensor Amplifier ......................................................................................................51 Current Mirror ............................................................................................................................................................52 Applications of Op Amps ...........................................................................................................................................53 Oscillators ..................................................................................................................................................................53 Power Amplifiers .......................................................................................................................................................54 Class B Audio Power Amplifier .................................................................................................................................56 Special Signals ...........................................................................................................................................................56 RC Time Constants ....................................................................................................................................................58 Frequency Selection ...................................................................................................................................................59 Typical Application of Filters ....................................................................................................................................61 Summary ....................................................................................................................................................................62 Chapter 4 Quiz ...........................................................................................................................................................62 Chapter 5: Analog-to-Digital and Digital-to-Analog Conversions ............................................................66 Introduction ................................................................................................................................................................66 Decimal Equivalent of a Binary Number ...................................................................................................................67 Digital Codes of ADC ................................................................................................................................................67 A Resistor Network DAC ..........................................................................................................................................68 A Simple Resistor-String DAC ..................................................................................................................................71 A Simple Current-Steering DAC ...............................................................................................................................72 Analog-to-Digital Converters (ADC) ........................................................................................................................73 Successive Approximation Register (SAR) ADC ......................................................................................................74 Capacitor Charge-Redistribution ADC ......................................................................................................................75 Highest Speed Conversions ........................................................................................................................................78 Sample and Hold and Filters ......................................................................................................................................78 Summary ....................................................................................................................................................................79 Chapter 5 Quiz ...........................................................................................................................................................80 Chapter 6: Digital System Processing ..................................................................................................82 Introduction ................................................................................................................................................................82 Digital Processor or Digital Computer ......................................................................................................................82 What is a Microprocessor? .........................................................................................................................................86 What is a Microcomputer? .........................................................................................................................................86 System Clarifications .................................................................................................................................................86 Digital Signal Representations ...................................................................................................................................90 Clock, Timing and Control Signals ............................................................................................................................90 Interrupts ....................................................................................................................................................................92 Status Bits ..................................................................................................................................................................92 More About Software .................................................................................................................................................93 Sophisticated Programming Languages .....................................................................................................................95 How Parts of a Processor Perform Their Functions ...................................................................................................95 Memory and Input/Output .........................................................................................................................................97 Addressing Modes .....................................................................................................................................................97 Summary ....................................................................................................................................................................99 Chapter 6 Quiz .........................................................................................................................................................100 Chapter 7: Examples of Assembly-Language Programming ..................................................................103 Introduction ..............................................................................................................................................................103 A Processor for the Examples ..................................................................................................................................103 About the MSP430 Family ......................................................................................................................................103 The CPU ...................................................................................................................................................................104 TEAM LRN viii
Description: