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


Summary

We will use evaluation version of MDK-ARM v4 for C programming. This software is available at https://www.keil.com/demo/eval/armv4.htm

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.

Step-1

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


Step-2

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

Step-3

Provide project path and name to be saved.

Step-4

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

Step-5

Create new file (Ctrl+N).

Step-6

Save the file with .c extension.

Step-7

Write the program and save the file.

Step-8

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

Step-9

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 http://www.flashmagictool.com.

Let’s see how to use flash magic.

Step-1

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

Step-2

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.

Step-3

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

Step-4

Browse your hex file from project folder.

Step-5

Tick on check box: Verify after programming.

Step-6

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

Step-7

Click on START.

Step-8

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 *