Programming PIC Microcontrollers with XC8

Retired

This book is no longer available for sale.

Programming PIC Microcontrollers with XC8

About the Book

****************************************************************************

Update 2018:

Title has been adopted by Apress and can be bought here:

https://www.apress.com/us/book/9781484232729

*****************************************************************************

Are you tired of copy and pasting code into your embedded projects? Do you want to write your own code from scratch for microcontrollers and understand what your code is doing?. Do you want to move beyond the Arduino?

Then get this book!

This is a book about developing embedded systems with 8 bit PIC microcontrollers using the XC8 compiler. There are many microcontroller enthusiasts who want to transition from using an Arduino and its many derivatives to using bare microcontrollers. However they do not know where to begin! In this book I will show you how to use microcontrollers. Though this book is geared toward those looking to migrate to the PIC microcontroller family, the language is clear enough that anyone can follow.

Though many persons are wondering why they should learn the PIC architecture when ARM microcontrollers are available from so many vendors and architectures like the AVR are available. The reason is simple. The PIC microcontroller family makes it easy to transition from 8 to 32 bits without changing environments and tools. The XC series of compilers from microchip also are simple to set up, completely free and all you have to do is click and run your code. Once you learn about the different peripherals on the PIC microcontroller, it will be easy to apply that knowledge to other microcontrollers.

The other advantage is that MPLAB X runs on Windows, MAC and Linux environments. You do not need to be a command line expert to work with PIC microcontrollers, so you can focus less on setting up your environment and more on your application. This book is complete and will help you understand modern PIC microcontrollers.

This book consists of 14 chapters and covers a host of topics. Every chapter is feature packed and they cover:

  • Introduction to PIC microcontrollers
  • How to set up the MPLAB X and XC8 compilers for microcontroller development.
  • Using GPIO and PPS
  • Interfacing LEDs, pushbuttons, motors, relays etc.
  • Using PWM, timers and counters
  • Interrupts
  • Interfacing character LCDs, GLCDs, colour LCDs, OLEDs and Touch Displays
  • Using the Core Independant Peripherals
  • Working with the CLC
  • On board FVR and Comparator applications
  • ADC module
  • DAC module
  • SPI protocol
  • I2C protocol
  • EUSART and Sofware UART communications
  • Using the eXtreme Low Power (XLP) options of PIC microcontrollers
  • Using GPS
  • Using GSM
  • AT commands
  • NEMA protocol
  • Wireless communications with WiFi and Bluetooth
  • Projects and a lot more!

This is THE BOOK TO GET STARTED WITH PIC MICROCONTROLLERS.

About the Author

Armstrong Subero
Armstrong Subero

I have been tinkering with electronics for as long as I can remember. The thrill of creating something from the ground up and watching it work is something that one never shakes. My entire life changed when I discovered microcontrollers. They were so powerful and simple and complex all at the same time. When I finished school I taught myself programming and for a while worked part-time for myself from a home office. I landed my first job as a Systems Technologist completely self taught and a lot of it was due to my in depth knowledge and passion for microcontroller technology. I have used many microcontroller families during the course of my work, however I have an affinity for PIC microcontrollers. I currently work for the Ministry of National Security in my country and design robots as well as write books, blogs and software on trinirobotics.com in my free time.

