Getting Started with PIC32

From Mech
Revision as of 09:11, 11 August 2009 by Andrew Long (Talk | contribs)
Jump to: navigation, search

Follow these steps to get started with PIC32.


MPLAB is the software used for editing, compiling, debugging code. This software creates the HEX files to download to the PIC.

Download and Install Microchip MPLAB (Microchip's free IDE for editing, debugging and compiling code)

Download and Install Microchip C32 Compiler (the academic version is free)

Download and Install Microchip Applications Library located at bottom of page. This zip file contains common source code and header files. There is a separate stack for PIC32, but it has been rumored that the PIC32 stack is going to get merged with the applications library therefore the code on this website is based on the application library stack.

  • Header files from the framework do not need to be specifically added to the project in MPLAB, but MPLAB needs to be directed to their location (see getting Directions for Starting New MPLAB Project)
  • Source files from the framework do need to be added to the project


An advantage of the PIC32 is that a bootloader can be installed. This means you do not need to a programmer to put new programs on the PIC. The UBW32 comes preloaded with a bootloader.

The HID bootloader is used to put HEX files on the PIC32. The HID bootloader should be included in the Applications Library downloaded above. It will be located under the start menu Programs -> Microchip -> MCHPFSUSB v2.5 -> Tools -> HIDBootLoader NOTE: occassionally, the bootloader will get stuck verifying that the program is running. (There must be a bug in the bootloader application code) It will take 90-100% of CPU. End task manually with the task manager if this happens.

See Programming Bootloader on PIC32 for directions on how to create your own bootloader.

Linker File

When creating new projects to download to the PIC, you must include a linker file. If you have installed a bootloader, the linker file tells the bootloader to put the program after the bootloader memory. The required linker file is called procdefs.ld. The standard linker file is here for PIC32. linker file is in the project folder. The procdefs.ld for UBW32 is different than the standard procdefs.ld for PIC32 when using the bootloader originally installed on UBW32. Make sure to use the procdefs.ld file here xPC PID Example.mdlfor UBW32.

This website warns that if the procdefs linker file is not in the project the bootloader may be hosed.

Personal tools