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

00 Lpc7168 Keil.png

Keil Setup Steps

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

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

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


Step4: As LPC2148 needs the startup code, click on Yes option to include the Startup file.
LPC2148KeilSetup04.png

Step5: Create a new file to write the program.
LPC2148KeilSetup05.png

Step6: Type the code or Copy paste the below code snippet.
LPC2148KeilSetup06.png

Step7: After typing the code save the file as main.c.
LPC2148KeilSetup07.png

Step8: Add the recently saved file to the project.
LPC2148KeilSetup08.png

Step9: Add the main.c to the project.
LPC2148KeilSetup09.png

Step10: Build the project and fix the compiler errors/warnings if any.
LPC2148KeilSetup10.png

Step11: Code is compiled with no errors. The .hex file is still not generated.
LPC2148KeilSetup11.png

Enable Hex File Generation

Step12: Click on Target Options to select the option for generating .hex file.
LPC2148KeilSetup12.png

Step13: Set IROM1 start address as 0x0000.
LPC2148KeilSetup13.png

Step14:Enable the linker setting to use the IROM1 address as configured in above step. LPC2148KeilSetup24.png

Step15: Enable the option to generate the .hex file
LPC2148KeilSetup14.png

Step16: .Hex file is generated after a rebuild.
LPC2148KeilSetup15.png

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


Uploading the Hex file

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

Downloads

Download the complete project folder from the below link:


Have an opinion, suggestion , question or feedback about the article let it out here!