This comprehensive tutorial assumes no prior experience with PICBASIC. It opens with an introduction to such basic concepts as variables, statements, operators, and structures. This is followed by discussion of the two most commonly used PICBASIC compilers. The author then discusses programming the most common version of the PIC microcontroller, the 15F84. The remainder of the book examines several real-world examples of programming PICs with PICBASIC. In keeping with the integrated nature of embedded technology, both hardware and software are discussed in these examples; circuit details are given so that readers may replicate the designs for themselves or use them as the starting points for their development efforts. *Offers a complete introduction to programming the world's most commonly used microcontroller, the Microchip PIC, with the powerful but easy to use PICBASIC language *Gives numerous design examples and projects to illustrate important concepts *Accompanying CD contains the source files and executables discussed in the book as well as an electronic version of the book Cover 1 Title Page 3 Copyright Page 4 Contents 7 Introduction 11 Chapter 1: Getting Familiar with PICs and PicBasic 15 PIC Overview 16 Software for PICs 23 Assembly Language 24 PicBasic Compiler 25 Chapter 2: PicBasic Compiler (PBC) 27 How PBC Works 28 Variables, Memory, and I/O 31 Program Operators 32 PBC Commands 35 Using PBC 61 Chapter 3: The PicBasic Pro Compiler 65 Variables 69 Constants 71 Symbols 72 Numeric and ASCII 72 Strings 73 I/O Access 73 I/O Control 74 Comments 76 Math Operators 76 Arithmetic Operators 77 Binary Functions 79 PBPro Commands 80 Chapter 4: Inside the PIC Microcontroller 131 Fundamentals 131 Program Memory 132 Reset Vector 133 Data Memory 134 STATUS Register 134 I/O Registers 136 A/D Registers 137 Peripheral Interrupt Vector 140 OPTION Register 141 INTCON Register 143 Summary 146 Chapter 5: Simple PIC Projects 147 Project #1—Flashing an LED 147 Project #2—Scrolling LEDs 153 Project #3—Driving a 7-Segment LED Display 160 Chapter 6: Moving On with the 16F876 167 Project #4—Accessing Port A I/O 167 Project #5—Analog-to-Digital Conversion 176 Project #6—Driving a Servomotor 187 Chapter 7: Communication 197 Project #7—Driving an LCD Module 197 Project #8—Serial Communication 209 Project #9—Driving an LCD with a Single Serial Connection 218 Chapter 8: Memory and Sound 235 Project #10—Using External Memory 236 Project #11—Accessing Internal Memory 246 Project #12—Making Music 255 Chapter 9: Robotics 263 Project #13—Robot Base 265 Project #14—Line Tracker 276 Project #15—Obstacle Detection 298 APPENDIX A: PicBasic and Project Resources 319 APPENDIX B: ASCII Table 323 Index 329 This comprehensive tutorial assumes no prior experience with PICBASIC. It opens with an introduction to such basic concepts as variables, statements, operators, and structures. This is followed by discussion of the two most commonly used PICBASIC compilers. The author then discusses programming the most common version of the PIC microcontroller, the 15F84. The remainder of the book examines several real-world examples of programming PICs with PICBASIC. In keeping with the integrated nature of embedded technology, both hardware and software are discussed in these examples; circuit details are given so that readers may replicate the designs for themselves or use them as the starting points for their development efforts.
*Offers a complete introduction to programming the world's most commonly used microcontroller, the Microchip PIC, with the powerful but easy to use PICBASIC language
*Gives numerous design examples and projects to illustrate important concepts
*Accompanying CD contains the source files and executables discussed in the book as well as an electronic version of the book The PIC (Programmable Interface Controller) line of microcontrollers was originally developed by the semiconductor division of General Instruments Inc.