Lab 1: Create the Application

Step 9: With MHC, Generate Code

1

Before generating code, save the MHC state by navigating to File > Save State in the main MHC menu. You may also click on the Save MHC State button.

lab1_step9_01.png
Figure 1: Save the MHC state

2

Click on the Generate Code button or navigate to Generate > Generate Code from the menu bar to start generating code. Save if prompted.

lab1_step9_02.png
Figure 2: Generate Code

3

Click on the Generate button in the Generate Project window, keeping the default settings.

lab1_step9_03.png
Figure 3: Generate Project

Note: As the code is being generated, MPLAB® Harmony Configurator (MHC) displays the progress.

4

Once this process completes, switch to the MPLAB X IDE window. You may now examine the generated code through the Projects tab. MHC will include all the requisite MPLAB Harmony v3 Framework files and generate the configuration code dynamically based on your MHC selections. MHC will then automatically organize and add the generated code as files and folders to your 32-bit MPLAB Harmony 3 Project.

MHC generates a default template main file (main.c) and application files (app_sensor.c/app_sensor.h) based on your MHC configuration. These will be used for the Sensor Task state machine.

lab1_step9_04.png
Figure 4: Generate Files

Note: The Peripheral Library (PLIB) files are generated for the Timer, GPIO, EVIC, and CLOCK peripherals. The files for the USB Device Stack Middleware, I²C Drivers, and the Debug System Service are generated as well.

5

Build the code by clicking on the Clean and Build Main Project Main_Rebuild_Project.png button in the MPLAB X IDE and verify that the project builds successfully.

At this point, you are ready to start implementing the application code.



Next Step >

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