Table of Contents

  • Preface
    • Why Did I Write This Book?
    • Who Is This Book For?
    • What You Will Need For This Book?
    • What Will I learn in This Book?
    • About the Author
    • Errata and Suggestions
    • Copyright Disclaimer
  • Chapter One: Preparing For Development
    • 1.1 Gathering Your Hardware
    • 1.1.1 Microcontroller
    • 1.1.2 Programmer
    • 1.2 Gathering the Software
    • 1.3 Setting Up Shop
    • 1.3.1 Multimeter
    • 1.3.2 Oscilloscope
    • 1.3.3 Power Supply
    • 1.3.4 Shopping for Supplies
    • Conclusion
  • Chapter Two: The C Programming Language
    • 2.1 C
    • 2.2 C Programming
    • 2.2.1 C program Structure
    • 2.2.2 Comments
    • 2.2.3 Variables and Constants
    • 2.2.4 Arrays, Pointers and Structures
    • 2.2.5 Operators
    • 2.2.6 Controlling Program Flow
    • 2.2.7 Preprocessor Directives
    • 2.3 Assembly vs C
    • Conclusion
  • Chapter Three: Basic Electronics for Embedded Systems
    • 3.1 Electronics
    • 3.2 Resistors
    • 3.3 Potentiometer
    • 3.4 Photoresistor
    • 3.5 Capacitor
    • 3.6 Inductor
    • 3.7 Transformers
    • 3.8 Diode
    • 3.9 Transistor
    • 3.10 Operational Amplifier
    • 3.11 Digital Electronics
    • 3.13 Logic Level Conversion
    • Conclusion
  • Chapter Four: PIC® Microcontrollers
    • 4.1 PIC® Microcontrollers Overview
    • 4.2 PIC® 16F1717 block diagram
    • 4.3 Program Flash Memory
    • 4.4 Random Access Memory
    • 4.5 Timing Generation
    • 4.5 !MCLR
    • 4.6 PORTS
    • 4.7 On Board Peripherals
    • 4.7.1 Analog to Digital Converter
    • 4.7.2 Digital to Analog Converter
    • 4.7.3 Capture Compare Pulse Width Modulation Module
    • 4.7.4 Timers
    • 4.7.5 Comparators
    • 4.7.6 Fixed Voltage Reference
    • 4.7.7 Temperature Indicator
    • 4.7.8 EUSART
    • 4.7.8 CLC
    • 4.7.9 MSSP
    • 4.7.10 NCO
    • 4.7.11 ZCD
    • 4.7.12 COG
    • 4.7.13 Operational Amplifiers
    • 4.7.14 High Endurance Flash Block
    • 4.8 The Enhanced Mid-Range CPU Core
    • 4.8.1 Power-up Timer
    • 4.8.2 Oscillator Start-up Timer
    • 4.8.3 Power-on Reset
    • 4.8.4 Watchdog Timer
    • 4.8.5 Brown-out Reset
    • Conclusion
  • Chapter Five: Input and Output
    • 5.1 Let’s Begin I/O
    • 5.2 TRIS Register
    • 5.3 PORT Register
    • 5.4 Output Latch Registers
    • 5.5 Analog Select Registers
    • 5.6 Weak pull-up
    • 5.7 Making an LED Blink
    • 5.8 Using a Pushbutton
    • 5.9 Seven Segment Displays
    • 5.10 Seven Segment Display Multiplexing
    • 5.11 Project: Countdown Timer
    • 5.12 Peripheral Pin Select
    • 5.13 Conclusion
  • Chapter Six: Interfacing Actuators
    • 6.1 Introducing Actuators
    • 6.2 DC Motor
    • 6.3 Servo Motor
    • 6.4 Stepper Motor
    • Conclusion
  • Chapter Seven: Interrupts, Timers, Counters and PWM
    • 7.1 Introduction to Interrupts
    • 7.2 Timers
    • 7.3 Timer0 in Timer Mode
    • 7.4 Timer0 in Counter Mode
    • 7.5 Timer0 with Interrupts
    • 7.6 CCP Module
    • 7.7 Understanding PWM
    • 7.8 Using PWM
    • 7.9 Project: Using PWM with a Motor Driver
    • 7.10 Project: Using CCP and dedicated PWM with RGB LED
    • Conclusion
  • Chapter Eight: USART, SPI and I2C
    • 8.1 Serial Communication Protocols
    • 8.2 USART
    • 8.3 Serial Character LCD
    • 8.4 UART to PC Communication
    • 8.5 Text To Speech
    • 8.6 GPS
    • 8.7 NEMA Commands
    • 8.8 Software USART
    • 8.9 GSM Module
    • 8.10 AT Commands
    • 8.11 SPI
    • 8.12 Digital Potentiometer
    • 8.13 Character Display
    • 8.14 Character: The Hitachi HD44780 LCD
    • 8.15 The Samsung KS0066U
    • 8.16 I2C
    • 8.17 EEPROM
    • Conclusion
  • Chapter Nine: Interfacing Displays
    • 9.1 Displays
    • 9.2 OLED Display
    • 9.3 Touch Screen LCD
    • 9.4 Resistive Touch
    • 9.5 Capacitive Touch
    • 9.6 Selecting a Touch Screen LCD
    • 9.7 Using the Touch LCD
    • 9.8 Create a layout
    • 9.9 Adding Widgets
    • 9.10 Adding Code
    • 9.11 The Result
    • 9.12 Read on Microcontroller
    • Conclusion
  • Chapter Ten: ADC and DAC
    • 10.1 Data Conversion
    • 10.2 ADC
    • 10.3 Project: Digital Thermometer
    • 10.4 DAC
    • Conclusion
  • Chapter Eleven: CLC, NCO, Comparator and FVR
    • 11.1 CLC
    • 11.2 NCO
    • 11.3 Comparator
    • 11.4 FVR
    • Conclusion
  • Chapter Twelve: Wi-Fi and Bluetooth
    • 12.1 Low Cost Wireless Connectivity
    • 12.2 Wi-Fi
    • 12.3 The ESP8266
    • 12.4 Testing the ESP8266
    • 12.5 Project: Wi-Fi Data Logger
    • 12.6 Bluetooth
    • 12.7 Using the HC-05
    • Conclusion
  • Chapter Thirteen: Watchdog Timer and Low Power
    • 13.1 Low Power 8 bit vs 32 bit
    • 13.2 SLEEP Mode
    • 13.3 Watchdog Timer
    • 13.4 Other Ways to Conserve Power
    • 13.5 Reduce the Clock Frequency
    • 13.6 Reduce the Operating Voltage
    • 13.7 Power External Devices from I/O Lines
    • Conclusion
  • Chapter Fourteen: PIC® Microcontroller Projects
    • 14.1 Project: Temperature Controlled Fan
    • 14.2 Project: Touch Screen Clock
    • Conclusion

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub