Line 2: Line 2:
  
 
In this tutorial we will see how to setup a Mplabx project to generate .hex file for Pic16f877a<br><br>
 
In this tutorial we will see how to setup a Mplabx project to generate .hex file for Pic16f877a<br><br>
[[File:Pic16F877A_MplabX_Setup00.png]]<br><br>
+
[[File:Pic16F877A_MplabX_Setup0.png]]<br><br>
  
 
=Keil Setup Steps=
 
=Keil Setup Steps=

Revision as of 15:54, 22 April 2016


In this tutorial we will see how to setup a Mplabx project to generate .hex file for Pic16f877a

Pic16F877A MplabX Setup0.png

Keil Setup Steps

Step1: Open the Keil software and select the New Microvision project from Project Menu as shown below.


Step2: Browse to your project folder and provide the project name and click on save.
Pic16F877A MplabX Setup01.png

Step3: Once the project is saved a new pop up “Select Device for Target” opens, Select the controller(NXP:LPC1768) and click on OK.
Pic16F877A MplabX Setup02.png

Step4: Select the controller(NXP:LPC1768) and click on OK.
Pic16F877A MplabX Setup03.png

Step5: As LPC1768 needs the startup code, click on Yes option to include the LPC17xx Startup file.
Pic16F877A MplabX Setup04.png

Step6: Create a new file to write the program.
Pic16F877A MplabX Setup05.png

Step7: Type the code or Copy paste the below code snippet.
Pic16F877A MplabX Setup06.png

Step8: After typing the code save the file as main.c.
Pic16F877A MplabX Setup07.png

Step9: Add the recently saved file to the project.
Pic16F877A MplabX Setup08.png

Step10: Add the main.c along with system_LPC17xx.c.
Pic16F877A MplabX Setup09.png

Step11: Build the project and fix the compiler errors/warnings if any.
Pic16F877A MplabX Setup10.png

Step12: Code is compiled with no errors. The .hex file is still not generated.
Pic16F877A MplabX Setup11.png

Enable Hex File Generation

Step13: Click on Target Options to select the option for generating .hex file.
Pic16F877A MplabX Setup12.png

Step14: Set IROM1 start address as 0x0000.
Pic16F877A MplabX Setup13.png

Step15: Enable the option to generate the .hex file


Step16: .Hex file is generated after a rebuild.


Step17: Check the project folder for the generated .hex file.



Uploading the Hex file

After generating the .hex file check this tutorial for uploading Hex and Bin files.