Friday, 22 February 2013

CREATING HEX FILE USING KEIL uVISION4

Hello Folks,

Here is a guide to prepare a HEX file using KEIL uVision 4.

First and foremost, install Keil for 8051 on your computer. You can download the software at  http://keil.com/downloads

Go to the Start Menu of your Windows OS. Type in KEIL and select KEIL uVision.

Once the software is launched. Have a look at your workspace. It should look something like this.

Now you are ready to go.

Click on Project and select New uVision Project.


Give a name to your project. Can be anything, let me name it as sampleproject.

Once you have named your project. Now is the time to select your device. For 8051, select ATMEL and then select AT89C51.

Now, KEIL will ask, whether you would like to copy 'STARTUP.A51' to project folder. Select Yes.





Now is the time to write the code. Before writing the code, create a new ".C" file. Go to the File menu, and select "New".




A writing pad will open. Write down your code in it.




Once the code is written, we need to save the file. Go to the File menu and click on Save As.




Let's save the file as sampleproject.c
Do not forget to give the file an extension .c
Remember KEIL can be used to compile assembly as well as C Codes. As a tip, in case you have written down the code in Assembly, you need to save the file with a .asm extension.

Now, we need to compile the code, or so to say, "Build the Target". Before doing that, we need to do some settings.

Go to the Project menu and select Options for Target 'Target 1'

A dialog box will open. Select the Output menu and check on Create HEX file option.

Unless you check on this option, HEX file shall not be created.





Now, only one step remains. We need to Build the Target. Click on the Project Menu, and select Build Target.


And, your HEX file is created. Remember, the HEX file shall be created in he same folder, where your .c file is.

Hope you understood the simple steps involved in creating a HEX file using KEIL uVision4.

Happy Learning!