𝔖 Scriptorium
✦   LIBER   ✦

📁

Programming PIC Microcontrollers with XC8: Mastering Classical Embedded Design (Maker Innovations Series)

✍ Scribed by Armstrong Subero


Publisher
Apress
Year
2024
Tongue
English
Edition
2
Category
Library

⬇  Acquire This Volume

No coin nor oath required. For personal study only.

✦ Synopsis


Are you tired of copying 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 without all the frills and math? This book uses a practical approach to show you how to develop embedded systems with 8-bit PIC microcontrollers using the XC8 compiler.

Written for those who want more than an Arduino, but less than the more complex microcontrollers on the market, this new edition is fully updated and covers embedded design principles such as foreground-background loops and event driven programming. You’ll learn how to interface with things like Motors, PID loop control and writing a browser-based monitoring system! This book is heavy on code, schematics, and images and focuses less on the theoretical aspects of using microcontrollers.

Coverage includes writing a display driver, using the DAC for a multitude of waveform generation techniques, and building 8-bit IoT systems, real time telemetry, a countdown timer, and new peripherals. These topics are important if you want to learn more about PIC microcontroller devices as a whole. You’ll also see the advantage that MPLAB X offers by running on Windows, Mac and Linux environments. You don’t 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.

If you want to move beyond the Arduino, Programming PIC Microcontrollers with XC8 is your complete guide to understanding modern PIC microcontrollers.

What You’ll Learn

Set up the MPLAB X and XC8 compilers for microcontroller development
Use GPIO and PPS
Review EUSART and Software UART communications
Use the eXtreme Low Power (XLP) options of PIC microcontrollers
Explore wireless communications with WiFi and Bluetooth

✦ Table of Contents


