Docsity

SD Card Projects Using The PIC Microcontroller, Notas de estudo de Eletrônica

Pré-visualização parcial do texto

Baixe SD Card Projects Using The PIC Microcontroller e outras Notas de estudo em PDF para Eletrônica, somente na Docsity!

Sd Card Projects Using the

PiC Microcontroller

Sd Card Projects Using the

PiC Microcontroller

dogan ibrahim

AMSTERDAM • BOSTON • HEIDELBERG • LONDON NEW YORK • OXFORD • PARIS • SAN DIEGO SAN FRANCISCO • SINGAPORE • SYDNEY • TOKYO Newnes is an imprint of Elsevier

Newnes is an imprint of Elsevier 30 Corporate Drive, Suite 400, Burlington, MA 01803, USA The Boulevard, Langford Lane, Kidlington, Oxford, OX5 1GB, UK

© 2010 Elsevier Ltd. All rights reserved.

No part of this publication may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or any information storage and retrieval system, without permission in writing from the Publisher. Details on how to seek permission, further information about the Publisher’s permissions policies and our arrangements with organizations such as the Copyright Clearance Center and the Copyright Licensing Agency, can be found at our Web site, www.elsevier.com/permissions.

This book and the individual contributions contained in it are protected under copyright by the Publisher (other than as may be noted herein).

Notices Knowledge and best practice in this field are constantly changing. As new research and experience broaden our understanding, changes in research methods, professional practices, or medical treatment may become necessary.

Practitioners and researchers must always rely on their own experience and knowledge in evaluating and using any information, methods, compounds, or experiments described herein. In using such information or methods they should be mindful of their own safety and the safety of others, including parties for whom they have a professional responsibility.

To the fullest extent of the law, neither the Publisher nor the authors, contributors, or editors assume any liability for any injury and/or damage to persons or property as a matter of products liability, negligence or otherwise, or from any use or operation of any methods, products, instructions, or ideas contained in the material herein.

Library of Congress Cataloging-in-Publication Data Ibrahim, Dogan. SD card projects using the PIC microcontroller / Dogan Ibrahim. p. cm. Includes bibliographical references and index. ISBN 978-1-85617-719-1 (alk. paper)

  1. Microcontrollers—Programming. 2. Programmable controllers. 3. Computer storage devices. I. Title. TJ223.P76.I275 2010 004.16—dc 2009041498

British Library Cataloguing-in-Publication Data A catalogue record for this book is available from the British Library.

Printed in the United States of America

10 11 12 9 8 7 6 5 4 3 2 1

Typeset by : diacriTech, Chennai, India

For information on all Newnes publications, visit our Web site, www.elsevierdirect.com

SD card register definitions in Chapter 3 are taken from Sandisk Corporation “SD Card

Product Manual, Rev. 1.9,” Document no: 80-13-00169, 2003.

Appendixes A and D are taken from the Web site of Motorola Semiconductors Inc.

Appendix B is taken from the Web site of Texas Instruments Inc.

Appendix C is taken from the Web site of National Semiconductor Corporation.

Thanks is due to Microchip Ltd for their technical support and permission to include MPLAB

IDE, MDD library, and Student Version of the MPLAB C18 compiler on the Web site that

accompanies this book.

PIC®, PICSTART®, and MPLAB®^ are all registered trademarks of Microchip Technology Inc.

vi Copyright Exceptions

Contents

