Keil Setup For 8051
In this tutorial we see how to setup Keil4 for generating .hex file.
Keil software can be downloaded from this link.
Download and install the Keil C51 for 8051.
Keil Setup Steps
Step1: Open the Keil software and select the New Microvision project from Project Menu as shown below.
Step2: Browse to your project folder and provide the project name and save it.
Step3: Once the project is saved a new pop up “Select Device for Target” opens, Select the required 8051 series controller and click on OK.
- Atmel->AT89s52
- NXP->P89V51RD2
- Nuvoton-> W78E052D
Since all the controller follow the same 8051 architecture, any of the above mentioned controller can be selected.
Step4:Select Atmel->At89s52 and click OK.
Step5:8051 doesn't need the startup code, click on NO option to proceed.
Step6: Create a new file to write the program.
Step7: Type the code or Copy paste the below code snippet and save the file as main.c
#include <reg51.h> | |
void DELAY_ms(unsigned int ms_Count) | |
{ | |
unsigned int i,j; | |
for(i=0;i<ms_Count;i++) | |
{ | |
for(j=0;j<100;j++); | |
} | |
} | |
int main() | |
{ | |
while(1) | |
{ | |
P0 = 0xff; /* Turn ON all the leds connected to Ports */ | |
P1 = 0xff; | |
P2 = 0xff; | |
P3 = 0xff; | |
DELAY_ms(500); | |
P0 = 0x00; /* Turn OFF all the leds connected to Ports */ | |
P1 = 0x00; | |
P2 = 0x00; | |
P3 = 0x00; | |
DELAY_ms(500); | |
} | |
return (0); | |
} |
Step9:Add the file to the project using the option Add files to Source Group.
Step10: Add the recently saved file to the project.
Step11:Now the main.c file should appear in Project Source Group.
Step12:Build the project and fix the compiler errors/warnings if any.
Step13:Code gets compiled with no errors and .hex file is still not generated.
Enable Hex File Generation
Step14:Click on Target Options to select the option for generating .hex file.
Step15: Rebuild the target to generate the .hex file.
Step16: Check teh project folder for generated .hex file.
Uploading the Hex file
After generating the .hex file check the below tutorials for uploading it.
Have a opinion, suggestion , question or feedback about the article let it out here!

8051 Development Board Setup
The Explore Ultra 8051 Kit comes with all the things required, not just for this experiment but for the entire series. The base board is fully open, no peripheral is directly connected to the MCU breakout...
Keil Setup For 8051
In this tutorial we see how to setup Keil4 for generating .hex file. Keil software can be downloaded from this link. Download and install the Keil C51 for 8051. Keil...

Xplore Flash for At89s52
In this tutorial, we will see how to use XploreFlash for flashing the hex files to AT89s52. First, we will see how to install the XploreFlash software along with UsbAsp drivers and then continue...

5.8051 Timer programming
In this tutorial, we are going to discuss the Timer module of 8051. First, we will see what are timers, their working and later we will configure the 8051 timers to generate the delay of 100ms...