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.
- Now we are going to save our code. Click File and Save.
- 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
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.
Embedded Software | Firmware | Linux Devic Deriver | RTOS
Hi, I’m SLR. I am a tech blogger and an Embedded Engineer. I am always eager to learn and explore tech-related concepts. And also, I wanted to share my knowledge with everyone in a more straightforward way with easy practical examples. I strongly believe that learning by doing is more powerful than just learning by reading. I love to do experiments. If you want to help or support me on my journey, consider sharing my articles, or Buy me a Coffee! Thank you for reading my blog! Happy learning!