8051 – Create a Project

Hi All… Today we will see How to create a project in Keil IDE.

In the last post, we have seen how to install Keil IDE to develop 8051 projects. If you aren’t seen that please see that by clicking here. If you want to see the Introduction of Embedded system and 8051 please click here.

So today we are going to create the project in Keil. I have shown step by step process of creating a single project with images. Here we go.

How to create a project in Keil IDE

1. Open the application that we installed previously by double click.

2. After opening just click the project. That I’ve mentioned with a red circle.

3. Then click New Project

4. Create the folder (directory) where ever you want to save the project. Then give the project name. In my case, I gave first_project as my project name. You can give it whatever name you want. Then click the save button.

5. After saving that project this window will pop up. So here we need to select our microcontroller. Our case is 8051. Just scroll down and find Atmel.

6. Double click the Atmel. Then again scroll until you found AT89C51.

7. Click AT89C51 and click ok.

8. Click Yes. It will add the startup code to the project.

9. So until now we have created the project for the 8051 microcontrollers.

10. Project has been created. Now we need to create the file to edit our code. Click File then click New.

11. We created a file to edit our code.

  1. Now we are going to save our code. Click File and Save.

  1. Give the code name. Here I’m giving just code.c. You can give whatever you want. But you should mention with .c. Because this is C language code (Embedded C).

14. So now our project name is first_project and the code name is code.c.

15. As of now we have created the project and code. But now we have to put the code inside the project. For that double click the Source Group1.

16. It will pop up in your project folder. Find your code. In our case, we can see code.c there. So click code and click Add.

17. See there our code is added to the project (Source Group1). Then click Close.

18. In that file you can edit your code. This is a demo. So I entered only the main function and header file. Nothing in that code. So it won’t do anything in the 8051. In this code section, you have to write your project code based on the application you need.

19. After editing your code we have to set the clock frequency. So click Project and Options for Target ‘Target 1’.

20. It will pop up in one window. There find the Xtal(MHz). In that box enter 11.0592. Do you have any guesses why should we enter this value? Because 8051’s clock frequency is 11.0592MHz.

21. After that click Output. There find Create HEX file. Then check that box. Then click Ok. Why do we need to select this Create HEX file? We can’t flash our code or project into the 8051 microcontrollers. We have to flash the hex file. If we enable this we can get the hex file whenever we build our project.

22. Now I’m going to build my project. The shortcut is F7.

23. After building you can see the error and warnings at the bottom of the window.

24. Open your project folder. Find the hex file. That is the final file that is going to flash into the 8051. you can flash this hex file using any flasher with the proper setup.

In our next post, we will see how to interface the LED with 8051 (GPIO).

You can also read the below tutorials.

Linux Device Driver TutorialsC Programming Tutorials
FreeRTOS TutorialsNuttX RTOS Tutorials
RTX RTOS TutorialsInterrupts Basics
I2C Protocol – Part 1 (Basics)I2C Protocol – Part 2 (Advanced Topics)
STM32 TutorialsLPC2148 (ARM7) Tutorials
PIC16F877A Tutorials8051 Tutorials
Unit Testing in C TutorialsESP32-IDF Tutorials
Raspberry Pi TutorialsEmbedded Interview Topics
Reset Sequence in ARM Cortex-M4BLE Basics
VIC and NVIC in ARMSPI – Serial Peripheral Interface Protocol
STM32F7 Bootloader TutorialsRaspberry PI Pico Tutorials
STM32F103 Bootloader TutorialsRT-Thread RTOS Tutorials
Zephyr RTOS Tutorials - STM32Zephyr RTOS Tutorials - ESP32
AUTOSAR TutorialsUDS Protocol Tutorials
Product ReviewsSTM32 MikroC Bootloader Tutorial
VHDL Tutorials
Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments