Upload
anishgoel
View
8.051
Download
5
Tags:
Embed Size (px)
Citation preview
Software
Keil uVisio
•
•
Flash Mag
•
Keil uVi
on IDE
uVision IDembeddeIt integra(for assemeditor, de
gic
A tool for p
sion IDE
DE (Integraed applicatioates a projecmbling, comebugger and
programming
ted Developons using thct manager
mpiling, and d simulator
g flash based
pment Envire Keil devel (to create a linking embinto one env
microcontrol
ronment) alopment tooand maintaibedded appvironment.
llers
lows develools. n projects),lications), s
opers to crea
, make utilitsource code
ate
ty
Keil Softw
The proje
1. Create
2. Create
3. Build ap
4. Debug
5. Downlo
Procedure
1. C
C
Th
2. C 1
ware Develop
ct developme
a project, sel
source files in
pplication wit
and correct e
oad code to F
es
reate Directo
reate a worki
his directory
*.uvpr
*.c – C
*.hex –to the
reate New Pr
. Launch KeStart Menu
pment Cycle
ent cycle is si
ect the targe
n C
th Project Ma
errors in sourc
lash ROM or
ory
ing directory,
will include t
roj – the main
C code; an inp
– contains mamicroproces
roject
il uVision IDEu.
milar to any o
t device from
anager
ce files, verify
SRAM and te
, such as C:\S
he following f
n project file t
put to the uVi
achine code; sor board
by clicking o
other softwar
m the Device D
y and optimiz
est the linked
ITE Program\
files:
to manage all
sion IDE prog
an output fro
n the icon on
re developme
Database, and
ze application
application
\UV Project, t
l files associa
gram
om uVision ID
n your deskto
ent project.
d configure th
n
to save all you
ted with curr
DE program th
p or by select
he tools setti
ur work.
rent project
hat is downlo
ting it from th
ngs
oaded
he
2. To create a new project file, click on Project from the menu bar and select New uVision Project. Under the Create New Project window, give your project a name and save it in the folder you created.
3. Select the device type by expanding NXP (founded by Philips) and choosing LPC2148. Notice that the description section lays out the details of the LPC2148 microcontroller, including the on‐chip peripherals and memory options. Click OK.
(This step is very important since uVision customizes the tool settings, peripherals, and dialogs for that particular device.)
**You may invoke this screen through the menu Project ‐> Select Device for Target … Menu in order to change the device type.
4. A dialog box will appear asking if you want to include a startup code for this device. Click YES.
(All embedded programs require some kind of microcontroller initialization or startup code. The startup code specifies the starting configuration of your hardware. All Keil tools include chip‐specific startup code for most of the devices listed in the Device Database.)
5. Once you have created a new project successfully, the Project Window shows the targets, groups, and files of your project. By default, the target name is set to Target 1, while the group’s name is Source Group 1.
3. Create Source Files Source files are …
1. To create a new source code, use the button on the File Toolbar or click on File in the menu bar and select New. This action opens an empty Editor Window to enter your source code.
2. Type in your C language code. (Note: See C Programming)
3. Save the new source file using the button on the File Toolbar or click on File in the menu bar and select Save.
4. Add Source Files
1. In the Project Window (on the left), expand the Target 1 folder. Right click on the Source Group 1 folder, then choose Add Files to Group ‘Source Group 1’ … .
2. Select the source file (.c file) you just created and saved. Click Add and then Close.
5. Compiling The compiler allows you to write in the C language and compile code to run on the LPC2148 microcontroller.
1. First, you need to set the option to create a HEX file by clicking on Project from the menu bar and selecting Options for Target ‘Target 1’… .
2. On the Output Tab, check the option to Create HEX File. Click OK.
3. Click on Project from the menu bar and select Build Target or Rebuild all target files. A Build Output window will show the source code getting compiled into a HEX file.
4. In the Build Output Window, a message of 0 Errors and 0 warnings signifies that your program compiled successfully. (Warnings do not prevent the program from running correctly. However, you should consider solving them to eliminate unwanted effects).
6. Downloading Program to Microcontroller We need to download the machine code (HEX file) into the physical memory locations of the microcontroller.
Setting Options
1. Select Flash from the menu bar and click on Configure Flash Tools… . On the Utilities tab, choose Use External Tool for Flash Programming. In the command line, select FlashMagic.exe.
2. In the Arguments line, modify the COM port number so that it corresponds to the port number assigned by the Windows Device Manager. To find the COM port number, follow these steps: 1. Click on Start in the lower left corner of your PC screen. Then, click on Control Panel. 2. Go to Hardware and Sound. Under Devices and Printers, select Device Manager. A
dialog box will pop up. Click OK. 3. In the Device Manager Window, expand Ports (COM & LPT) to see the port number
of the USB connection that is connected from the microcontroller to the PC.
4. On the Target tab, check Use MicroLIB.
Downloading Program The program will be downloaded to the micontroller using FlashMagic. FlashMagic is a utility to download the HEX file to the LPC2148 processor.
1. Click on Flash from the menu bar and select Download. Wait till the downloading process is finished.
2. In FlashMagic, select LPC2148 as the device, the correct COM port number, Baud Rate of
9600, None (ISP) for Interface and 12MHz for Oscillator. Then, check Erase blocks used by Hex File.
3. Select the HEX file that was just created by clicking Browse. Then, click Start.
4. The program will be downloaded to the on‐chip FLASH memory when Finished is
displayed in the status box at the bottom of the window.