Lab 1 - Creating an MPLAB X Project (rev. 3.00)

NOTE: Microchip updates its tools regularly. This page is an older version that we have preserved for the convenience of those who are supporting existing designs based upon older versions of our tools. Please check for the updated version of this page.


Lab Exercise 1 shows how to create, edit, and build projects with MPLAB® X IDE. This lab is a step by step walk through of MPLAB X project development. An MPLAB X project is created and an existing C source file is then added to the project. The lab continues with the editing of the source file and the successful build of a project. The lab includes exercises to demonstrate some useful file and data manipulation features of MPLAB X IDE


Hardware Tools (Optional)

Tool About Purchase
Explorer 16
Development Board
In-Circuit Debugger

Software Tools

Tool About Installers
Windows Linux Mac OSX
Integrated Development Environment
C Compiler

Exercise Files

The contents of the following zip file need to be placed in this directory:

File Download
Windows Linux Mac OSX
Project and Source Files



Project Creation


Close any open projects in MPLAB X IDE by right clicking on the project name and selecting Close or by going to File and choosing Close All Projects.

When MPLAB® X starts it opens the last project worked on. To avoid confusion, this lab asks to you close any open project


Start Project Creation

Click the New Project Main_New_Project.png icon to start the project creation process


New Project Window

Select “Microchip Embedded” then “Standalone Project”.



Processor Selection

Select “16-bit MCUs (PIC24)” from the ‘Family’ pull down menu, then select “PIC24FJ128GA010” from the ‘Device’ menu.


We are using the PIC24FJ128GA010 as the microcontroller for this lab.

Click Next SmallNext.png


Header Selection

No header is needed; select “None”


Debug Headers are usually only required for some of the 8 bit controllers with very low pin counts. If you are using a 16-bit, 32-bit or 8-bit with more than 14 pins a header might not be needed.

Click Next SmallNext.png


Hardware Selection

Select “Simulator” under Hardware tools when asked to select a tool.

Click Next SmallNext.png


Compiler Selection

Open the XC16 plus box, if not already open, and select an installed version of the XC16 compiler

Click Next SmallNext.png


Project Name and Folder Selection

Click the Browse button and navigate to the folder C:\MTT\TLS0101

On the line marked Project Name type in Lab01.

Notice MPLAB® X filling in the Project Folder line with C:\MTT\TLS0101\Lab01.X

Click Finish Finish.png

Congratulations! You have just created an MPLAB® X project

We will now add source code files to the project.


Move Source Files into the Project Folder


Using a file manager program (such as Windows Explorer) copy the C file ‘Lab01’ from the folder “C:\MTT\TLS0101\Lab01 Source files” to the newly created folder “C:\MTT\TLS0101\Lab01.X”


After this step, the Lab01.X folder should contain the subfolder nbproject and two files (as illustrated above)

It is not necessary to add files to a project folder before adding them to a project. Putting all the files into the project folder can make backing up a project easy.


Adding Files to the Project

Right click on the Source Files folder in the project window

Select Add Existing Item


Highlight the ‘Lab01’ file in the folder C:\MTT\TLS0101\Lab01.X

Ensure the radio button labeled “Relative” in the lower right border of the dialog box is checked

Click Select


Project window after source file has been added to a project



Open the Editor

Double click on the Lab01.c file to open editor


Scroll down so the main() and delay() functions are visible in the editor window

This a very simple program designed to build confidence in your ability to build a project and run it in MPLAB® X.

Upon exiting reset, the PIC® clears PORTA, then configures PORTA pins 0:7 as outputs. It then enters an infinite loop that outputs an alternating pattern to PORTA resulting in the effect of blinking the eight LEDs connected to PORTA. The delay function between each toggle of the LEDs is necessary since LEDs require several ms to turn on or off, whereas the PIC® can toggle in a few hundred ns.


Build the Project

Click the Clean and Build Project icon Main_Rebuild_Project.png to build the project

Congratulations! You have finished Lab 1

© 2018 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.