Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 15

HOW TO USE KEIL

Finally you have decided to write your own code for the 8051 microcontroller. It doesn't
matter whether you have chosen Assembly or C Language for yourself but what matters
now is that you need an environment specially designed for 8051. Basically you are
looking out for IDE (Integrated Development Environment) that will help you build and
compile programs. While there are many options out there, I prefer KEIL uVision in
this regard.

KEIL IDE is basically an assembler and a compiler or whatever you name it. You can
write either an Assembly or C language code and KEIL will take care of the rest for
you. Furthermore, it supports many of the 8051 variants that you will face. You can
download KEIL from their official website using the link below.
DOWNLOAD KEIL uVISION FOR 8051
After successful download and install, you may have problem getting familiar with it if
you're using it for the very first time but don't worry because I am here to give you a
graphical tutorial on how to use it for writing your program, compiling it, and finally
generating the HEX file.
Here we go

Create a new folder for project to avoid getting mixed up with files

PROJECT > NEW uVISION PROJECT

Give some name and click SAVE

when prompted, select proper device that you're using ( i-e ATMEL > AT89C51 )

When prompted, select YES

Click NEW button and write your code (Assembly or C language)

SAVE the file with proper extension as above

The code you have written gets highlighted

Right click SOURCE GROUP 1 as shown

Add the code you have written into the Project workspace

Go to options for the project

Enable HEX file generation

Build the project

Notice successful build. Ignore the warnings

Use this HEX file to program your IC


These are the simple steps for a successful compilation and generation of HEX file.
Now I hope you have created your first HEX file and ready to program it to the 8051.
And you know how to do that, right? If your answer is no then please check this out.
UPDATE:
If you have trouble understanding the pictures then here is a video of the same process
that I made. Hope you get a better view this time

Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest


Labels: keil, programming, software

15 comments:

1.
KingAhmad8/05/2013 11:07 pm
I'm trying to generate a random number in C language using keil 4 C51. I'm
using rand() and appropriate header files that we use in ordinary C compiler. A
random number is generated in ordinary c compiler but not in keil 4... Please
help me to resolve this!
Reply
Replies

1.
805112/15/2013 4:38 pm
Sorry for the delay. For some reason, your comment had moved to
SPAM section :(
Well I haven't checked Random Number Generation in 8051 myself but I
could give you an appropriate suggestion :
Forget about using the C header files for random number generation in
8051. You can always use the timers for the same purpose. Depending on
the range, you can either go for 8bit mode (0-255) or 16bit mode (065535). Reading the timer/counter value at any instant will give you a
random number in that range depending on it's state at that time.
The only trick is that if you want a specific range for Random Number
Generation, you will have to write your own algorithm for manipulating
the above basic procedure for that range.
(hint: keep reading the timer/counter value until it returns some number
within that range)
Reply

2.
Abdul Haseeb12/15/2013 3:43 pm
(y)
Reply
Replies

1.
805112/15/2013 4:24 pm
:)
Reply

3.

Ravi chaudhari2/06/2014 11:36 pm


Great work but why my u vision is not showing any AT89CXXX file in atmel
part... please he me with this...and please upload or send me your u vision by
mail Ravichaudhari712@gmail.com or FB.com/rvch7 please help...You are
Great..!!
Reply
Replies

1.
80512/07/2014 12:08 pm
Are you using the latest version?

2.
80512/07/2014 12:21 pm
Check your inbox Ravi
Reply

4.
Bala Murugan2/16/2014 8:45 am
hi admin, you just write in .hex code procedure, bt i want to program in C
language means ?wat i do ? wil u explain the procedure ??
Reply
Replies

1.
80512/16/2014 5:28 pm
I also upload the program code where necessary. You can check my posts
about interfacing such LED, SWITCH, KEYPAD etc and read the
program code with it. I have properly commented it so you can have an
idea of what's happening.
If you want to properly learn Embedded C language for 8051, you must

refer to the book


"The 8051 Microcontroller and Embedded. Systems. Using Assembly
and C"
By Muhammad Ali Mazidi and Janice Gillispie Mazidi
Reply

5.
CoolOmya3/18/2014 11:33 am
hi sir, can you tell me how to check your code inside keil (i heard it is possible),
before burning i want to check weather the code is working accordingly or not....
Reply
Replies

1.
80513/18/2014 9:17 pm
You can always debug your code in Keil which will help you analyse
your code in a stepwise fashion. I have already posted about debugging
in Keil, check the link below
Debugging in Keil
Reply

6.
Anonymous5/17/2014 5:41 pm
I have just started to learn 8051 microcontroller and at the end of the semester I
have to submit a project on embedded system . for that what will be the best
project ?can you give me any advice?
Reply
Replies

1.

80515/17/2014 8:37 pm
I'm afraid I can't tell you about the 'best' project :) because every project
is unique and has some usefulness in its own way. However you can
check out this list of projects based on 8051 microcontroller. Maybe you
can grab yourself the 'best' one ;)
Projects based on 8051
Reply

7.
CHINMAYEE7/16/2014 2:03 pm
sir,
i m persuing my btech fourth year .i dont know any basics about keil software
but we are supposed to do a project on 8051 mc which need this software to
write the programm could u please sujjest us how could we get our program
sucess
my project is "ZIGBEE BASED GENSET CONTROLL SYATEM".
Reply
Replies

1.
80517/17/2014 5:48 pm
It becomes easier if you divide your project into smaller parts and verify
it in a stepwise fashion.
If you have no idea about KEIL or 8051, it would be a good idea to know
them first and work on some basic tasks. Then you can continue to tackle
your project requirements when you get the hold of it.

You might also like