Program a Device

Once your code is debugged, you can program it onto a target device.

Set Project Programming Properties

Set up programming options in the Project Properties window:

  1. 1.Right click on the project name in the Projects window and select “Properties.”
  2. 2.Under “Categories,” click on the hardware tool you will use to program your code, e.g., PM3.
  3. 3.Review the settings under the “Memories to Program” options category.
 If you wish to use a Preserve Memory option, ensure that your code is not code protected. Code is preserved when the programmer reads the section it needs to save, performs a bulk erase of the device, reprograms the device and then rewrites the area that is preserved with what was saved.
  4. 4.Review the settings under the “Program Options” category.
  5. 5.Depending on your hardware tool, there may be other programming option categories. Review each one to ensure the settings are correct for your project.
  6. 6.When using RTDM with DMCI, Motor Control applications etc., you will need to check the checkbox “Load symbols when programming or building for production (slows process)” under the “Loading” category.

For more information about programming options, please consult your hardware tool documentation.

After the programming options are set up as you desire, you may proceed to program the device.

Perform Programming

To program your target device with debugged code, click the toolbar button Make and Program Device Project.

Other programming-related functions are shown in the Table 4-9. The first function is activated by clicking on the button. For other functions, click on the down arrow next to the button icon.

Table 1. Programming Functions on Toolbar Buttons
Button Icon Function Details
Make and Program Device The project is built (if necessary) and the device is programmed.

The program will immediately begin execution on completion of programming.

Program Device for Debugging The device is programmed from a debug image.

The program will immediately begin execution on completion of programming.

Program Device for Production The device is programmed from a production image.

The program will immediately begin execution on completion of programming.

Programmer to Go PICkit 3 Use the Programmer to Go feature of PICkit 3.
Read Device Memory Transfer what is in target memory to MPLAB X IDE.
Read Device Memory to File Transfer what is in target memory to the specified file.
Read EE/Flash Data Memory to a File Transfer what is in target data memory to the specified file.
Hold In Reset Toggle the device between Reset and Run.

Program Using the MPLAB Integrated Production Environment

Not all programming functions are in the MPLAB X IDE. For additional programming support, see the MPLAB IPE included with the MPLAB X IDE installation.

Desktop Icon for MPLAB IPE