Preface �������������������������������������������������������������������������������������������������������������xix

  • Chapter 1: Microcontroller systems ����������������������������������������������������������������������� About the Web site������������������������������������������������������������������������������������������ xxiii
    • 1.1 Introduction
    • 1.2 Microcontroller Systems
      • 1.2.1 Random Access Memory
      • 1.2.2 Read Only Memory
      • 1.2.3 Programmable Read Only Memory
      • 1.2.4 Erasable Programmable Read Only Memory...................................................
      • 1.2.5 Electrically Erasable Programmable Read Only Memory
      • 1.2.6 Flash EEPROM
    • 1.3 Microcontroller Features
      • 1.3.1 Buses
      • 1.3.2 Supply Voltage
      • 1.3.3 The Clock
      • 1.3.4 Timers
      • 1.3.5 Watchdog
      • 1.3.6 Reset Input........................................................................................................
      • 1.3.7 Interrupts
      • 1.3.8 Brown-Out Detector
      • 1.3.9 A/D Converter
      • 1.3.10 Serial I/O
      • 1.3.11 EEPROM Data Memory.................................................................................
      • 1.3.12 LCD Drivers
      • 1.3.13 Analog Comparator
      • 1.3.14 Real-Time Clock
      • 1.3.15 Sleep Mode
      • 1.3.16 Power-on Reset.............................................................................................
      • 1.3.17 Low-Power Operation
      • 1.3.18 Current Sink/Source Capability
      • 1.3.19 USB Interface
      • 1.3.20 Motor Control Interface................................................................................
      • 1.3.21 Controller Area Network Interface...............................................................
      • 1.3.22 Ethernet Interface
      • 1.3.23 ZigBee Interface
    • 1.4 Microcontroller Architectures - Set Computer 1.4.1 Reduced Instruction Set Computer and Complex Instruction
    • 1.5 Choosing a PIC Microcontroller
    • 1.6 Number Systems.........................................................................................................
      • 1.6.1 Decimal Number System
      • 1.6.2 Binary Number System
      • 1.6.3 Octal Number System
      • 1.6.4 Hexadecimal Number System
    • 1.7 Converting Binary Numbers into Decimal
    • 1.8 Converting Decimal Numbers into Binary
    • 1.9 Converting Binary Numbers into Hexadecimal
    • 1.10 Converting Hexadecimal Numbers into Binary
    • 1.11 Converting Hexadecimal Numbers into Decimal
    • 1.12 Converting Decimal Numbers into Hexadecimal
    • 1.13 Converting Octal Numbers into Decimal
    • 1.14 Converting Decimal Numbers into Octal
    • 1.15 Converting Octal Numbers into Binary
    • 1.16 Converting Binary Numbers into Octal
    • 1.17 Negative Numbers
    • 1.18 Adding Binary Numbers
    • 1.19 Subtracting Binary Numbers
    • 1.20 Multiplication of Binary Numbers
    • 1.21 Division of Binary Numbers
    • 1.22 Floating Point Numbers............................................................................................
    • 1.23 Converting a Floating Point Number into Decimal
      • 1.23.1 Normalizing the Floating Point Numbers
      • 1.23.2 Converting a Decimal Number into Floating Point - Point Numbers 1.23.3 Multiplication and Division of Floating
      • 1.23.4 Addition and Subtraction of Floating Point Numbers
    • 1.24 Binary-Coded Decimal Numbers
    • 1.25 Summary
    • 1.26 Exercises
  • Chapter 2: PIC18F Microcontroller series ������������������������������������������������������������
    • 2.1 PIC18FXX2 Architecture
      • 2.1.1 Program Memory Organization......................................................................
      • 2.1.2 Data Memory Organization
      • 2.1.3 The Configuration Registers...........................................................................
      • 2.1.4 The Power Supply
      • 2.1.5 The Reset
      • 2.1.6 The Clock Sources
      • 2.1.7 Watchdog Timer
      • 2.1.8 Parallel I/O Ports
      • 2.1.9 Timers
      • 2.1.10 Capture/Compare/PWM Modules
      • 2.1.11 Pulse Width Modulation Module
      • 2.1.12 Analog-to-Digital Converter Module
      • 2.1.13 Interrupts
    • 2.2 Summary
    • 2.3 Exercises
  • Chapter 3: Memory Cards ��������������������������������������������������������������������������������
    • 3.1 Memory Card Types
    • 3.2 Smart Media Card
    • 3.3 Multimedia Card.......................................................................................................
    • 3.4 Compact Flash Card
    • 3.5 Memory Stick Card
    • 3.6 Microdrive
    • 3.7 xD Card
    • 3.8 Secure Digital Card
      • 3.8.1 Standard SD Cards
      • 3.8.2 High-Capacity SD Cards
    • 3.9 Memory Card Readers..............................................................................................
    • 3.10 Memory Card Physical Properties
    • 3.11 Memory Card Technical Properties
    • 3.12 Detailed SD Card Structure
      • 3.12.1 SD Card Pin Configuration
      • 3.12.2 SD Card Interface
    • 3.13 SD Card Internal Registers
      • 3.13.1 OCR Register
      • 3.13.2 CID Register
      • 3.13.3 CSD Register
      • 3.13.4 RCA Register
      • 3.13.5 DSR Register
      • 3.13.6 SCR Register
      • 3.13.7 SD Status Register
    • 3.14 Calculating the SD Card Capacity..........................................................................
    • 3.15 SD Card SPI Bus Protocol......................................................................................
      • 3.15.1 Data Read
      • 3.15.2 Data Write
      • 3.15.3 Response Tokens
    • 3.16 Data Tokens
    • 3.17 Card Reset State
    • 3.18 Summary
    • 3.19 Exercises
  • Chapter 4: Programming with the MPLAB C18 Compiler ������������������������������������
    • 4.1 C Programming Languages for PIC18 Microcontrollers
    • 4.2 MPLAB C18 Compiler
      • 4.2.1 Installing the MPLAB C18 Compiler
    • 4.3 An Example Program
      • 4.3.1 Building the Project
      • 4.3.2 Simulating the Project
    • 4.4 Flashing Led Example
      • 4.4.1 Building and Simulating the Project
    • 4.5 Structure of the MPLAB C18 Compiler...................................................................
      • 4.5.1 Comments.....................................................................................................
      • 4.5.2 Terminating Program Statements
      • 4.5.3 White Spaces
      • 4.5.4 Case Sensitivity
      • 4.5.5 Variable Names
      • 4.5.6 Variable Types
      • 4.5.7 Constants
      • 4.5.8 Escape Sequences
      • 4.5.9 Static Variables
      • 4.5.10 External Variables
      • 4.5.11 Volatile Variables........................................................................................
      • 4.5.12 Enumerated Variables
      • 4.5.13 Arrays
      • 4.5.14 Pointers
      • 4.5.15 Structures
      • 4.5.16 Unions
      • 4.5.17 Operators in C
      • 4.5.18 Modifying the Flow of Control
      • 4.5.19 Iteration Statements
      • 4.5.20 Mixing C18 with Assembly Language Statements
    • 4.6 PIC Microcontroller I/O Port Programming
    • 4.7 Programming Examples
    • 4.8 Functions
      • 4.8.1 Function Prototypes......................................................................................
      • 4.8.2 Passing Arrays to Functions
      • 4.8.3 Passing Variables by Reference to Functions
      • 4.8.4 Static Function Variables
    • 4.9 MPLAB C18 Library Functions
      • 4.9.1 Delay Functions............................................................................................
      • 4.9.2 Character Classification Functions
      • 4.9.3 Data Conversion Functions
      • 4.9.4 Memory and String Manipulation Functions
      • 4.9.5 Reset Functions
      • 4.9.6 Character Output Functions
      • 4.9.7 Math Library Functions
      • 4.9.8 LCD Functions
      • 4.9.9 Software CAN2510 Functions
      • 4.9.10 Software I 2 C Bus Functions
      • 4.9.11 Software SPI Bus Functions
      • 4.9.12 Software UART Functions
      • 4.9.13 Hardware Analog-to-Digital (A/D) Converter Functions
      • 4.9.14 Hardware Input Capture Functions
      • 4.9.15 Hardware I^2 C Functions
      • 4.9.16 Hardware I/O Port Functions
      • 4.9.17 Hardware Microwire Functions..................................................................
      • 4.9.18 Hardware Pulse Width Modulation Functions
      • 4.9.19 Hardware SPI Functions.............................................................................
      • 4.9.20 Hardware Timer Functions
      • 4.9.21 Hardware USART Functions......................................................................
    • 4.10 Summary
    • 4.11 Exercises
  • Chapter 5: PIC18 Microcontroller Development Tools �����������������������������������������
    • 5.1 Software Development Tools
      • 5.1.1 Text Editors
      • 5.1.2 Assemblers and Compilers
      • 5.1.3 Simulators.....................................................................................................
      • 5.1.4 High-Level Language Simulators.................................................................
      • 5.1.5 Integrated Development Environments
    • 5.2 Hardware Development Tools
      • 5.2.1 Development Boards
      • 5.2.2 Device Programmers
      • 5.2.3 In-Circuit Debuggers
      • 5.2.4 In-Circuit Emulators
      • 5.2.5 Breadboards
    • 5.3 Using the MPLAB ICD 3 In-Circuit Debugger
      • 5.3.1 The Debugging Process
      • 5.3.2 The MPLAB ICD 3 Test Interface Board
      • 5.3.3 Programming with the MPLAB ICD 3 Debugger........................................
      • 5.3.4 MPLAB ICD 3 Debugging Example I
      • 5.3.5 MPLAB ICD 3 Debugging Example II........................................................
      • 5.3.6 MPLAB ICD 3 Debugging Example III
    • 5.4 Summary
    • 5.5 Exercises
  • Chapter 6: PIC18 Microcontroller MPLAB C18-Based simple Projects �����������������
    • 6.1 Program Description Language
      • 6.1.1 START-END
      • 6.1.2 Sequencing
      • 6.1.3 IF-THEN-ELSE-ENDIF
      • 6.1.4 DO-ENDDO
      • 6.1.5 REPEAT-UNTIL
  • 6.2 Project 1 – Chasing LEDs - 6.2.1 Project Description - 6.2.2 Project Hardware - 6.2.3 Project PDL - 6.2.4 Project Program - 6.2.5 Further Development
  • 6.3 Project 2 – LED Dice - 6.3.1 Project Description - 6.3.2 Project Hardware - 6.3.3 Project PDL - 6.3.4 Project Program - 6.3.5 Using a Pseudorandom Number Generator
  • 6.4 Project 3 – Two-Dice Project - 6.4.1 Project Description - 6.4.2 Project Hardware - 6.4.3 Project PDL - 6.4.4 Project Program
  • 6.5 Project 4 – Two Dice Project – Fewer I/O Pins - 6.5.1 Project Description - 6.5.2 Project Hardware - 6.5.3 Project PDL - 6.5.4 Project Program - 6.5.5 Modifying the Program
  • 6.6 Project 5 – Seven-Segment LED Counter - 6.6.1 Project Description - 6.6.2 Project Hardware - 6.6.3 Project PDL - 6.6.4 Project Program - 6.6.5 Modified Program
  • 6.7 Project 6 – Two-Digit Multiplexed Seven-Segment LED - 6.7.1 Project Description - 6.7.2 Project Hardware - 6.7.3 Project PDL - 6.7.4 Project Program
    • Timer Interrupt 6.8 Project 7 – Two-Digit Multiplexed Seven-Segment LED Counter With
      • 6.8.1 Project Description
      • 6.8.2 Project Hardware
      • 6.8.3 Project PDL
      • 6.8.4 Project Program
      • 6.8.5 Modifying the Program
      • Timer Interrupt 6.9 Project 8 – Four-Digit Multiplexed Seven-Segment LED Counter With
        • 6.9.1 Project Description
        • 6.9.2 Project Hardware
        • 6.9.3 Project PDL
        • 6.9.4 Project Program
        • 6.9.5 Modifying the Program
        • 6.9.6 Using MPLAB C18 Compiler Timer Library Routines
    • 6.10 Summary
    • 6.11 Exercises
  • Chapter 7: serial Peripheral Interface Bus Operation ������������������������������������������
    • 7.1 The Master Synchronous Serial Port Module
    • 7.2 MSSP in SPI Mode...................................................................................................
    • 7.3 SPI Mode Registers - 7.3.1 SSPSTAT - 7.3.2 SSPCON1
    • 7.4 Operation in SPI Mode - 7.4.1 Configuration of MSSP for SPI Master Mode
    • 7.5 SPI Bus MPLAB C18 Library Functions - 7.5.1 CloseSPI - 7.5.2 DataRdySPI - 7.5.3 getcSPI - 7.5.4 getsSPI - 7.5.5 OpenSPI - 7.5.6 putcSPI - 7.5.7 putsSPI - 7.5.8 ReadSPI - 7.5.9 WriteSPI
    • 7.6 Example of an SPI Bus Project - 7.6.1 TC72 Temperature Sensor - 7.6.2 The Circuit Diagram..................................................................................... - 7.6.3 The Program - 7.6.4 Displaying Negative Temperatures - 7.6.5 Displaying the Fractional Part
    • 7.7 Summary
    • 7.8 Exercises
  • Chapter 8: MPLAB C18 sD Card Functions and Procedures ��������������������������������
    • 8.1 Installation of the MDD Library
    • 8.2 MDD Library Functions - 8.2.1 File and Disk Manipulation Functions - 8.2.2 Library Options - 8.2.3 Memory Usage - 8.2.4 Library Setup
    • 8.3 Sequence of Function Calls
      • 8.3.1 Reading from an Existing File
      • 8.3.2 Writing Onto an Existing File
      • 8.3.3 Deleting an Existing File
    • 8.4 Detailed Function Calls
      • 8.4.1 FSInit
      • 8.4.2 FSfopen
      • 8.4.3 FSfopenpgm
      • 8.4.4 FSfclose
      • 8.4.5 FSfeof
      • 8.4.6 FSfread
      • 8.4.7 FSfwrite
      • 8.4.8 FSremove......................................................................................................
      • 8.4.9 FSremovepgm
      • 8.4.10 FSrewind
      • 8.4.11 FSmkdir
      • 8.4.12 FSrmdir.......................................................................................................
      • 8.4.13 FSchdir
      • 8.4.14 FSformat
      • 8.4.15 FSrename
      • 8.4.16 FindFirst
      • 8.4.17 FindFirstpgm
      • 8.4.18 FindNext
      • 8.4.19 SetClockVars
      • 8.4.20 FSfprintf
    • 8.5 Summary
    • 8.6 Exercises
  • Chapter 9: secure Digital Card Projects �������������������������������������������������������������
    • 9.1 Creating an MPLAB C18 Template
      • 9.1.1 Setting the Configuration Files
      • 9.1.2 The Memory Model
    • 9.2 PROJECT 1 – Writing a Short Text Message to an SD Card...................................
      • 9.2.1 Description
      • 9.2.2 Aim
      • 9.2.3 Block Diagram
      • 9.2.4 Circuit Diagram
      • 9.2.5 Operation of the Project
      • 9.2.6 Program Code
      • 9.2.7 Description of the Program Code
      • 9.2.8 Suggestions for Future Work
    • 9.3 PROJECT 2 – Time Stamping a File........................................................................
      • 9.3.1 Description
      • 9.3.2 Aim
      • 9.3.3 Block Diagram
    • 9.3.4 Circuit Diagram
    • 9.3.5 Operation of the Project
    • 9.3.6 Program Code
    • 9.3.7 Description of the Program Code
    • 9.3.8 Suggestions for Future Work
  • 9.4 PROJECT 3 – Formatting a Card
    • 9.4.1 Description
    • 9.4.2 Aim
    • 9.4.3 Block Diagram
    • 9.4.4 Circuit Diagram
    • 9.4.5 Operation of the Project
    • 9.4.6 Program Code
    • 9.4.7 Description of the Program Code
    • 9.4.8 Suggestions for Future Work
  • 9.5 PROJECT 4 – Deleting a File
    • 9.5.1 Description
    • 9.5.2 Aim
    • 9.5.3 Block Diagram
    • 9.5.4 Circuit Diagram
    • 9.5.5 Operation of the Project
    • 9.5.6 Program Code
    • 9.5.7 Description of the Program Code
    • 9.5.8 Suggestions for Future Work
  • 9.6 PROJECT 5 – Renaming a File
    • 9.6.1 Description
    • 9.6.2 Aim
    • 9.6.3 Block Diagram
    • 9.6.4 Circuit Diagram
    • 9.6.5 Operation of the Project
    • 9.6.6 Program Code
    • 9.6.7 Description of the Program Code
    • 9.6.8 Suggestions for Future Work
  • 9.7 PROJECT 6 – Creating a Directory
    • 9.7.1 Description
    • 9.7.2 Aim
    • 9.7.3 Block Diagram
    • 9.7.4 Circuit Diagram
    • 9.7.5 Operation of the Project
    • 9.7.6 Program Code
    • 9.7.7 Description of the Program Code
    • 9.7.8 Suggestions for Future Work
  • 9.8 PROJECT 7 – Create a Directory and a File
    • 9.8.1 Description
    • 9.8.2 Aim
    • 9.8.3 Block Diagram
    • 9.8.4 Circuit Diagram
    • 9.8.5 Operation of the Project
    • 9.8.6 Program Code
    • 9.8.7 Description of the Program Code
    • 9.8.8 Suggestions for Future Work
  • 9.9 PROJECT 8 – File Copying
    • 9.9.1 Description
    • 9.9.2 Aim
    • 9.9.3 Block Diagram
    • 9.9.4 Circuit Diagram
    • 9.9.5 Operation of the Project
    • 9.9.6 Program Code
    • 9.9.7 Description of the Program Code
    • 9.9.8 Suggestions for Future Work
  • 9.10 PROJECT 9 – Displaying File on a PC
    • 9.10.1 Description
    • 9.10.2 Aim
    • 9.10.3 Block Diagram
    • 9.10.4 Circuit Diagram
    • 9.10.5 Operation of the Project
    • 9.10.6 The Program Code
    • 9.10.7 Description of the Program Code
    • 9.10.8 Suggestions for Future Work
  • 9.11 PROJECT 10 – Reading a Filename from the PC and Displaying the File
    • 9.11.1 Description
    • 9.11.2 Aim
    • 9.11.3 Block Diagram
    • 9.11.4 Circuit Diagram
    • 9.11.5 Operation of the Project
    • 9.11.6 Program Code
    • 9.11.7 Description of the Program Code
    • 9.11.8 Suggestions for Future Work
  • 9.12 PROJECT 11 – Looking for a File
    • 9.12.1 Description
    • 9.12.2 Aim
    • 9.12.3 Block Diagram
    • 9.12.4 Circuit Diagram
    • 9.12.5 Operation of the Project
    • 9.12.6 Program Code
    • 9.12.7 Description of the Program Code
    • 9.12.8 Suggestions for Future Work
  • 9.13 PROJECT 12 – Looking for a Number of Files with a Given File Extension
    • 9.13.1 Description
    • 9.13.2 Aim
    • 9.13.3 Block Diagram
    • 9.13.4 Circuit Diagram
    • 9.13.5 Operation of the Project
    • 9.13.6 Program Code
    • 9.13.7 Description of the Program Code
    • 9.13.8 Suggestions for Future Work
  • 9.14 PROJECT 13 – Displaying the Attributes of a File................................................
    • 9.14.1 Description
    • 9.14.2 Aim
    • 9.14.3 Block Diagram
    • 9.14.4 Circuit Diagram
    • 9.14.5 Operation of the Project
    • 9.14.6 Program Code
    • 9.14.7 Description of the Program Code
    • 9.14.8 Suggestions for Future Work
  • 9.15 PROJECT 14 – SD Card File Handling
    • 9.15.1 Description
    • 9.15.2 Aim
    • 9.15.3 Block Diagram
    • 9.15.4 Circuit Diagram
    • 9.15.5 Operation of the Project
    • 9.15.6 Program Code
    • 9.15.7 Description of the Program Code
    • 9.15.8 Suggestions for Future Work
  • 9.16 PROJECT 15 – MENU-Based SD Card File Handling
    • 9.16.1 Description
    • 9.16.2 Aim
    • 9.16.3 Block Diagram
    • 9.16.4 Circuit Diagram
    • 9.16.5 Operation of the Project
    • 9.16.6 Program Code
    • 9.16.7 Description of the Program Code
    • 9.16.8 Suggestions for Future Work
  • 9.17 PROJECT 16 – Digital Data Logging to SD card
    • 9.17.1 Description
    • 9.17.2 Aim
    • 9.17.3 Block Diagram
    • 9.17.4 Circuit Diagram
    • 9.17.5 Operation of the Project
    • 9.17.6 Program Code
    • 9.17.7 Description of the Program Code
    • 9.17.8 Suggestions for Future Work
  • 9.18 PROJECT 17 – Temperature Data Logging
    • 9.18.1 Description
    • 9.18.2 Aim
    • 9.18.3 Block Diagram
    • 9.18.4 Circuit Diagram
    • 9.18.5 Operation of the Project
    • 9.18.6 Program Code
    • 9.18.7 Description of the Program Code
    • 9.18.8 Suggestions for Future Work
    • Real-Time Clock 9.19 PROJECT 18 – Temperature and Pressure Data Logging with
    • 9.19.1 Description
    • 9.19.2 Aim
    • 9.19.3 Block Diagram
    • 9.19.4 Circuit Diagram
    • 9.19.5 Operation of the Project
    • 9.19.6 Program Code
    • 9.19.7 Description of the Program Code
    • 9.19.8 Suggestions for Future Work
  • Appendix A–MC33269 Data sheet ������������������������������������������������������������������
  • Appendix B–MAX232 Data sheet ��������������������������������������������������������������������
  • Appendix C–LM35 Data sheet �������������������������������������������������������������������������
  • Appendix D–MPX4115A Data sheet ����������������������������������������������������������������
  • Index ��������������������������������������������������������������������������������������������������������������

