PICMICRO MICROCONTROLLER POCKET REFERENCE
CHAPTER 1: What is a PIC®? 1 PICS "101" How Do I Tell Them Apart? 2 Which One Should I Use? How Do I Pick One? 7 So, Which One Do I Really Want to Use? 8 Basic Micro's MBasic876 Compiler 8 References 9 CHAPTER 2: MBasic Compiler and Development Boards 10 The Complier Package 10 BASIC and its Essentials 11 13 Development Boards 15 Programming Style 16 Buliding the Circuits and Standard Assumptions 17 Pins, Ports and Input/Output 23 Pseudo-Code and Planning the Program 25 Inside the Complier 27 References 28 CHAPTER 3: The Basics - Output 28 Pin Architectures 31 LED Indicators 34 Switching Inductive Loads 36 Low Side Switching 45 Isolated Switching 50 Special Purpose Switching 50 Fast Switching-Sound from a PIC 51 References 53 CHAPTER 4: The Basics - Digital Input 53 Introduction Switch Bounce and Sealing Current 58 62 Isolated Switching Reading a Keypad 63 References 66 CHAPTER 5: LCD Modules 67 Selecting a Display 67 VFD Displays 69 Connection to PIC 69 Hello World 72 LCD Module Memory, Shifts and Lines 74 Font Selection 79 Custom Characters 80 References 85 CHAPTER 6: Reading Complex Input Switches 86 86 Pin Saving Techniques 91 Rotary Encoders 95 Reading a Relative Encoder 100 Dual Encoders and LCD 106 References CHAPTER 7: Seven-Segment LED Displays 107 LED Display Selection 107 Circult Design 108 References 119 CHAPTER 8: Introductory Stepper Motors 120 Stepper Motor Basics 120 Programs 133 References 150 CHAPTER 9: RS-232 Serial Interface 151 How to Connect to Your PC 151 Voltage Levels In RS-232 and Level Conversion 152 Standard Pin Connections 154 Asynchronous Transmission, Start Bits, Stop Bits and Bit Order 154 MBasic's Procedures for Serial Communications 156 Programs 159 186 References 187 CHAPTER 10: Interrupts and Timers in MBasic 187 Interrupts and Timers-Overview 188 Interrupts 194 Timers 203 Capture and Compare 210 References 211 CHAPTER 11: Analog-to-Digital Conversion 211 Introduction to Analog-to-Digital Conversion 212 Self -Contained DVM Resolution and Accuracy 218 References 230 CHAPTER 12: Digital Temperature Sensors and Real-Time Clocks 231 DS18820 Temperature Sensor 231 DS1302 Real-Time Clock 243 Combination Date, Time and Temperature 252 References 259 CHAPTER 13: Assembler 101 260 The Basics 260 OpCodes 267 References 280 CHAPTER 14: In-Line Assembler 281 281 Adding Assembler to MBasic Programs 295 Bolt-In Assembler Functions 316 References 317 CHAPTER 15: Interrupt Handlers and Timers in Assembler 317 323 ISRASM-MBasic's Gateway to Assembler Interrupt Service Routines 334 CHAPTER 16: Digital-to-Analog Conversion Program Examples 335 References Introduction to Digital-to-Analog Conversion 335 Resolution - Accuracy and Signal-to-Noise Ratio 336 Henry Nyquist and his Sampling Theorem 337 DAC Circuit Design 339 Alternative Analog Output Solutions 352 References 358 CHAPTER 17: DTMF Tone Decoding and Telephone Interface 360 What Is Touch-Tone Signaling? 360 Generating Touch-Tone Signals 361 361 Decoding a Touch-Tone Signal 388 References 389 CHAPTER 18: External Memory 389 PC-Bus Devices 403 Practical Use of External EEPROM 408 Parallel Access Memory 416 References 418 418 Programs CHAPTER 19: Advanced Stepper Motors 420 Microstepping 452 References 453 CHAPTER 20: X-10 Home Automation 453 How X-10 Works Programs 459 References 486 CHAPTER 21: Digital Potentiometers and Controllable Filter 487 Getting Started with an MCP41010 489 RS-232 Control of an MCP41010 493 498 Daisy Chaining Multiple MCP42010 Devices RS-232 Command of Multiple Daisy Chained MCP42010 Devices 505 Electronically Tunable Low-Pass Filter Using MCP42010 Logarithmic Response for Audio Volume Control 501 511 References 515 CHAPTER 22: Infrared Remote Controls 517 Common Encoding Standards 518 IR Receiver 520 Characterizing Wide/Narrow Pulse intervals 522 Decoding a REC-80 Controller 532 References 541 CHAPTER 23: AC Power Control 542 Introduction to Triacs 543 545 Snubberless versus Standard: dv/dt and divat Issues 548 Triggering a Triac 549 Phase and Cycle Control 551 Power Control Board 555 Programs 565 References CHAPTER 24: DC Motor Control 567 Introduction to Control Theory 567 Measure Motor Speed (Tachometer Output Pulse Width) 568 572 Error - Target Width-Measured Width 572 The Control Algorithm 573 Motor Control Programs 594 References 595 CHAPTER 25: Bar Code Reader 595 Bar Codes "101" Bar Code Wand 602 631 CHAPTER 26: Sending Morse Code Programs 633 References 599 633 Morse Code 101 635 Programs 660 References 661 CHAPTER 27: Morse Code Reader 661 Sending and Receiving Morse 663 Tone Detector Circuit 668 Programs References 689 CHAPTER 28: Weather Station and Data Logger 691 Sensor Selection 691 Connecting the Sensors and Memory 696 Initial Tests 700 References 728 CHAPTER 29: Migrating from v521x to 5300 and the Undocumented MBasic 729 Migrating from v521x to 5300 729 Undocumented MBasic 733