Adding to your project

Create your MPLABX project as normal.

Press the blue ‘MCC’ button on the toolbar to launch the code configurator.

MCC Melody / MCC Classic / MPLAB Harmony choice

(Unavailable options for your chosen device will be greyed out)

“MCC Classic” is the old typical option to go with, but Harmony maybe what you want to be able to utilize all the special more advanced use case libraries that Harmony provides.

Add any special libraries (you’ll be prompted for all the normal peripherals after pressing Finish).

At the next stage setup all the config by adding the modules you want to use and adjusting settings.

When done from the “Generate” button (in top left Project Resources box). Check for any errors in the Output window.

Press the MCC button to close the Code Configurator view.

The MCC will have created a main.c file for your project, plus various other driver files in folder “\mcc_generated_files”.

Simple way to integrate your project files with the MCC generated main.c file

Create your own main and init functions:

//********** INITIALISE **********
void ap_initialise (void)
	uint8_t Data;

	//----- ENABLE INTERRUPTS -----
	INTCONbits.PEIE = 1;


//********** MAIN FUNCTION **********
void ap_main (void)
	//***** MAIN LOOP *****
	//while(1)						//(Do forever) <THIS IS ALREADY OCCURING IN main.c main(), WE ARE CALLED FROM WITHIN IT

		//<<<< Add your applicaiton main loop code here

	//}	//while(1)
In the main.c file
//Add these after the #include section at the top
extern void ap_initialise (void);
extern void ap_main (void);

//Add this before the main() function "while (1)" or "while (true)"

//Add this inside the main() function "while (1)" or "while (true)" loop

Using MCC created peripherals

See the dedicated section of this web site here.

We benefit hugely from resources on the web so we decided we should try and give back some of our knowledge and resources to the community by opening up many of our company’s internal notes and libraries through mini sites like this. We hope you find the site helpful.
Please feel free to comment if you can add help to this page or point out issues and solutions you have found, but please note that we do not provide support on this site. If you need help with a problem please use one of the many online forums.


Your email address will not be published. Required fields are marked *