Preface

A microcontroller is a single-chip microprocessor system that contains data and program

memory, serial and parallel input–output, timers, and external and internal interrupts, all

integrated into a single chip that can be purchased for as little as $2.00. Approximately 40%

of microcontroller applications are in office automation, such as PCs, laser printers, fax

machines, intelligent telephones, and so forth. Approximately one-third of microcontrollers

are found in consumer electronic goods. Products like CD players, hi-fi equipment, video

games, washing machines, cookers, etc., fall into this category. The communications market,

automotive market, and military share the rest of the application areas.

Flash memory cards are high-capacity nonvolatile read-write type semiconductor memo-

ries used in many domestic, commercial, and industrial applications. For example, portable

electronic devices like digital cameras, video recorders, MP3 players, GPS receivers, laptop

computers, and many more domestic and office products use some form of flash memory

cards. Currently, there are many types of flash memory cards. Some of the popular cards are

secure digital (SD) card, compact flash card, memory stick card, smart media card, and so on.

This book is about SD memory cards; it gives the basic working theory of the cards and

describes how they can be used in PIC microcontroller-based electronic projects. Eighteen

fully tested and working projects are given in the book to show how SD cards can be used for

storing large amounts of data.

This book has been written with the assumption that the reader has taken a course on digital

logic design and has been exposed to writing programs using at least one high-level pro-

gramming language. Knowledge of the C programming language will be useful. In addition,

familiarity with at least one member of the PIC16F series of microcontrollers will be an

advantage. Knowledge of assembly language programming is not required because all the

projects in the book are based on C language.

Chapter 1 presents the basic features of microcontroller systems. It also introduces the impor-

tant topic of number systems and describes how to convert a given number from one base into

another base.

xix