How to write a program in C using Keil Software for ARM7 (LPC2148)


We will use evaluation version of MDK-ARM v4 for C programming. This software is available at

Once you are familiar with the basic registers of LPC 2148, we can start with how to write and compile C program.

Software Tool-1: Introduction to KEIL uVision Software

It is a software tool available to program LPC 2148 using embedded C.


Open KEIL software. Home screen as shown in fig will appear.


Click on Project->New Project to create new project.


Provide project path and name to be saved.


Select NXP ->LPC 2148 options as shown in image.


Create new file (Ctrl+N).


Save the file with .c extension.


Write the program and save the file.


Click on Source Group -> Add files to Source Group and add your saved .c file.


Build the program with F7 key. If any errors are encountered, solve all of them.

Once above steps are performed, you will find .hex file in project folder. This .hex file will be used to burn the controller LPC 2148.


Software Tool-2: Flash Magic

Flash magic is a software tool used for burning the .hex files to NXP Controllers. It is available at

Let’s see how to use flash magic.


Open Flash magic software. Home Screen as shown will appear.


Make following settings*.

COM PORT: Select COM Port at which your hardware is connected.

BAUD RATE: Select 4800.

DEVICE: Select LPC2148 from drop down list.

INTERFACE: Select None (ISP).

Oscillator Freq. (MHz): Enter the value at which the controller is operating.


Tick on check box: Erase all flash+ Code Rd Prot.


Browse your hex file from project folder.


Tick on check box: Verify after programming.


Go to Options -> Advance options ->Hardware Config. Remove tick mark on check box: Assert DTR and RTS while COM Port open.


Click on START.


Wait few seconds till the software writes the program to the controller. You can see status at the bottom of software.

*: These settings are as per the hardware associated. Please refer manual of your hardware before operating.

You may also like...

Leave a Reply

Specify Facebook App ID and Secret in Super Socializer > Social Login section in admin panel for Facebook Login to work

Specify LinkedIn Client ID and Secret in Super Socializer > Social Login section in admin panel for LinkedIn Login to work

Your email address will not be published. Required fields are marked *