Hi All…. Today we will see How to create 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 project in Keil IDE
1. Open the application which we were installed previously by double click.
2. After opening just click the project. That i’ve mentioned with red circle.
3. Then click New Project
4. Create the folder (directory) where ever you want to save the project. Then give project name. In my case i gave first_project as my project name. You can give whatever name you want. Then click 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 8051 microcontroller.
10. Project has been Created. Now we need to create the file for edit our code. Click File then click New.
11. We created file for 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 code name is code.c.
15. As of now we have created project and code. But now we have to put the code inside into 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 into the project (Source Group1). Then click Close.
18. In that file you can edit your code. This is demo. So i entered only main function and header file. Nothing in that code. So it wont do anything in the 8051. In this code section you have to write your project code based on your application you need.
19. After editing your code we have to set the clock frequency. So click Project and Options for Targer ‘Target 1’.
20. It will pop up one window. There find the Xtal(MHz). In that box enter 11.0592. Do you have any guess 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 we need to select this Create HEX file? We can’t flash our code or project into the 8051 microcontroller. 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. Shortcut is F7.
23. After built you can see the error and warnings in the bottom of the window.
24. Open your project folder. Find the hex file. That is the final file which is going to flash into the 8051. you can flash this hex file using any flasher with proper setup.
In our next post, we will see how to interface the LED with 8051 (GPIO).
You can also read the below tutorials.