Step 4: Generate Code

Last modified by Microchip on 2026/06/26 07:35

Note: Generate and test the project separately for the internal and external clock configurations. First, generate the project using the internal clock configuration and observe the output. After verifying the output for the internal clock, reconfigure the system for the external clock, regenerate the project, and observe the corresponding output. This process helps in comparing the behavior of the system under different clock sources.

Generate Code

Generate the code by navigating to the Project Resources tab on the left side of the Project Graph and clicking the Generate button.

                                Project Resources tab

As code is generated, MPLAB® Code Configurator (MCC) displays the progress as shown in the accompanying image.

                                    MCC Generating

Once project generation is completed, the Peripheral Library (PLIB) files, .c files, and .h files are updated with the configured settings. The added configurations can be verified by navigating to the Projects panel on the left side of the Integrated Development Environment (IDE) and viewing the project tree structure containing the generated code.

Examine the generated files as shown in the accompanying image.

                                       Generated files

MCC will include all the MPLAB Harmony v3 library files and generate the code based on the MCC selections. The generated code would add files and folders to your MPLAB Harmony v3 project as shown.

Within the generated code, notice the PLIB files generated for the External Interrupt Controller (EIC), and PORT peripherals. MCC also generates the template main file (main.c).

Back to Top