Experiment No 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Experiment No 2

Title: Introduction to arm lab software and study Keil IDE overview of project creation and
downloading and debugging

Aim: - Study of Keil IDE overview (Project creation, downloading & debugging)

Apparatus:- ARM-2148 Trainer kit.

Theory-

Getting started with ARM LPC2148 using Keil uVision/MDK IDE

There are various development environments available in the market for ARM processors.
Some of these are mentioned below:
• Cross Works for Arm
• Keil µVision MDK
• IAR Embedded Workbench
We will see how to install and setup the µVision IDE by Keil.
We will see the steps that need to be followed for installing this software correctly.
When this is done, we will setup the environment for LPC2148 and write a basic code for LED
blinking.

Using µVision IDE


We will create a simple LED blinking project. Following are steps which show how to create
and built project using the Keil uVision IDE:
1. Open Keil µVision from the icon created on your desktop.

2. Go to the Project tab. Select New µVision Project ...from that menu.
3. Create New Project window will pop up. Select the folder where you want to create
project and give a suitable name to the project. Then click on Save.

4. Select Device for Target: ‘Target1’...window will pop up next. It has a select window to
choose between Software Packs or Legacy Device Database. As LPC2148 is in Legacy
Device Database, choose Legacy Device Database.

Type in LPC2148 in search and select the device under NXP with the name LPC2148 and click
on OK.
5. A window will pop up asking whether to copy Startup.s to project folder and add file to
project. Click on Yes.

6. The project name and its folders can be seen on the left side in the project window after the
previous step is completed as shown below.

7. Now go to File tab and add New file from the menu.

8. Save the file from the previous step with a specific name. Add .c extension to the file
name.
9. Add this file to Source Group folder in the project window by right clicking on Source
Group1 folder and selecting Add Existing Files to Group ‘Source Group1’...

Select the previously saved file from the window that pops up and add it to the Source Group1.
In our case, LED Blinking.c
10. Now click on the Options for Target ‘Target1’... symbol shown in red box in the image
below or press Alt+F7 or right click on Target1 and click on Options for Target
‘Target1’....
Options for target window will open. Go to the Output tab in that window. Tick ‘√’ Create
HEX File option. We need to produce HEX file to burn it into the microcontroller.

In the options for target window, go to the Linker tab. Select the Use Memory Layout from
Target Dialogue option.

Then click on OK.

11. Now write the code for LED Blinking.


#include <lpc214x.h>
#include <stdint.h>

Void delay_ms(uint16_t j) /* Function for delay in milliseconds */


{
uint16_t x,i;
for(i=0;i<j;i++)
{
for(x=0; x<6000; x++); /* loop to generate 1 millisecond delay with 12MHz Fosc. */
}
}

int main(void)
{
IO0DIR = 0x000000FF; /* Set P0.0 to P0.7 bits as output bits by writing 1 in IO0DIR
register corresponding to those bits. */ while(1)
{
IO0PIN = IO0PIN | 0x000000FF; /* Make P0.0 to P0.7 HIGH while keeping other bits
unchanged. */
delay_ms(300);
IO0PIN = IO0PIN & 0xFFFFFF00; /* Make P0.0 to P0.7 LOW while keeoing other bits
unchanged. */
delay_ms(300);
}
}
12. Once the code is written, Build the code by clicking on the button shown in red in the
image below. You can also build the project from the Build Target option in the Project tab or
by pressing F7 on the keyboard.

You can see creating hex file ... in the Build Output window as shown in the image.
13. Once the project is built, a hex file is created in the Objects folder inside the folder of
your project. Use Flash Magic software to burn this hex file in your microcontroller.

Steps For proteus 8.12 SP0 ( Build 30713 )


1. Open Proteus and create a new project by clicking on "File" -> "New Project".
2. In the "New Project" dialog box, give your project a name and select the folder where
you want to save it. Click on "OK".

3. Once your project is created, click on "Library" -> "Pick Devices" in the main menu.
4. In the "Device Selection" dialog box, search for "LPC2148" in the search bar.

5. Select "LPC2148" from the list and click on "OK".


6. Now, click on "Library" -> "ARM" in the main menu.
7. In the "ARM" submenu, select "ARM7" and then "LPC2148".

8. Click on the "LPC2148" icon and place it on the workspace.


9. Double-click on the "LPC2148" to open its properties.
10. In the "LPC2148 Properties" dialog box, select the desired frequency for the crystal
oscillator (e.g. 12 MHz).
11. Under the "Peripherals" tab, you can add and configure various peripherals as required.
12. Once you have configured the LPC2148, connect the "Vcc" pin of the LPC2148 to the
"Voltage Source" using a wire.

13. Finally, save your project by clicking on "File" -> "Save" in the main menu.

To Download Program on Board we use Flashmagic Software

1. Download Flashmagic Tool: Firstly, download and install Flashmagic Tool from the official
website (https://www.flashmagictool.com/).
2. Connect the LPC2148: Connect the LPC2148 board to your computer via a USB cable.
3. Configure the Serial Port: Open the Flashmagic Tool and select the serial port that the LPC2148
board is connected to.
4. Configure the device: Select the LPC2148 device from the device list in the Flashmagic Tool. You
can also set other parameters like baud rate, oscillator frequency, etc.
5. Load Hex File: Click on the "Browse" button and select the Hex file that you want to program into
the LPC2148 device.
6. Erase the Flash: Before programming, it is essential to erase the flash memory of the LPC2148
device. In the "Operations" menu, select "Erase Device" and click on "Start".
7. Program the Device: After erasing the flash memory, select the "Program Device" option from the
"Operations" menu. Flashmagic will program the hex file onto the LPC2148 device.
8. Verify the programmed Hex File: Once programming is complete, select the "Verify Device"
option to ensure that the LPC2148 device has been programmed correctly.
9. Reset the device: After verification, reset the LPC2148 device to ensure that the new code runs
correctly.
Open the flash magic software and follow the below steps.

• Select the IC from Select Menu.


• Select the COM Port. Check the device manager for detected Com port.
• Select Baud rate from 9600-115200
• Select None Isp Option.
• Oscillator Freq 12.000000(12Mhz).
• Check the Erase blocks used by Hex file option
• Browse and Select the hex file.
• Check the Verify After Programming Option.
• If DTR and RTS are used then go to Options->Advanced Options-> Hardware Config and select
the Use DTR and RTS Option.
• Hit the Start Button to flash the hex file.
• Once the hex file is flashed, Reset the board. Now the controller should run your application
code.

Conclusion- In this experiment we have studied Keil IDE overview (Project creation,
downloading & debugging)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy