Measuring Power Consumption with PAC1934 Step 2: Create and Set Up MPLAB X IDE Project
Create MPLAB X IDE Project
Create an MPLAB X IDE project for the PIC24FJ256GA705 using the MPLAB XC16 compiler.
You can refer to "Create a Standalone Project" if you would like detailed steps on how to create an MPLAB X IDE project.
Download and Extract Example Code
Download the example file pac1934-app-pic24fjxxxga7.X.zip and extract files into <your unzip folder>.
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
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.
Here is how your Add Files window should look:
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.
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.
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.
Install MPLAB Code Configurator (MCC)
If needed, install MCC. We will use it to graphically create peripheral drivers for this tutorial.
- You can refer to "Install MPLAB® Code Configurator (MCC)" if you would like detailed steps on how to do this.
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.
Check for the latest version, in this project we use version v2.2.
- You can refer to "How to add a library in MPLAB Code Configurator (MCC)" if you would like detailed steps on how to do this.