Updated: 02.06.21

Main -> Books -> Technical Books -> My Books -> Programming and Customizing PICmicro® Microcontrollers

Cover of Programming and Customizing PICmicro® Microcontrollers

Programming and Customizing PICmicro® Microcontrollers

The original intention for this book was to become a second version of Programming and Customizing the PIC Microcontroller. Somehow, as I started blocking out its table of contents it became a completely new book, borrowing on the best parts (and applications) of the original book along with integrating the comments I have received over the past three years. The end result is what I consider to be a complete Microchip PICmicro® microcontroller reference that can be used by both experienced developers and people just getting started in electronics.

In this book, there is reference information and projects for all four of the PICmicro MCU families, the low-end (PIC12C50X, PIC16C505 and PIC16C5X), the mid-range(PIC16CXXX and PIC16F8XX), PIC17CXX and PIC18CXX2. Along with the processor designs and how they are programmed, I have also included the different I/O features built into different PICmicros, how they are used and how they are accessed in software. I have tried to explain what are the features of the different families and what type of applications they are best suited for.

Included in the book is a CD-ROM with all the software needed by the reader to work through the experiments and projects in the book along with the development tools and reference information needed to develop new applications. Along with the CD-ROM is a PCB for my "El Cheapo" PICmicro programmer that you can build for yourself. This programmer can be used to program the low-end 8 and 14 pin PICmicro devices as well as virtually all the mid-range PICmicro MCU part numbers. The complete book, CD-ROM and PCB package is intended to be the only reference that you will need to learn about and work with the PICmicro MCU.

The "Experiments" chapter from the first edition has been retained, but with each application modified so that the code can be simulated with Microchip's MPLAB Integrated Development Environment as well as not being restricted to the PIC16F84. The experiments can be used with the PIC16F87X and can be run in either the MPLAB ICD or EMU-II emulators. I have eliminated the confusing "Prog#" convention for the experiments (and projects) and have changed all the experiments and their source directories to simple MS-DOS compatible names.

This is a huge book - tipping the scales at almost 1,200 pages. Along with describing the various PICmicro MCU features, the book also includes:

The CD-ROM that comes with this book is designed to be an integral part of the book. In the introduction I suggest that the reader load the CD-ROM into their computer before starting to read through the text as there is some unique information as well as code that is not present in the book due to space concerns. Along with the source (and executable) code for all the applications presented in the book, the CD-ROM also contains:

The two pdf appendices, "Introduction to Electronics" and "Introduction to Programming" were written to help someone new to microcontrollers gain the background necessary to understand the concepts presented in the book. These appendices (which total over 250 pages) are virtually a stand-alone book on their own and provide reference information that experienced developers will probably find useful. "Introduction to Electronics" starts with basic electrical theory and explain the concepts behind digital logic, Analog to Digital Conversion, low-current power supplies, prototyping and basic test equipment. "Introduction to Programming" explains basic programming concepts and goes on to discuss structured programming and provides references to the "BASIC" (including PICmicro MCU varients) and "C" languages.

This book is complemented by PICmicro® Microcontroller Pocket Reference which contains summarized information about the different PICmicro MCUs along with programming information as well as a wealth of interfacing information and code.

The book also includes a PCB version of my "El Cheapo" programmer along with Microsoft "Windows" interface software. This programmer (which is shown in assembled form in the diagram to the right) will program the following PICmicros:

To make the applications as user-friendly as possible, I have created a Microsoft "Window" GUI interface for the El Cheapo and YAP-II programmers. This complements the Windows GUI Interface of the Microchip MPLAB and UMPS Integrated Development Environments along with the html interface that you can access from your web browser.


Errata and Updates:

I am happy to be able to provide you with a sample of the book on PDF. Click here to download chapter 6 ("PICmicro® Application Design and Hardware Interfacing"). It will be a reasonably long download as it is 672K.

In the initial printings of the book, the following two files were missed on the CD-ROM:

  1. clock.asm - The source code to the "analog clock" application
  2. structre.inc - The source code to the assembly language programming macros

I am aware of a problem with a number of books that were bound without the PCB. McGraw-Hill has set up a Customer Service process to send PCBs out to customers that are missing them.

If you have a book that does not have a PCB in it, could you please send an email to customer.service@mcgraw-hiil.com with the following information:

  1. The book's ISBN Number.
  2. Your mailing address that I can pass along to McGraw-Hill to get a PCB to you ASAP.
  3. The retailer you received the book from. This is necessary to get the problem books purged and PCBs put in them.

If you are in North America, you can contact McGraw-Hill's customer service by phone at 1(800)722-4726. Make sure that you have the ISBN number of the book handy so they can find it on their computers.

I apologize for this problem.

myke


The El Cheapo Programmer

The El Cheapo PCB that comes with the book has reference designators that do not match the reference designators that were originally specified. To help you through the transition, I have updated the El Cheapo Windows Interface and have provided a new Bill of Material.

To look at the updated El Cheapo software, click here to jump to the El Cheapo's information page.


Table of Contents:

Acknowledgments

Foreword
  - Steve Sanghi, CEO and President of Microchip Techology, Inc.

Introduction

Chapter 1 Microcontrollers
  - Microcontroller Chips
  - Programmable Logic Devices
  - Deciding Which Device to Use in Your Application