Table of Contents
About the Author
About the Technical Reviewer
Preface
Preface to the First Edition
Chapter 1: Preparing for Development
Gathering Your Hardware
Microcontroller
Programmer
Gathering the Software
MPLAB X IDE
XC Compilers
Setting Up Shop
Multimeter
Oscilloscope
Power Supply
Shopping for Supplies
Conclusion
Chapter 2: The C Programming Language
C
Will Rust Dethrone C in Embedded Development?
C Programming
C Program Structure
Comments
Variables and Constants
A Closer Look at Integer Types
Operators
Bitwise Operations
Controlling Program Flow
if Statement
else Statement
else-if Statement
switch Statement
for Loop
while Loop
do-while Loop
Control Transfer Statements
break Statements
continue Statement
goto Statement
Arrays
Functions
Pointers
Structures and Unions
Dynamic Memory Allocation
Preprocessor Directives
#define
#pragma
Assembly vs. C
Conclusion
Chapter 3: Basic Electronics for  Embedded Systems
Electronics
Electronics Components
Resistors
Potentiometer
Digital Potentiometer
Photoresistors
Capacitors
Inductors
Transformers
RC, RL, RLC, and Tank Circuits
Diode
Zener Diodes
Light-Emitting Diode
Laser Diodes
Transistors
Bipolar Junction Transistors
Darlington Transistor
Field Effect Transistor
Metal Oxide Semiconductor Field Effect Transistor (MOSFET)
Junction Field Effect Transistor
Operational Amplifiers
Understanding Waveforms
Oscillators
Integrated Circuits
Digital Electronics
Logic Gates
The AND Gate
The OR Gate
The NOT Gate
The NAND Gate
The NOR Gate
The Buffer Gate
The XOR Gate
Comparators
Clocked Flip Flops, Latches, and Counters
Registers and Shift Registers
Accumulators
Multiplexers and Demultiplexers
Buffers and Drivers
Logic-Level Conversion
Run the Entire System on 3.3 v
Using a Bus Transceiver
Bidirectional Logic-Level Shifter
Use a Voltage Divider
Conclusion
Chapter 4: PIC Microcontrollers
Microcontrollers
PIC Microcontrollers Overview
Baseline PIC Microcontrollers
Midrange PIC Microcontrollers
Enhanced Midrange PIC Microcontrollers
High-Performance PIC Microcontrollers
PIC16F1719 Block Diagram
Program Flash Memory
Flash Memory Operations and Limitations
High Endurance Flash
Timing Generation
A Closer Look at Microcontroller Clocks
Flash Wait States
!MCLR
Ports
Onboard Peripherals
Analog-to-Digital Converter
Digital-to-Analog Converter
Capture/Compare/Pulse Width Modulation Module
Pulse Width Modulation Module
Timers
Comparators
Fixed Voltage Reference
Temperature Indicator
EUSART
CLC
MSSP
NCO
ZCD
COG
Operational Amplifiers
The Enhanced Midrange CPU Core
Power-Up Timer
Oscillator Start-Up Timer
Power-On Reset
Watchdog Timer
Brown-Out Reset
Conclusion
Chapter 5: Input and Output
I/O Fundamentals
TRIS Register
Port Register
Output Latch Registers
Analog Select Registers
Weak Pull-Up
Blinking an LED
Device Configuration Bits
Our Device Header and Source Files
Our Main File
The LED Blink Program Hardware
A Closer Look at Bit Access
GPIO Switching and Buffering Techniques
Low-Power Low-Side Switching
Low-Power High-Side Switching
High-Power Low-Side Switching
Using IC Buffers and Drivers
Using a Pushbutton
Seven-Segment Displays
Multiplexing Seven-Segment Displays
Project: Countdown Timer
Conclusion
Chapter 6: Interrupts, Timers, Counters, and PWM
Introduction to Interrupts
Timers
Timer0
Timer0 Counter Mode
Peripheral Pin Select
External Interrupts
The CCP Module
Understanding PWM
Using PWM on the PIC Microcontroller
Project: Using PWM with RGB LED Lighting
Conclusion
Chapter 7: Interfacing Actuators
Introducing Actuators
Actuators in Embedded Systems
Simple On/Off Control
Driving Motors with Power MOSFETs
PWM Speed Control
Directional Control Small Motors
Directional Control Large Motors
Encoders
PID Control
Servo Motor
Stepper Motor
Conclusion
Chapter 8: USART, SPI, I2C, and  Communication Protocols
Understanding Serial Communication
USART
Using GPS (Global Positioning System)
NMEA Commands
Software USART
GSM Module
AT Commands
Using SPI (Serial Peripheral Interface)
Using the I2C (Inter-Integrated Circuit) Protocol
I3C (Improved Inter-Integrated Circuit) Protocol
Conclusion
Chapter 9: Interfacing Displays
Displays
Character Display
OLED Display
Touch Screen LCD
Resistive Touch
Capacitive Touch
Selecting a Touch Screen LCD
Using the Touch LCD
Creating a Layout
Adding Code
Read on Microcontroller
Conclusion
Chapter 10: ADC and DAC
Data Conversion
Challenges of Data Conversion
ADC (Analog-to-Digital Conversion)
Reading a Potentiometer
Light Sensing with a Photoresistor
Using an Analog Joystick
DAC (Digital-to-Analog Converter)
Sinusoidal Waveform Generation
Square Wave Generation
Triangle Wave Generation
Conclusion
Chapter 11: CLC, NCO, Comparator, and FVR
Core Independent Peripherals (CIPs)
Configurable Logic Cell (CLC)
Configurable Logic Block (CLB)
Numerically Controlled Oscillator
Comparator
Fixed Voltage Reference (FVR)
Conclusion
Chapter 12: Wi-Fi and Bluetooth
Low-Cost Wireless Connectivity
Wi-Fi
The ESP8266
Testing the ESP8266
Project: Wi-Fi Data Logger
Bluetooth
Using the HC05
Conclusion
Chapter 13: Watchdog Timer and Low Power
Low Power 8 vs. 32-Bit
Sleep Mode
Watchdog Timer
Other Ways to Conserve Power
Reduce the Clock Frequency
Reduce the Operating Voltage
Power External Devices from I/O Lines
Utilize Peripheral Shutdown Features
Implement Interrupt-Driven Programming
Optimize Firmware Algorithms
Take Advantage of Brown-Out Detect (BOD) Disable
Use Power-Saving Modes Wisely
Minimize External Peripheral Power
Capacitive Touch Sensing with Low Power
Dynamic Clock Switching
Optimize ADC Usage
eXtreme Low Power (XLP) Technology
Conclusion
Chapter 14: PIC Microcontroller Projects
Project: Temperature-Controlled Fan
On-Off Control
On-Off vs. PWM-Based Control
Project: UART to Browser Bridge
Setting Up a Flask Server
Static Page
Conclusion
Index


📜 SIMILAR VOLUMES


Programming PIC Microcontrollers with XC
✍ Armstrong Subero 📂 Library 📅 2024 🏛 Apress 🌐 English

Are you tired of copying 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 without all the frills and math? This book uses a practical approach to show you how to develop embedded systems with 8-b

Programming PIC Microcontrollers with XC
✍ Armstrong Subero 📂 Library 📅 2024 🏛 Apress 🌐 English

Are you tired of copying 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 without all the frills and math? This book uses a practical approach to show you how to develop embedded systems with 8-b

Programming PIC Microcontrollers with XC
✍ Armstrong Subero (auth.) 📂 Library 📅 2018 🏛 Apress 🌐 English

<p>Learn how to use microcontrollers without all the frills and math. This book uses a practical approach to show you how to develop embedded systems with 8 bit PIC microcontrollers using the XC8 compiler. It's your complete guide to understanding modern PIC microcontrollers.<br/>Are you tired of co

Programming PIC Microcontrollers with XC
✍ Armstrong Subero 📂 Library 📅 2018 🏛 Apress 🌐 English

<div><p>Learn how to use microcontrollers without all the frills and math. This book uses a practical approach to show you how to develop embedded systems with 8 bit PIC microcontrollers using the XC8 compiler. It's your complete guide to understanding modern PIC microcontrollers.</p><p>Are you tire