5.23 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:
- Right click on the project name in the Projects window and select Properties.
- Under Categories, click on the hardware tool you will use to program your code, e.g., PICkit 5.
- 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.
- Review the settings under the Program Options category.
- Depending on your hardware tool, there may be other programming option categories. Review each one to ensure the settings are correct for your project.
- 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 below. The first function is activated by clicking on the button. For other functions, click on the down arrow next to the button icon.
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 | Use the Programmer-to-Go feature of PICkit 4/5. | |
![]() |
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 Release from Reset |
Toggle the device between Reset and Run. Select before programming. |
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 |