Search This Blog

Friday, August 30, 2013

Creating header file in keil

Creating header file in keil :

        To develop a complex or a big project in keil we need to write more code so , as the number of lines increasing the complexity of editing the code is also increases so we need to optimize the code structure to access it easily. we can do so by creating header files. Header files mainly contains some functions which are called by main function and these header files may stored in the same folder or in another folder. if the header file and the project is in the same folder then  "#include<header_file_name>" is used to call a header file. if the header files stored in other location then "#include"path../header_file_name"" is used.

        Here is the simple procedure is shown about creating header file in keil is shown. you can find the clear view in video on creating header file in keil.

there are some steps for this, those are

step1:first create 3 folders with in out project folder and name them as 
      'APP','DRV','OUT'
     APP-is for our application file i.e., main files
     DRV-is for driver functions 
     OUT-is for output files

step2: create a project in keil and in the target option add 2 source groups and name them as 'APP','DRV'

step3:make delay.c and delay.h files as shown in the video 
      delay.c file having the function body and delay.h file having the function declaration
      save the both files in DRV folder

step4: now add delay.c file to DRV source group so that it will get compile along with main.c file

step5:go to 'Options for target'  the go to 'output' tab then click on 'folder for objects' and select OUT       
     folder

step6:then go to 'C51' tab and in 'include paths' add 'APP' and 'DRV' folders so that the compiler 
     searches the header file in that included paths

step7:add #include "delay.h" line in main file  and compile the code

follow the video for better understanding of creating header file in keil




Full


No comments:

Post a Comment