Skip to main content

Learning about 8051 simulator like keil micro-vision.

Aim: 

To study about Keil simulator.

Apparatus: 

A computer loaded with Keil Microvision2 or higher version.

Procedure: 

   
                   If we want to develop embedded system program for 8051 using Keil software, we need to follow these steps.   
1. Create work directory.
2. Create a new project.
3. Create source files(.alp or .c).
4. Add files to project.
5. Compilation and error checking.
6. Debugging and output verification.
7. Creation of HEX file.
8. Burn the project(HEX file) into ROM of the target device.

1. Create work directory:

  • Go to my computer.
  • Open local disk: D.
  • Create a new folder.
  • Rename with the desired name.
  • That is our work directory. 

2.Create a new project:    

  • Go to project menu in Keil. Select new project.   
  • Click on Atmel.
  • Select AT89C51 or AT89C52 or AT89S51 or AT89S52.
  • Select ok.
  • Next press yes.
NOTE: Give the project name and work folder path properly.
                                                                   Keil Environment

3. Creation of source file:    

  • Go to file menu.
  • Select new.
  • Write the program.
  • Save with the desired name(.ASM or .C).
 Example program

#include<stdio.h>
#include<reg51.h>
main()
{
while(1)
{
if (P0==0X00)
P2=0X5A;
else
P2=0XF0;
}
}

4. Add files to project.

  • In project workspace window, Right click on souregroup1.
  • Select add files to sourcegroup1.
  • Select the source file.
  • Press ok.
  • Now the tree is added to our project.
NOTE: At a time two source files are not compiled.

5. Compilation and error  checking:

  • In workspace window right click on the source file.
  • Select build.
  • In output window errors and warnings are shown.
  • If no errors and no warnings, Go ahead.
  • Else re-edit the program.

6. Debugging and output verification:

  • Go to debug menu.
  • Select start/stop debug session.
  • Open required peripherals in the peripheral menu like ports, counters, timers etc,. 
  • By using debug controls like the stepin, stepout, run or go etc,. , you can see the output. 
  • If you satisfied with the output, Go ahead else repeat editing.

7. Creation of HEX file:

  • Click on the option for the target.
  • Give clock frequency of 11.0592MHz.
  • In the output, select create HEX file option.
  • Press ok.
  • Rebuild target.
  • The HEX file is created in work directory.
  • If you want to see, open with notepad or WordPad.
  • By using an emulator like flashmagic or iprogrammer or unipro, we can burn HEX file into target device to see the output on the hardware device.  

Result: 

Studied about Keil simulator.           

Comments