Step by step screenshots...
Step 1 - Open Keil IDE installed previously on your PC.
Step 2 - Create a New Project from Projet -> New -> uVision Project.
Step 3 - IDE will tell you to save the project and give it a name. Do it according to your convenience. Now keil will ask you to choose your target device. Choose your device either AT89S52 or P89V51RD2 or anyone else you are using.
If you are using P89V51RD2 it will be found under NXP
Step 4 - A window will open up asking for add up some startup files. Press NO.
Step 5 - Now make a new empty file.
Step 6 - Type in your source code in that empty file and save this file as main.c (not compulsory)
Step 7 - Add the main source file to your project by right clicking on left side bar over "Source Group1"
Step 8 - Make sure that main C source file is now added in your project.
Step 9 - By default keil compiler do not generate intel hex file on source compilation. So we need to configure it to produce Hex file as output.
Project -> Options for target target1
Check the Create hex file box
Step 10 - Now you are ready to compile source and generate the hex file.
The final output will look like this...
Now you can find the generated iHex file for the project in the same directory as in project lies.
Best viewed at Firefox 1024x768 resolution