Labsheet 6
Labsheet 6
Prelab Exercise:
1. What is a Microcontroller?
1
19EAC 285: Microcontroller Lab
4. What is an IDE? What are the commonly used IDEs for embedded systems development?
Keil IDE: Keil Electronics, provides an Integrated Development Environment called Keil µVision
(pronounced Micro-Vision) that integrates a project manager, editor, compiler, debugger, and simulator in a single
powerful environment; it provides a high efficiency and clear graphic user interface for embedded software
development.
Step 4: In the Database tree as shown below, choose the vendor and then the chip you want to use and click OK.
If want to use LPC2148, click on the NXP then on the LPC2148, and press OK. (Or in the search box, type
LPC2148 directly and click OK)
2
19EAC285 Micro-Controller Lab
Note that in the text editor window, keywords appear in a different colour; it is to differentiate
keywords from variables, constants, and others,
Step 8: Once the coding is
completed, press the save icon on
the file menu (or press Ctrl+S ).
Name the file as FirstFile.c and
save it as a C file in your personal
folder Amrita.
Step 9: Add your FirstFile.c to the
project. To do so: Expand Target1
on the left side panel; Right-click
on the Source Group1 and choose
Add Existing Files to source
Group; then browse the directory
Amrita and choose desired file:
FirstFile.c. Finally, click on the
Add button and Close.
3
19EAC 285: Microcontroller Lab
You should make sure that your file is added under the
project by expanding the Source Group shown under
Target (Note that firstfile. c is added under Source
Group 1in the left panel)
4
19EAC285 Micro-Controller Lab
Register Window: The leftmost panel (in the following figure, it is walled in blue) is called the register window It shows
16 general-purpose registers along with the Current Program Status Register (CPSR) and SPSR; this window allows you
to modify the contents. A register can hold a 32-bit signed, unsigned integer or a memory pointer. All C variables map
5
19EAC 285: Microcontroller Lab
Watch Window: Go through View-> Watch Windows-> Watch-1; this window allows you to view or monitor the
values of the variables or registers that are used in the program during run time (while the program is running); also you
may modify these values without disturbing or terminating the execution. To view the value of any variable the variable
should be added through the <Enter expression> field of the watch window.
_______________________________________________________________________________________________
Exercise 1: Execute the following C-code in KEIL IDE to find the biggest among two numbers. View the change in the
registers in the register window and also the variables in the watch window.
Exercise 2: Execute the following ARM Assembly code using Keil IDE; while typing the code proper indentation must
be provided as shown in the figure.
(Note: Start a new project, Do not add Startup.s file, Save the file with .asm extension)
6
19EAC285 Micro-Controller Lab