Keil uVision is the IDE for the 8051, ARM and Cortex family controllers. In this tutorial, we will guide how to compile a program for 8051 using Keil.
Let’s Code with Keil
For demo we will compile the program of LED Blinking.
Create a folder “LED_BLINK”. Create two sub-folders as shown in below image. One folder will be used for Program and another one will be used for Schematic.
To write a program, we will use Keil uVision3 (Other versions also have similar procedure with minor or no changes). Open the software from the installed directory.
Click on Project > Close Project to close previously created project (if any).
Create a new project from the option Project > New uVision Project
Provide a name of the project and path of the location where you want to create it.
Select your micro-controller. You can select Intel > 8051AH for all basic applications. Select controller and click on OK.
Keil will ask whether to add STARTUP.A51 file or not. This file is required for “C” programming. So click on YES to add the file to the Source Group.
Create a file to write our program from File > New Menu or use Ctrl+N Shortcut.
Save the file name with .c extension. For e.g. LED_BLINK.c
Write the program and save the file. (Program is available in code section).
Add the .c file to group source. For that Right click on Source Group1 > Add Files to Group ‘Source Group 1’
Browse the required .c file and click on ADD.
Click on Build target from Toolbar or Press F7 Key.
At bottom of the screen, check the result of build operations. Corrects the errors if any.
Go to Options For Target1 > Output.
Go to output TAB. Tick the checkbox marked as Create Hex File.
Click on OK.
Rebuild target to create hex file. This will create the hex file in the folder where we have created the project.
Now we can use the hex file for simulation on Proteus or else we can load it to a controller and test it…!!
Hope you have enjoyed the first step towards learning 8051…!!
Keep learning ... Keep Creating...
If you face any issues, we are just a click away to help you…!! Post your query on ASK US section.