Date post: | 09-Apr-2018 |
Category: |
Documents |
Upload: | asma-mushtaq |
View: | 232 times |
Download: | 0 times |
of 40
8/8/2019 Keil uVision Tutorial
1/40
Guide to Installation and useof keil Vision2 Software
8/8/2019 Keil uVision Tutorial
2/40
Install from:
keil7_setup setup setup.exe
8/8/2019 Keil uVision Tutorial
3/40
Select Full Version
8/8/2019 Keil uVision Tutorial
4/40
Enter Serial Number
K1RIP-M2192-KO14E
8/8/2019 Keil uVision Tutorial
5/40
Browse foradd-ons Path
8/8/2019 Keil uVision Tutorial
6/40
Path is: keil7_setup addon c51 addon
8/8/2019 Keil uVision Tutorial
7/40
Check () Install Security key driver Next
8/8/2019 Keil uVision Tutorial
8/40
Now setup is complete and keil Vision 2 isInstalled 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 thesoftware for the first time.
Close this project from:Project menu Close Project
8/8/2019 Keil uVision Tutorial
9/40
Close Project Hello
8/8/2019 Keil uVision Tutorial
10/40
Now you have Keil Vision IDE
8/8/2019 Keil uVision Tutorial
11/40
To Create your own Project go to:
Project Menu New Project
8/8/2019 Keil uVision Tutorial
12/40
Create your own Project after creating newproject folder/directory at your desired location
Your Project Name(will automatically get the extension .uv2)
Your Project / Working Directory Use to set location and create new folder
8/8/2019 Keil uVision Tutorial
13/40
Now Save the project by clicking on the Savebutton
As you click on the Save button,a device selection windowwill automatically appear
as shown on the next slide
8/8/2019 Keil uVision Tutorial
14/40
Target Device (The microcontroller we will use) Selection.Expand (Click +) on Atmel
8/8/2019 Keil uVision Tutorial
15/40
Select: Atmel 89C51 OK
8/8/2019 Keil uVision Tutorial
16/40
Now create a New File from the short-cut buttonor from: File menu New
8/8/2019 Keil uVision Tutorial
17/40
A New Text* file will be created which will be oursource code file in the future
8/8/2019 Keil uVision Tutorial
18/40
Now write the following simple c program in the text file
#include /* special function register declar/* for the intended 8051 derivative */
void main (void)
{while(1) /*------------------------------------------------
Note that an embedded program never exits (becausethere is no operating system to return to).It must loop and execute forever. So, "while(1)" loop.------------------------------------------------*/
{
P0=0xaa; // Sends High andL
ow on alternate Pins of Port 0P0=0x55; // Sends High and Low on Port 0 in reverse order}
}
8/8/2019 Keil uVision Tutorial
19/40
Program is written. All text between /* and */ or followed by // isnot part of the code and is just comments / documentation
8/8/2019 Keil uVision Tutorial
20/40
Now save the file from: File Menu Save as File NameNote that the file name must be written with dot c (.c) extension
8/8/2019 Keil uVision Tutorial
21/40
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
8/8/2019 Keil uVision Tutorial
22/40
Now click on + sign of folder Target 1 shown inProject Window on the left side of IDE
Project Window
Click toOpen
8/8/2019 Keil uVision Tutorial
23/40
A Source Group folder will appear containing nosource code file as shown
8/8/2019 Keil uVision Tutorial
24/40
We have created a project named First and alsowritten a program in C language (LEDs.c in this
example) and saved it with dot c extension, but bothProject and source code files exist separately. As
shown by empty Source Group folder.So, we have to add source code file into the Project
8/8/2019 Keil uVision Tutorial
25/40
Right Click on: Source Group Click: Add files to Group Source Group 1
RightClick
8/8/2019 Keil uVision Tutorial
26/40
A window showing source code files will appear.Select , Add and Close.
8/8/2019 Keil uVision Tutorial
27/40
The added file will be shown in Source Group folderin Project Window
Click to Open
8/8/2019 Keil uVision Tutorial
28/40
Now go to Project Menu Options for Target Target 1or simply right click Target 1 in Project Window
Options for Target Target 1
Right Click
8/8/2019 Keil uVision Tutorial
29/40
In Options forTarget Window, underTargetTaga) Edit Xtals Freq. to 11.0592MHz (replacing 24.0)b) and Code Rom Size to Small program 2K, or less
8/8/2019 Keil uVision Tutorial
30/40
Similarly, underOutput Tag Check () theCreate Hex File Check Button
Click toCheck
8/8/2019 Keil uVision Tutorial
31/40
Now Project is complete with all necessary settingsand is to be built (Compiling and Linking Process)
So, Project Build Project or Use Short-cut
8/8/2019 Keil uVision Tutorial
32/40
See the result ofBuild target command in the OutputWindow
Output Window
Successful building of Project andCreation of Hex file
8/8/2019 Keil uVision Tutorial
33/40
Creating hex file.line in the command windowshows that a hex file of the same name as that of the
project has been successfully created which can nowbe burnt into the microcontroller.The default location of the hex file is same as that
of the project i.e. our own created directory.
8/8/2019 Keil uVision Tutorial
34/40
Keil Vision Debugger
The Debugger of the keil software is used for software simulation
of the code before loading / burning it into the targetmicrocontroller
8/8/2019 Keil uVision Tutorial
35/40
Start Debugger from: Debug Menu Start / Stop Debug sessionor from short-cut on the debug tool bar
8/8/2019 Keil uVision Tutorial
36/40
Now to view Hardware/Ports status (Port 0 in our case), go toPeripherals I/O Ports Port 0
8/8/2019 Keil uVision Tutorial
37/40
Parallel Port 0window will appear showing the Dataon the Port
8/8/2019 Keil uVision Tutorial
38/40
We can simulate our code in 2 modes1) Step by step execution (Debug Step over or F10)
(2) Free Running mode (Debug Go or F5)
8/8/2019 Keil uVision Tutorial
39/40
For step-by-step execution select source code windowby left clicking any where on the window and thenuse function key F10 to debug / simulate the code
8/8/2019 Keil uVision Tutorial
40/40
For Free running mode (Go Command), dont forgetto enable Periodic Window Update in View Menu