Step 2: Create and Set Up MPLAB X IDE Project

Step 2.1: Create MPLAB X IDE Project

Create an MPLAB X IDE project for the PIC24FJ256GA705 using the MPLAB XC16 compiler.

Note: We’ll refer to your chosen project location as <your MPLAB X IDE project folder>.

You can refer to "Create a Standalone Project" if you would like detailed steps on how to create an MPLAB X IDE project.

Step 2.2: Download and Extract Example Code

Download the example file and extract files into <your unzip folder>.


Step 2.3: Copy Required Files, Folders from Demo Project

Copy all folders and files from pac1934-app-pic24fjxxxga7.X demo project into <your MPLAB X IDE project folder>. This step is necessary to create a self-contained project with no dependencies on the demonstration project similar to creating your own application.

Here are the files and folders you will need to complete this training:

  • DisplayDriver
  • MeterDrivers
  • UserInterface
  • App.c
  • App.h

Step 2.4: Add Content to MPLAB X IDE Project

Add PAC1934 library header files from the demonstration project to your project.

  • In MPLAB X IDE, right-click Header Files folder of your project, select Add Existing Items from Folders, click Add Folder…, change Files of type to Header Files, navigate to <your MPLAB X IDE project folder>, select each of the three folders and press the Select button.

Note: This step will create logical folders in your project and populate them with the required files.


  • Only one folder can be selected at a time, so this step needs to be repeated for the remaining two folders.
  • MPLAB X IDE v5.45 has a restriction that requires the file type to be selected before the folder.

Here is how your Add Files window should look:


Step 2.5: Add App.h File

Next, right-click the Header Files folder again, select Add Existing Item…, select App.h from <your MPLAB X IDE project folder>. Ensure the Copy box is unchecked.


Note: If you are interested in the differences between Auto, Relative, and Absolute store path options, you can read about them in Microchip’s Developer Help on "Add Existing File(s) To Project". Any selection will successfully build.

Step 2.6: Add Source Files

To add the source files from the PAC1934 library, we will repeat the process but change the file type.

  • Right-click the Source Files folder in MPLAB X IDE and select Add Existing Items from Folders…, click on Add Folder… and navigate and open <your MPLAB X IDE project folder>, verify Files of type pulldown has C Source Files selected, highlight the first of the three folders and press the Select button. Repeat the process to add the remaining two folders and press the Add button to add the folders and files.

Step 2.7: Add App.c File

Next, right-click the Source Files folder again, select Add Existing Item…, select App.c from <your MPLAB X IDE project folder>. Ensure the Copy box is unchecked. All of the required files to build the project have now been added.


Step 2.8: Install MPLAB Code Configurator (MCC)

If needed, install MCC. We will use it to graphically create peripheral drivers for this tutorial.

Step 2.9: Install PAC193x MCC Library

The PAC193x MCC Library is a custom MCC library used to graphically add driver code associated with the PAC1934 metering IC.


Download the PAC193x MCC Library from the PAC1934 product page or the MCC page.


Check for the latest version, in this project we use version v2.2.

© 2024 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.