Keil Software Programing Procedure.doc (Size: 1.41 MB / Downloads: 247)
KEIL SOFTWARE PROGRAMING PROCEDURE
How to write Embedded C Program in Keil Software.
Install Keil MicroVision-2 in your PC, Then after Click on that “Keil UVision-2” icon. After opening the window go to toolbar and select Project Tab then close previous project.
Next select New Project from Project Tab.
Then it will open “Create New Project” window. Select the path where you want to save project and edit project name.
Next it opens “Select Device for Target” window, It shows list of companies and here you can select the device manufacturer company.
For an example, for your project purpose you can select the chip as 89c51/52 from Atmel Group. Next Click OK Button, it appears empty window here you can observe left side a small window i.e, “Project Window”. Next create a new file.
From the Main tool bar Menu select “File” Tab and go to New, then it will open a window, there you can edit the program.
Here you can edit the program as which language will you prefer either Assembly or C.
After editing the program save the file with extension as “.c” or “.asm”, if you write a program in Assembly Language save as “.asm” or if you write a program in C Language save as “.c” in the selected path. Take an example and save the file as “test.c”.
Then after saving the file, compile the program. For compilation go to project window select “source group” and right click on that and go to “Add files to Group”.
Here it will ask which file has to Add. For an example here you can add “test.c” as you saved before
After adding the file, again go to Project Window and right click on your “c file” then select “Build target” for compilation. If there is any “Errors or Warnings” in your program you can check in “Output Window” that is shown bottom of the Keil window.
Here in this step you can observe the output window for “errors and warnings
If you make any mistake in your program you can check in this slide for which error and where the error is by clicking on that error
After compilation then next go to Debug Session. In Tool Bar menu go to “Debug” tab and select “Start/Stop Debug Session”.
Here a simple program for “Leds Blinking”. LEDS are connected to PORT-1. you can observe the output in that port.
To see the Ports and other Peripheral Features go to main toolbar menu and select peripherals.
In this slide see the selected port i.e, PORT-1.
Start to trace the program in sequence manner i.e, step by step execution and observe the output in port window
After completion of Debug Session Create an Hex file for Burning the Processor. Here to create an Hex file go to project window and right click on Target next select “Option for Target”.
It appears one window; here in “target tab” modify the crystal frequency as you connected to your microcontroller.
Next go to “Output’ tab. In that Output tab click on “Create HEX File” and then click OK.
Finally Once again compile your program. The Created Hex File will appear in your path folder