Electronic Circuits and Projects Forum



how to include files

  1. #1
    ghostman11 ghostman11 is offline

    how to include files

    hi guys.
    been in bed with flu for couple weeks but its given me plenty time to play with pics!! so finaly feels like ive had a chance to try and nail a few basics and try a few things out!!! i am finaly starting to be able to get information out the DS!!! YAY (yes its taken way too long).
    anyway been trying to get to grips with c18 wich as you all know has remained a complete mystry to me!!
    making slow progress but realy enjoying it and as i am stuck in bed i get plenty chance to concentrate at last. anyway down to business.........
    ive been trying a few things out and trying to avoid the 'soft' option of using c18 libs that are suplied as i figured i would learn more from making my own functions by study of DS.
    some of theese functions i would like to group into collections say AD functions and put into a seperate file, then be able to call in the file into any prog i like by using the

    #include<blah blah>.c (kind of thing)
    but at the moment i dont realy want to go as far as nailing howto do proper libs like the ones microchip supply.
    all i would like if its poss is to use an include statment in main program like above so i can then just add in any variables needed ect for the and use the functions. yes would be easier to simply cut and paste the functions in each time but i would like to keep main.c clutter free! and have the functions in a sep file.
    can this be done and if so how do i do it!! i have trawled the net but it seems to just relate to proper libs.
    BTW i am not bothere about diff chips being compatable at the mo , once ive got better at actualy codeing then i will move onto the making of proper libs that can transfer to other chips
    sorry if its a bit of a ramble but on heavy duty painkillers for my back at the mo!

  2. #2
    Gobbledok Gobbledok is offline
    Hey Ghostman,

    The way I do it is simply put at the top of your file:

    #include <test.c>


    Then you have to go into your project options and add the location of that file to your 'include search path'.

    Project > Build Options > Project > (tab) Directories > (drop-down menu) Include Search Path > Add New (then point it to the directory which has the file you want to include).

    ^ The menu location is off the top of my head and my memory is sketchy, at best.
    0
    Last edited by Gobbledok; 1st February 2012 at 04:04 AM.
    There are 10 types of people in this world: Those who understand binary and those who don't.

    If it wasn't for Thomas Edison, we'd be all watching TV by candlelight.

  3. Thread Starter #3
    ghostman11 ghostman11 is offline
    ok thanks!!! i was completly forgetting the adding the include in mplab!!! DOH! always the silly stuff that bites you hardest lol
    0

Tags
Similar Threads
Thread Starter Forum Replies Last Post
How To: Uploading Files and/or Images ElectroMaster Site Issues & Feedback 0 26th August 2011, 01:04 AM
how to include loading effect and decoupling values? lowkb General Electronics Chat 1 18th August 2005, 02:03 PM
PIC include files GatorGuy Microcontrollers 2 20th June 2005, 03:51 PM
How to create fat32 files in MMC using C language? StupidDum Microcontrollers 0 17th May 2004, 01:30 AM
how would i generate HEX file for multiple assembly files? belinda_sg Microcontrollers 2 30th March 2004, 07:54 AM
Electronic Circuits  |  Learning Electronics

Join our community with over 100,000 Members! It's free, easy and when you're logged in you have many more features! Click to register.
Page Time: 0.05330 seconds      Memory: 7,266 KB      Queries: 16      Templates: 0