thannara123
Advanced Member level 5

Hi experts ,i want to know that how can i create Header file in keil please post step by step. thanks for all replays
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
/* Header file declaration */
#include<reg51.h>
/* SFR declaration */
sfr lcd=0x90;
/*single bit declaration */
sbit RS=0x90;
sbit EN=0x91;
sbit relay=P3^7;
void lcd_cmdwrt(unsigned char cmd);
void lcd_datawrt(unsigned char *);
void dat(unsigned char);
void lcd_init();
void delay(unsigned int );
/* Header file declaration */
#include<lcd.h>
#include<pins.h>
#include<string.h>
void main()
{
lcd_init(); //To initalise the lcd
while(1) //infinity loop
{
lcd_cmdwrt(0x01); //clear on lcd
delay(10);
}
}
void delay(unsigned int );
#include<delay.h>
void delay(unsigned int sec)
{
unsigned int i,j;
for(i=0;i<sec;i++)
for(j=0;j<1500;j++);
}
#include<delay.h>
#include<reg51.h>
main()
{
delay(100);
}
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(unsigned int ); #endif /* __DELAY_H__
Code C - [expand] 1 2 3 4 5 6 7 8 9 #include <delay.h> void delay(unsigned int sec) { unsigned int i,j; for(i=0;i<sec;i++) for(j=0;j<1500;j++); }
Code C - [expand] 1 2 3 4 5 6 7 8 #include<delay.h> #include<reg51.h> main() { delay(100); }
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...