0% found this document useful (0 votes)
237 views14 pages

8051 Microcontroller Lab Tutorial

This document outlines steps for creating an 8051 microcontroller project in Keil uVision IDE, including: 1. Downloading and launching the Keil IDE 2. Creating a new project and selecting an 8051 device 3. Adding and compiling a source code file to blink an LED 4. Generating a hex file and viewing it to download to the microcontroller

Uploaded by

satyanarayana12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
237 views14 pages

8051 Microcontroller Lab Tutorial

This document outlines steps for creating an 8051 microcontroller project in Keil uVision IDE, including: 1. Downloading and launching the Keil IDE 2. Creating a new project and selecting an 8051 device 3. Adding and compiling a source code file to blink an LED 4. Generating a hex file and viewing it to download to the microcontroller

Uploaded by

satyanarayana12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

LAB TUTORIAL FOR 8051 MICROCONTROLLER

Step 1: Downloading Keil U


Vision IDE

Step 2: Creating a 8051/8052 Project Using Keil


Uvision IDE
LAB TUTORIAL FOR 8051 MICROCONTROLLER

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).

Step 3: Selecting an 8051 Device in Keil


LAB TUTORIAL FOR 8051 MICROCONTROLLER

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.

On selecting the particular microcontroller the Keil IDE also displays


the features of the selected microcontroller on its left pane .You can
Click OK to confirm your choice.

Step 4:
LAB TUTORIAL FOR 8051 MICROCONTROLLER

After selecting your 8051 derivative,

You will get another dialog as shown Above.Asking to copy


STARTUP.A51

Click ' Yes '

Step 5:
LAB TUTORIAL FOR 8051 MICROCONTROLLER

Now your Project pane on the Kiel IDE would look something like this
(above image)

Step 6: Adding C Files to Keil Project


LAB TUTORIAL FOR 8051 MICROCONTROLLER

Now you can add C files to you Project.

Right Click on the Source Group 1 folder on your Project pane and


select Add New Item to Group 'Source Group1'...

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.

Select C File(.c) and give it a name (here main.c) and Click Add.

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();

P1 = 0x00; // Turn OFF all LED's connected to Port1

delay();

void delay(void)

int i,j;

for(i=0;i<0xff;i++)

for(j=0;j<0xff;j++);

}
LAB TUTORIAL FOR 8051 MICROCONTROLLER

Step 8: Building a C Project Using Keil UVision IDE

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

Step 10: Generating 8051 HEX File Using Kiel IDE

Inorder to download the code into the 8051 microcontroller we have to


generate the corresponding hex code .

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

Then on the Options for Target ' Target 1' Dialog ,

Select the Output tab and check the Create Hex File option and


Press OK.

Now rebuild your project by pressing F7.


Kiel IDE would generate a hex file with same name (here Test.hex) as
your project in the Objects folder .

Step 12: Viewing the Generated Hex File

You can open the Test.hex file with notepad to view the contents after
creation.

Step 13: Downloading HEX Code Into 8051


LAB TUTORIAL FOR 8051 MICROCONTROLLER
Uploading hex code is specific to the 8051 derivative you are
using.For example some microcontrollers like P89V51 and Nuvoton
W78E05D have build in boot loader which can upload hex code
through their serial port.
LAB TUTORIAL FOR 8051 MICROCONTROLLER

Steps to upload HEX code to microcontroller


1. Download ProgISP, which is a zip file. Extract it in a folder. No need to install it, it is a
self-executable software, click on progisp.exe to launch it.
2. USBASP should be connected to the AVR microcontroller development board using
the 6 pin connectors. Make sure jumper J1 is connected.
3. Check the program state in the progisp interface, it should show colored icons of
USB and ASP or else if it is faded then look for errors in connections, power supply or
jumper connection.
4. Select the type of chip you are working within our case it is AT89S52.
5. In the task, windows look for the following to be checked with a tick.
o Verify Signature
o Chip Erase
o Program Flash
o Verify Flash
6. Click on load flash from the leftmost tab, this tab is used to load the hex file. Click on
the tab and locate the hex file.
7. Now click on Auto to begin the burning process. All the options which you have
ticked from the task box will be performed during the process.
LAB TUTORIAL FOR 8051 MICROCONTROLLER
8. Your code is successfully transferred to the microcontroller.
9. In order to erase the code, untick all options from task box except Chip Erase.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy