8051 Microcontroller Lab Tutorial
8051 Microcontroller Lab Tutorial
After you have installed the Keil uVision tools for 8051 ,Double click
on the Keil icon on your Windows Desktop to launch the IDE.
To create a new 8051 project using Keil IDE, Click on the ' Project '
item on the IDE Menu bar and select ' New uVision Project... ' as
shown in the above image.
Now create a Folder to store your project and give a name to your
Project files (*.uvproj), for eg Test (Test.uvproj).
You will then be taken to the device selection dialog, where you can
select the 8051 derivative for which you want to develop software.
Keil has support for a wide variety of 8051 derivatives on its IDE.The
8051 derivatives are organised according to their manufacturer's.
Step 4:
LAB TUTORIAL FOR 8051 MICROCONTROLLER
Step 5:
LAB TUTORIAL FOR 8051 MICROCONTROLLER
Now your Project pane on the Kiel IDE would look something like this
(above image)
Step 7:
LAB TUTORIAL FOR 8051 MICROCONTROLLER
Now you can select the type of file you want to add to your project
using the top pane.
Now you can type a small program into the main.c to blink the LED's
connected to Port 1 of 8051 .You can find the sourcecode below.
#include <reg51.h>
void delay(void);
void main(void)
while(1)
{
LAB TUTORIAL FOR 8051 MICROCONTROLLER
P1 = 0xFF; // Turn ON all LED's connected to Port1
delay();
delay();
void delay(void)
int i,j;
for(i=0;i<0xff;i++)
for(j=0;j<0xff;j++);
}
LAB TUTORIAL FOR 8051 MICROCONTROLLER
After you have typed out the above c program to your main.c file,You
can compile the C file by pressing F7 key or by going to ' Project ->
Build Target ' on the IDE menu bar.
Step 9:
If there are no errors the code will compile and you can view the
output on the Build Output pane.
LAB TUTORIAL FOR 8051 MICROCONTROLLER
In Keil uVision IDE you can generate hex file for your 8051 derivative
by, Right Clicking on the ' Target 1 ' Folder and Selecting Options for
Target 'Target1'....
Step 11:
LAB TUTORIAL FOR 8051 MICROCONTROLLER
You can open the Test.hex file with notepad to view the contents after
creation.