Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

How to add library function to keil library ?

Status
Not open for further replies.

bikas.bikun

Junior Member level 3
Joined
Nov 22, 2010
Messages
25
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
pune
Activity points
1,443
i want to add a function let delay.h to keil library, so hoe can i do so ?

can any body do this ?

please tell me the procedure.
 

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,146
Reputation
4,298
Reaction score
2,087
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
you can del\velop codes with different header files example
for LCD routine develop lcd_init(), lcd_delay(), lcd_clear(), lcd_data
for i2c routine develop i2c_start(), I2c_write(), i2c_read(), i2c_ack(), i2c_stop() etc like this

---------- Post added at 09:46 ---------- Previous post was at 09:38 ----------

let say we want to make a header file for an lcd then

LCD.h file will have

#ifndef __LCD__ // it check that is this name of file exist or not if not exist
#define __LCD__ // then genrate a file else not generate
now in headerfile u can do a lot of things every type of definations lest say port and bit assignment for LCD
typedef unsigned char bit_8;

#define lcd_port P1
sbit rs=P3^5; // register select is port 3.5
sbit rw=P3^4; // read/write is port 3.4
sbit en=P3^3; // enable is port 3.3
sbit d7=P1^7;

Function Prototypes
void ini(void);
void command(bit_8);
void data_in(bit_8*);
void busy(void);

some macros

#define DISABLE_INT IE=0x0;
#define ENABLE_INT IE=0x81;

#endif

now u can create a c file coding that uses these definations let say that is lcd.c
So lcd.c will have
then that file contains functions body
for examole

#include "LCD.H"

/*--------------------------
*** initialising the LCD ***
--------------------------*/

void ini()
{
command(56);
command(12);
command(1);
command(6);
command(0x80);
}

/*----------------------------
*** checking the busy flag ***
----------------------------*/

void busy()
{
d7=1;
rs=0;
rw=1;
......
}

and other functions of your program
 

bikas.bikun

Junior Member level 3
Joined
Nov 22, 2010
Messages
25
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
pune
Activity points
1,443
I got to create a header file, but where to place it and add it to library, and where its (Lcd.c) file will be stored?

I mean what procedure I need to follow to add this header file to add to KEIL library, so that further I can include this file in my projects code.
 

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,146
Reputation
4,298
Reaction score
2,087
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
you cant add it to keil library. in the project window you have to add these header files and maintain it in the same folder.....

you can just create a user library....

you can also put it in the header files folder you see in the C:\Keil\ARM\INC or in in the uv2 library..
 

bikas.bikun

Junior Member level 3
Joined
Nov 22, 2010
Messages
25
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,283
Location
pune
Activity points
1,443
actually i have kept that in the C:\Keil\ARM\INC location,but while i am trying to use the function i can't.

can you please tell me why so ?
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top