CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

how create library

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
hamid9543



Joined: 31 Jan 2013
Posts: 63

View user's profile Send private message

how create library
PostPosted: Wed Jan 08, 2014 9:19 am     Reply with quote

Hi, how create library (.h file) in ccs compiler?
Thx
Ttelmah



Joined: 11 Mar 2010
Posts: 19561

View user's profile Send private message

PostPosted: Wed Jan 08, 2014 9:36 am     Reply with quote

Type it......

.h files are just include files. Plain text. Can be edited with any text editor.

A genuine 'library' (.o file), is rarely used in CCS. The compile speed is so high, compared to the size of code that fits in most PIC's that 'pre-compiling' sections doesn't gain much, and unfortunately _reduces_ the ability to optimise RAM/ROM use, often resulting in larger final code, and less spare RAM. Since memory is normally a 'precious' resource on the PIC's this is best avoided.

You can generate a .o file, and an associated .h file, but then the answer is the same. Type it. You would need to generate a .c file that is compiled to generate the .o file, and definitions of the functions that go into the .h file.

Examples of this are with the compiler. In the 'examples' directory, there is a 'mcu.zip' file, that expands into a project showing the .c files for three parts, and the main file including the .h files and linking the pre-compiled sections.

Best Wishes
hamid9543



Joined: 31 Jan 2013
Posts: 63

View user's profile Send private message

PostPosted: Wed Jan 08, 2014 10:12 am     Reply with quote

Hi. I think you couldn't undrestand what i mean. I want to creat a header in CCS. For example I have a hardware like a sensor or LCD then I try to build a library for them. Please give me a solution.
Thanks a lot.
temtronic



Joined: 01 Jul 2010
Posts: 9253
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Jan 08, 2014 10:43 am     Reply with quote

comment: words mean different things to different people.
To me you want a 'driver'. A chunk of code designed to control/interface with a device or peripheral.An LCD module is a great example. I use the 'flex_LCD.C' code but have renamed it to my_flex_LCD.dvr.It is a copy of the original,modified to suit me, and the extension dotDVR designates it's a 'driver'.
I also have a pictype_fuses.fuz 'header' file to configure the fuses for a known PIC.ie: 46k22_fuses.fuz is my 'header' file with a set of known good fuses. As there are a LOT of fuse on modern PICs, it reduces the size of the project 'main' as well eliminates problems due to bad typing!

CCS does provide a LOT of 'drivers' for various internal and external peripherals. These are located in the 'drivers' folder.


hth
jay
Ttelmah



Joined: 11 Mar 2010
Posts: 19561

View user's profile Send private message

PostPosted: Wed Jan 08, 2014 12:41 pm     Reply with quote

My answer stands. Type it.... Smile

This is a _help_ forum, not a 'write it for you' forum.

You need to start with the data sheet for the device. Then see if there are any other _similar_ devices. If there are, look in the CCS drivers (and here), and see if somebody has done it already, either for your device, or the similar device (code forum in particular).

Probably 75%+ of devices use similar interfaces. SPI, I2C, or simple shift and latch type interfaces. If so, then dozens (hundreds) of existing drivers will exist that you can use.

Once you get close, then we can/will help to spot the problems (hopefully), and point you towards a solution.

Best Wishes
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group