XC8 Projects
Jump to our page here.
XC32 Projects
Jump to our page here.
Create MPLAB X Project
Run MPLAB X IDE
Menu > File > New Project
Categories: Microchip Embedded
Projects: Standalone Project
Select the device
Select the debugging tool
Select the Compiler to use
Set project name and “Set as main project”
Add Source Code Files
Add your initial project files to the projects “ProjectName.X” directory.
Right click the project > Add Existing Item > Select the files
Drag them into the Header Files and Source File folders.
Setting Up Debug / Release Mode
Old MPLAB allowed you to use this macro in code:
__DEBUG
to detect if a debug or release mode was selected. It was just built in, but its not in MPLAB X.
So add this to a global header file when debugging:
#ifndef __DEBUG
#define __DEBUG //<<<<< COMMENT OUT FOR RELEASE
#endif
Compiler Settings
IMPORTANT – ENSURE YOU CHECK THE BASIC COMPILER SETUP OPTIONS TO HELP ENSURE YOU DON’T GET CAUGHT UP IN STUPID BUGS