Guide to Installation and use of keil µVision2 Software

Install from: keil7_setup setup setup.exe

Select ³Full Version´

Enter Serial Number


Browse for add-on¶s Path .

Path is: keil7_setup addon c51 addon .

Check (¥) Install Security key driver Next .

c will be opened automatically as you run the software for the first time. Close this project from: Project menu Close Project . A project named ³Hello´ containing file HELLO.Now setup is complete and keil µVision 2 is Installed on your PC. Run the software from the short-cut on your desktop.

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´) .

a device selection window will automatically appear as shown on the next slide .Now Save the project by clicking on the ³Save´ button As you click on the Save button.

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 .

"while(1)" loop. It must loop and execute forever. // Sends High and Low on alternate Pins of Port 0 // Sends High and Low on Port 0 in reverse order { } } .h> void main (void) { while(1) /* special function register declarations */ /* for the intended 8051 derivative */ /*-----------------------------------------------Note that an embedded program never exits (because there is no operating system to return to). So. P0=0x55.Now write the following simple c program in the text file #include <reg51. ------------------------------------------------*/ P0=0xaa.

All text between /*¶ and */¶ or followed by //¶ is not part of the code and is just comments / documentation .Program is written.

c) extension .Now save the file from: File Menu Save as File Name Note that the file name must be written with dot c (.

Also note that the moment we save the Text* file (with ³.asm) extension. the file must be saved with dot asm (.c´ or ³´.asm´ extension).Note: In case the Program is written in assembly language. 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 .

but both Project and source code files exist separately. we have to add source code file into the Project . As shown by empty Source Group folder.c in this example) and saved it with dot c extension. So.We have created a project named ³First´ and also written a program in C language (LEDs.

Right Click on: Source Group Click: Add files to Group ³Source Group 1´ Right Click .

. Add and Close. Select .A window showing source code files will appear.

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 .

or less .0) b) and Code Rom Size to Small program 2K.0592 MHz (replacing 24. to 11. under Target Tag a) Edit Xtals Freq.In Options for Target Window.

under Output Tag Check (¥) the Create Hex File Check Button Click to Check .Similarly.

Project Build Project or Use Short-cut .Now Project is complete with all necessary settings and is to be built (Compiling and Linking Process) So.

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«. The default location of the hex file is same as that of the project i.´ 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. our own created directory.e. .

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 .