Embedded Computing and Mechatronics with the PIC32 Microcontroller
For the first time in a single reference, this book provides the beginner with a coherent and logical introduction to the hardware and software of the PIC32, bringing together key material from the PIC32 Reference Manual, Data Sheets, XC32 C Compiler User's Guide, Assembler and Linker Guide, MIPS32 CPU manuals, and Harmony documentation. This book also trains you to use the Microchip documentation, allowing better life-long learning of the PIC32. The philosophy is to get you started quickly, but to emphasize fundamentals and to eliminate "magic steps" that prevent a deep understanding of how the software you write connects to the hardware.
Applications focus on mechatronics: microcontroller-controlled electromechanical systems incorporating sensors and actuators. To support a learn-by-doing approach, you can follow the examples throughout the book using the sample code and your PIC32 development board. The exercises at the end of each chapter help you put your new skills to practice.
Coverage includes:
- A practical introduction to the C programming language
- Getting up and running quickly with the PIC32
- An exploration of the hardware architecture of the PIC32 and differences among PIC32 families
- Fundamentals of embedded computing with the PIC32, including the build process, time- and memory-efficient programming, and interrupts
- A peripheral reference, with extensive sample code covering digital input and output, counter/timers, PWM, analog input, input capture, watchdog timer, and communication by the parallel master port, SPI, I2C, CAN, USB, and UART
- An introduction to the Microchip Harmony programming framework
- Essential topics in mechatronics, including interfacing sensors to the PIC32, digital signal processing, theory of operation and control of brushed DC motors, motor sizing and gearing, and other actuators such as stepper motors, RC servos, and brushless DC motors
For more information on the book, and to download free sample code, please visit http://www.nu32.org
- Extensive, freely downloadable sample code for the NU32 development board incorporating the PIC32MX795F512H microcontroller
- Free online instructional videos to support many of the chapters
Why Read This Book
You will learn how PIC32 hardware and firmware fit together so you can write reliable, well-understood embedded code rather than copy-pasting "magic steps." The book pairs hands-on mechatronics examples with systematic explanations of PIC32 datasheets, the XC32 toolchain, MIPS32 assembly, and Microchip Harmony so you can move from experiments to production with confidence.
Who Will Benefit
An embedded engineer or student who knows basic C and electronics and wants a practical, documentation-driven introduction to PIC32 firmware, peripherals, and mechatronics applications.
Level: Intermediate — Prerequisites: Basic C programming, elementary electronics (Ohm's law, circuits), and familiarity with digital logic and basic microcontroller concepts (GPIO, interrupts).
Key Takeaways
- Read and apply PIC32 Reference Manual and data sheet information to real firmware decisions
- Configure and use core peripherals (GPIO, timers, ADC, PWM, UART, SPI, I2C) on PIC32 devices
- Design and implement firmware for mechatronic subsystems (sensors, actuators, motor control, encoders)
- Use the XC32 toolchain, MPLAB X, assembler/linker outputs, and Microchip Harmony to build and debug projects
- Debug hardware–software interaction and avoid common "magic step" pitfalls by understanding low-level behavior
Topics Covered
- 1. Introduction to PIC32 and MIPS32 architecture
- 2. Development toolchain: MPLAB X, XC32, assembler and linker basics
- 3. Hardware fundamentals: clocks, reset, power, and pin multiplexing
- 4. GPIO, timers, and interrupt system
- 5. Analog peripherals: ADC and comparators
- 6. Communication peripherals: UART, SPI, I2C, and CAN
- 7. PWM, motor drivers, and actuator interfacing
- 8. Sensors, signal conditioning, and A/D sampling strategies
- 9. Mechatronics applications: encoders, PID control, and closed-loop systems
- 10. Firmware architecture, real-time considerations, and safety
- 11. Using MPLAB Harmony and higher-level frameworks
- 12. Debugging techniques, testing, and documentation-driven development
- Appendices: reference guides, example code, and reading Microchip datasheets
Languages, Platforms & Tools
How It Compares
Covers much of the same practical PIC32 programming ground as Lucio Di Jasio's "Programming 32-bit Microcontrollers in C," but places stronger emphasis on reading Microchip documentation and mechatronics applications; more applied and PIC32-focused than general PIC texts like Mazidi's PIC books.













