Steps For WRITING PROGRAM in Keil For 8051 Microcontroller

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

Using Keil 

uVision 5

1. Download and Install Keil uVision5

2. Open Keil uVision

3. Create a new Project: Project >> New µVision Project


4. Browse to the location of the folder created. Provide a filename & Save.
5. Select the microcontroller Atmel AT89C51 OK
 When you click on OK, another window will appear which will ask for “Copy Standard
8051 Startup Code to Project Folder and Add File to Project?” Click on YES to proceed
further.
6. To configure option value of our microcontroller project.
Select Flash configure flash tools


 Target tab to configure microcontroller.
From the ‘’Option for target ‘target 1” Select
Change the crystal value from 24 MHz to 12 MHz and go to output tab.

On the Options Window select the tab “OUTPUT”


Check mark the box “Create HEX file” and then click OK. This step is important & if you
forget check marking this box, no HEX file will be generated.
7. Now click on:
File New
FileSave
8. Now to add the C file to project, Right click Source Group 1 & click on “Add Existing
Files to Group “Source Group l”

Check the location of the folder. Provide a filename .C & ADD Close.
9. Enter the source code.
#include<reg51.h>
sbit led=P2^0; // led at PORT 2 pin 0
void Delay(void); // Delay function declaration
void main () // main function
{
led=0; //output PORT pin
while(1) // infinite loop
{
led = 1; // LED ON
Delay();
led = 0; // LED OFF
Delay();
}
}
void Delay(void) // delay function
{
int j;
int i;
for(i=0;i<10;i++)
{
for(j=0;j<10000;j++)
{
}
}
}

Save it

Then Compile it. Click Project>>Build Target or F7

The hex file will be generated in your Project Folder.


PROTEUS SIMULATION of LED Blinking
1st draw the Circuit diagram in proteus, and save it.

Double click on the ckt diagram

Search .hex file from the folder

Click ok
Click on Play

You might also like