0% found this document useful (0 votes)
368 views40 pages

Guide To Installation And Use Of Keil Μvision2 Software

This document provides instructions for installing and using Keil μVision2 software to write, build, and debug embedded C programs. The steps are: 1) Install Keil μVision2 from the provided folder and enter the serial number. 2) Create a new project, select the target microcontroller, and add/write a C source code file. 3) Build the project to generate a hex file. 4) Use the debugger to step through or freely run the program and view I/O port status.

Uploaded by

asma mushtaq
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
368 views40 pages

Guide To Installation And Use Of Keil Μvision2 Software

This document provides instructions for installing and using Keil μVision2 software to write, build, and debug embedded C programs. The steps are: 1) Install Keil μVision2 from the provided folder and enter the serial number. 2) Create a new project, select the target microcontroller, and add/write a C source code file. 3) Build the project to generate a hex file. 4) Use the debugger to step through or freely run the program and view I/O port status.

Uploaded by

asma mushtaq
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 40

Guide to Installation and use

of keil µVision2 Software


Install from:
keil7_setup  setup 
setup.exe
Select “Full Version”
Enter Serial Number
K1RIP-M2192-KO14E
Browse for add-on’s Path
Path is: keil7_setup  addon c51
addon
Check (√) Install Security key driver  Next
Now setup is complete and keil µVision 2 is
Installed on your PC.
Run the software from the short-cut on your
desktop.
A project named “Hello” containing file HELLO.c
will be opened automatically as you run the
software for the first time.
Close this project from:
Project menu  Close Project
Close Project “Hello”
Now you have “Keil µVision IDE”
To Create your own Project go to:
Project Menu New Project
Create your own Project after creating new
project folder/directory at your desired location

Your Project / Working Directory Use to set location and create new folder

Your Project Name


(will automatically get the extension “.uv2”)
Now Save the project by clicking on the “Save”
button
As you click on the Save button,
a device selection window will automatically appear
as shown on the next slide
Target Device (The microcontroller we will use) Selection.
Expand (Click ‘+’) on Atmel
Select: Atmel  89C51  OK
Now create a New File from the short-cut button
or from: File menu  New
A New Text* file will be created which will be
our source code file in the future
Now write the following simple c program in the text file

#include <reg51.h> /* special function register declarations */


/* for the intended 8051 derivative */

void main (void)

{
while(1) /*------------------------------------------------
Note that an embedded program never exits (because
there is no operating system to return to).
It must loop and execute forever. So, "while(1)" loop.
------------------------------------------------*/
{
P0=0xaa; // Sends High and Low on alternate Pins of Port 0
P0=0x55; // Sends High and Low on Port 0 in reverse order
}
}
Program is written. All text between ‘/*’ and ‘*/’ or followed by ‘//’ is
not part of the code and is just comments / documentation
Now save the file from: File Menu  Save as File Name
Note that the file name must be written with dot c (.c) extension
Note:
In case the Program is written in assembly language,
the file must be saved with dot asm (.asm) extension.
Also note that the moment we save the Text* file (with
“.c” or “”.asm” extension), the code in the file gets a
standard colour scheme
Now click on ‘+’ sign of folder “Target 1” shown in
“Project Window” on the left side of IDE

Click to
Open

Project Window
A “Source Group” folder will appear containing no
source code file as shown
We have created a project named “First” and also
written a program in C language (LEDs.c in this
example) and saved it with dot c extension, but both
Project and source code files exist separately. As
shown by empty Source Group folder.
So, we have to add source code file into the Project
Right Click on: Source Group 
Click: Add files to Group “Source Group 1”

Right
Click
A window showing source code files will appear.
Select , Add and Close.
The added file will be shown in “Source Group” folder
in Project Window

Click to Open
Now go to Project Menu  Options for Target ‘Target 1’
or simply right click “Target 1” in Project Window 
Options for Target ‘Target 1’

Right Click
In Options for Target Window, under Target Tag
a) Edit Xtals Freq. to 11.0592 MHz (replacing 24.0)
b) and Code Rom Size to Small program 2K, or less
Similarly, under Output Tag Check (√) the
Create Hex File Check Button

Click to
Check
Now Project is complete with all necessary settings
and is to be built (Compiling and Linking Process)
So, Project  Build Project or Use Short-cut
See the result of Build target command in the Output
Window

Output Window

Successful building of Project and


Creation of Hex file
“Creating hex file….” line in the command window
shows that a hex file of the same name as that of the
project has been successfully created which can now
be burnt into the microcontroller.
The default location of the hex file is same as that
of the project i.e. our own created directory.
Keil µVision Debugger
The Debugger of the keil software is used for software simulation
of the code before loading / burning it into the target
microcontroller
Start Debugger from: Debug Menu  Start / Stop Debug session
or from short-cut on the debug tool bar
Now to view Hardware/Ports status (Port 0 in our case), go to
Peripherals  I/O Ports  Port 0
Parallel Port 0 window will appear showing the Data
on the Port
We can simulate our code in 2 modes
1) Step by step execution (Debug  Step over or F10)
(2) Free Running mode (Debug  Go or F5)
For step-by-step execution select source code window
by left clicking any where on the window and then
use function key F10 to debug / simulate the code
For Free running mode (Go Command), don’t forget
to enable Periodic Window Update in View Menu

You might also like