Hex Files in MPLAB® X IDE

Last modified by Microchip on 2024/01/05 22:24

Creating A Production Hex File

To build a production image, click on one of the following icons within MPLAB® X IDE             shows all the build icons 
 NameDescription
rebuild a projectClean and Build ProjectDeletes all the intermediate files, then re-compiles all source files in the project. After compilation, all the newly created intermediate files are linked together to create a single image file.
build a projectBuild ProjectSometime referred to as 'make'. Re-compiles only the files which have changed since the last build. Unchanged intermediate files are kept. After compilation, a single image file is created by linking the intermediate files.
program the targetMake and Program Main projectThis icon has two actions: the first is to invoke the Build Project function and the second is when the project is built, the image is downloaded to the PIC® MCU through the selected hardware tool for the project.
  • The production HEX file is placed within the dist subdirectory of the project folder. The exact subdirectory depends upon which MPLAB X project configuration is used. When no configuration is specified, MPLAB X uses a default subdirectory called default. Within the dist\<configuration> directory, the HEX file will be found in the production subdirectory.
  • Once the project is built, the HEX file for a project is created using the project name formatted as ProjectName.X. If the default configuration is used, it may be found at the following location:

Hex file location

configuration name


Read a Device and Save the Hex File

From the main toolbar, click on the small downward pointing triangle on the right edge of the Read Device button. A drop down menu will appear. Select Read Device Memory to File…. You will be prompted for a location to save the hex file.

read a device