Chapter 2 The Microchip PICmicro® MCU
  - Device and Feature Summary
  - MPLAB
  - FUZZYtech
  - KEELOQ
  - The Parallax Basic Stamp
  - PICmicro® MCU-Compatible Devices

Chapter 3 The PICmicro® MCU Processor Architecture
  - The CPU
  - The PICmicro® MCU’s ALU
  - Data Movement
  - The Program Counter and Stack
  - Reset
  - Interrupts
  - Architecture Differences

Chapter 4 The PICmicro® MCU Instruction Set
  - The Mid-Range Instruction Set
  - Other PICmicro® MCU Instruction Sets

Chapter 5 PICmicro® MCU Hardware Features
  - Power Input and Decoupling
  - Reset
  - Watchdog Timer
  - System Clock/Oscillators
  - Configuration Registers
  - Sleep
  - Hardware and File Registers
  - Parallel Input/Output
  - Interrupts
  - Prescaler
  - The OPTION Register
  - Mid-Range Built-In EEPROM/Flash Access
  - TMR1 and TMR2
  - Serial I/O
  - Analog I/O
  - Parallel Slave Port (PSP)
  - 17Cxx External Memory Connections
  - In-Circuit Serial Programming (ISCP)
  - Future Devices

Chapter 6 PICmicro® MCU Application Design and Hardware Interfacing
  - Estimating Application Power Requirements
  - Reset
  - Interfacing to External Devices
  - LEDs
  - Switch Bounce
  - Matrix Keypads
  - LCDs
  - Analog I/O
  - Relays and Solenoids
  - DC and Stepper Motors
  - RIC Servo Control
  - Serial Interfaces

Chapter 7 PC Interfacing
  - PC Interface Software
  - Serial Ports
  - Parallel Port
  - Keyboard and Mouse Ports
  - ISA Bus

Chapter 8 PICmicro® MCU Application Software Development Tools
  - Software-Development Tools
  - High-Level Languages
  - MPSIM.INI
  - Stimulus (.STI) Files
  - FUZZYtech
  - Version Support Tools
  - MPLAB

Chapter 9 PICmicro® MCU Assembly-Language SoftWare
  - Development Techniques
  - Creating and Supporting Your Code
  - PICmicro® MCU Programming Tips
  - Interrupts
  - Event-Driven Programming
  - State Machine Programming
  - Porting Code Between PICmicro® MCU Device Architectures
  - Optimizing PICmicro® MCU Applications
  - A Baker’s Dozen Rules to Help Avoid Application Software Problems

Chapter 10 Macro Development
  - The Difference Between Defines and Macros
  - The Assembler Calculator
  - Conditional Assembly
  - Debugging Macros
  - Structured Programming Macros

Chapter 11 Designing Your Own PICmicro® MCU Application
  - Requirements Definition
  - PICmicro® MCU Resource Allocation
  - Effective User Interfacing
  - Project Management

Chapter 12 Debugging Your Applications
  - Characterizing Problems
  - Hypothesizing and Testing Your Hypothesis
  - Simulating Applications

Chapter 13 Programming PICmicro® MCUs
  - Hex File Format
  - Code-Protect Features
  - Low-End Programming
  - Mid-Range and ICSP Serial Programming
  - PIC17Cxx Programming
  - PIC18Cxx Programming
  - PICSTART Plus and PRO MATE II
  - The El Cheapo
  - The YAP-II
  - Third-Party Programmers

Chapter 14 Emulators 629
  - MPLAB ICE-2000
  - The PICMaster
  - MPLAB-ICD
  - The EMU-II
  - Other Emulators

Chapter 15 Experiments
  - Tools and Parts
  - PICmicro® MCU Processor Execution
  - Jumping Around
  - Data
  - Subroutines
  - Table Data
  - Playing with the Hardware
  - Analog Input/Output
  - I/O with Interrupts
  - Serial I/O
  - Debugging

Chapter 16 Projects
  - Low-End Devices
  - Mid-Range Devices
  - PIC17Cxx Devices
  - PIC18Cxx Devices

Chapter 17 Real Time Operating Systems
  - RTOS01: Simple PIC18Cxx RTOs
  - RTOS02: Multitasking Application Example

Chapter 18 In Closing

Appendix A Glossary

Appendix B Useful Tables and Data
  - Physical Constants
  - Audio Notes
  - “Touch-Tone” Telephone Frequencies
  - Electrical Engineering Formulas
  - DC Electronics Formulas
  - AC Electronics Formulas
  - Mathematical Formulas
  - Mathematical Conversions
  - ASCII
  - ASCII Control Characters
  - IBM Extended ASCII Characters

Appendix C PICmicro® MCU Application Debugging Checklist

Appendix D Resources
  - Microchip
  - Contacting the Author
  - Buying Project Kits Presented in this Book
  - PICmicro® MCU Books
  - Useful Books
  - My Favorite PICmicro® MCU Web Sites
  - Periodicals
  - Web Sites of Interest

Appendix E PICmicro® MCU Product and Service Suppliers

Appendix F SIMMSTICK

Appendix G UMPS

Appendix H GPASM/GPSIM LINUX PICmicro® MCU Application Tools

Appendix I PCB Boards

Appendix J CD-ROM
  - Accessing the CD-ROM Files
  - Rentron Articles
  - Microchip Datasheets

Index

About the Author

Software and License Information
            

ISBN Numbers

Softcover: 0-07-136172-3
            

The book is available from: