Getting Started with
Keil µVision
WEL Team, IIT Bombay
2020
Development Tools
• Editor
– Entry of code into files
• Assembler or Compiler
– Generate machine code from source code
• Downloader
– Put machine code in the chip
• Execution check
– Using Debugger to verify operation of program (on Hardware or
Simulator)
Single Point Solution?
Keil µVision IDE
• Keil µVision
An easy-to-use IDE (Integrated Since 1982
Development Environment)
o Project management,
o Source code editing, Acquisition by
o Code building facilities,
o Run-time environment,
o Program debugging Around 2005
Now providing
Keil µVision IDE
• Project
o A collection of files related to a particular programming task.
• Build
o The process in which only the files modified since last build
are assembled/compiled for the chosen microcontroller device
• Rebuild
o The process in which all files are assembled/compiled
irrespective of their modification state.
Double click on the icon to start
“Keil µVision5” or “Keil µVision4”
Create a new project by clicking
on “New µVision Project”
Specify the name of your project.
In the “Select Device for Target” dialog,
type Microchip
The Pt-51 board uses an Atmel microcontroller (AT89C5131A). Atmel was
acquired by Microchip Technology Inc in 2016.
Microcontroller details
Expand the list of Microchip Choose AT89C5131A
devices from the list
• In the dialog which pops up, choose “No” if you are going to write programs
in assembly language.
• STARTUP.A51 is a file required for writing programs in C.
Configuring the Project target
options
Click on this icon or press
“Alt+F7”
to configure the target options
Configuring the Crystal frequency
Change to 24 MHz as
the Pt-51 board makes
use of 24MHz crystal
After that Select the
Output Tab
Creating HEX file
Click this Tick box to create Finally Click on OK to
Hex file save these Options
chosen for this project
To create a new source
file
1. Type here the code for your program in this
window.
2. Save the file as <<file name>>.asm for for
assembly language programs) or as <<file
name>>.c for C programs.
A saved assembly file
for use with the 8051
microcontroller family
Notice the different colors
used for assembler
directives, opcodes,
registers, data, etc by the
IDE.
To compile/build the code we
need to add the “.asm” file to
the project.
1. Right click on Source
Group 1
2. Select Add files to Group
Source Group 1
3. Select the proper file in
the file selection dialog
box
Rebuild - two ways :
1.Click the Rebuild button
2.Use Menu
Project => Rebuild all target files
Build Program - Multiple
ways :
1.Click the build button
2.Use Menu
Project => Build target
3.Press F7 function key
on keyboard
At the end of the “Build” / “Rebuild”
process, the compilation results are
presented in the Build Output window
consisting of:
1. warnings or errors if any
2.program and Data size
3.status of Hex file creation
Neglecting warnings may give wrong
program results.
In case of errors we go back to program
editing phase and update the program
to run in error free manner.
Solving Keil Crash Issue
• If Keil µVision keeps crashing on pressing the Start\stop debug
session, then follow these steps.
– Right click on the target folder (at the left pane).
– Select Options for Target `<TargetName>`.
– Select the Debug pane.
– Change the Parameter field to the right of Dialog DLL with name DP51.DLL to -p51.
– Tick the Limit Speed to Real-Time checkbox.
Questions ?
Thank you
WEL, IIT Bombay
2020
Presentation Version Information:
Date Comments
Jan 2020 Modifications to title. Changed some screenshots to remove Atmel references. Deleted
flowchart slide. Changed uVision to µVision.
2016 Initial version by Suryakant Toraskar, [email protected]