first create a file header file. these usually do not need any other header file to be added in it, but if you declare any variables that is dependent of any other , then you have to include that header file in the header file you are creating. example
i have pins.h in this header file i use reg51.h as i use variables defined by other header file...
Sir i didnt get well ,that is .
where do i make it (note pad or in keil or anything ?)
Where it put ?(keils directory )
I want to call my own functions which are written in header file (my own)?
write it in keil by opening new file, or type it in notepad but save it as .h file and add it to keil project where all files are added.. and compile it with other files in the project window.......
store all these header files in the same folder where your .C files are stored...
Generally, header files are holding the data definitions and function prototypes that shall be shared by multiple source files. As other source files they can be created in any text editor or the Keil IDE's file editor. For simple "flat" projects, they are stored in the project directory. For complex projects with subdirectories, it's your choice.
The header file is just a text file with a .h extension, use any text editor to create it.
You can place it to your project folder or in the include path of your compiler, if you place it in the project folder then you can include it using #include "headername.h" or if it is in the include path #include <headername.h>
ckshivaram I will use your code to give an example of what I do
delay.h
Code C - [expand]
1
2
3
4
5
6
7
// the #ifndef prevents the file from being included more than once#ifndef __DELAY_H__ #define __DELAY_H__void delay(unsignedint);#endif /* __DELAY_H__
write it in keil by opening new file, or type it in notepad but save it as .h file and add it to keil project where all files are added.. and compile it with other files in the project window.......
store all these header files in the same folder where your .C files are stored...
The best thing is to simply open a "New" file in keil, Enter the required data(for header file) in the "New" file as advised by as ckshivram. Save as "delay.h" in the same directory. Compile. You will see the delay.h integrated in the Project directory as a file called "delay" without an extension but type as H. Avoid using another editor like notepad and add to keil.....ckshivaram ROCKS!!!!!!!