+ Reply to Thread
Page 1 of 3
1 2 3 Last
Results 1 to 15 of 31

Thread: ccs compiler and header files

  1. #1
    jay543_uk Newbie
    Join Date
    Oct 2007
    Location
    uk
    Posts
    101

    Default ccs compiler and header files

    hi all, iv been using asembly code with a 16f876a and for a few months now and have got the hang of controling inputs and outputs and some mssp function but i would like to start using C, iv started read "ABSOLUTE BEGINNER'S GUILD TO C" which all seems to be making sense but how do i no what function i can use on a pic.
    iv got a copy of ccs c compiler and i see i can add a few header files to my project but how do i no what these header files can do.

    Code:
    #include "C:\Documents and Settings\JASON\My Documents\Pic Projects\New Folder\main.h"
      #include <assert.h>
      #include <ctype.h>
      #include <errno.h>
      #include <float.h>
      #include <limits.h>
      #include <locale.h>
      #include <math.h>
      #include <s7600.h>
      #include <setjmp.h>
      #include <stdio.h>
      #include <stddef.h>
      #include <stdlib.h>
      #include <stdlibm.h>
      #include <string.h>
    
    
    void main()
    {
    
       setup_adc_ports(NO_ANALOGS);
       setup_adc(ADC_OFF);
       setup_psp(PSP_DISABLED);
       setup_spi(SPI_SS_DISABLED);
       setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1););
       setup_timer_1(T1_DISABLED);
       setup_timer_2(T2_DISABLED,0,1);
    
       // TODO: USER CODE!!
    
    }
    
    thanks for any help
    jason


  2. #2
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    Why would you add them if you did not know what they are or do ?

    You only add the header files if you need the library functions they are function prototypes for.

    CCS has a compiler manual and another for the library. Find the functions you need in the second. It will tell you which header file to include for each function. CCS is good that it will only link in the code for the functions you use. Not the entire library.
    Last edited by 3v0; 4th July 2008 at 07:59 PM.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  3. #3
    jay543_uk Newbie
    Join Date
    Oct 2007
    Location
    uk
    Posts
    101

    Default

    hi there, as i said im very new to C and i was just looking at header files and wounded what each one did, iv not tryed to write any C code yet but i was just having a look round the ccs compiler.is the ccs compiler a good compiler for beginner.

  4. #4
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    Quote Originally Posted by jay543_uk View Post
    hi there, as i said im very new to C and i was just looking at header files and wounded what each one did, iv not tryed to write any C code yet but i was just having a look round the ccs compiler.is the ccs compiler a good compiler for beginner.
    It is a good compiler. Several good ones out there. I started with it and still use it for 16F chips.

    Do not start by looking at the header files. Read the CCS Compiler Reference Manual June 2008. It explains all the functions and tells you which header file to include if you want to use that function.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  5. #5
    jay543_uk Newbie
    Join Date
    Oct 2007
    Location
    uk
    Posts
    101

    Default

    can you use a pickit2 clone with the ccs compiler???

  6. #6
    futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent futz Excellent
    Join Date
    Sep 2007
    Location
    Vancouver, B.C.
    Posts
    1,980

    Default

    Quote Originally Posted by jay543_uk View Post
    can you use a pickit2 clone with the ccs compiler???
    That's a trick question! They're not related directly. A PICkit 2 can program almost any PIC with almost any legal hex file. The hex files are created by assemblers or compilers. All PIC assemblers and compilers make the same format of hex files. Therefore you can use a PICkit 2 with any PIC assembler or compiler. If you couldn't, what use would it be?

    To answer your question in one word, "Yes".
    =========================
    Futz's Microcontrollers & Robotics
    =========================

  7. #7
    jay543_uk Newbie
    Join Date
    Oct 2007
    Location
    uk
    Posts
    101

    Default

    can the pickit2 be used for debugging with ccs compiler

  8. #8
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    Quote Originally Posted by jay543_uk View Post
    can the pickit2 be used for debugging with ccs compiler
    Ah the right question. Yes.

    I use Junebug's and the CCS compiler for debugging 16F's.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  9. #9
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,193

    Default

    Hi Jay,

    You should just jump in and start using the compiler, and before long you will get the hang of it. The CCS C compiler is one of the easiest to use, and comes with a large number of examples. Just look in the install directory (PICC) in the folder called - Examples.

    If you have been working in assembler, then you might do a simple LED blink in C and then take a look at the list file to compare it with the same thing done in assembler. This will give you lots of insight into how your compiler works. Then go to your examples folder and try them all, or try some. By the time you work through two or three, you should be getting the hang of it.

    I think the best thing about CCS is that they have an excellent support forum, with some very intelligent and helpful posters. Find it here:
    CCS :: Index

  10. #10
    jhanus Newbie
    Join Date
    Mar 2007
    Location
    Croatia, my homeland
    Posts
    102

    Default

    So, which one would you choose Hi-Tech PICC or CSS?, I'm asking because of examples, because with them I will surly learn faster.
    Last edited by jhanus; 5th July 2008 at 02:13 PM.

  11. #11
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,193

    Default

    Quote Originally Posted by jhanus View Post
    So, which one would you choose Hi-Tech PICC or CSS?, I'm asking because of examples, because with them I will surly learn faster.
    Well, for the money: Hi-Tech is about 1k per family, and CCS is about 100 $ per family, and around $450 for the IDE, and all families. The IDE comes with lots of examples and other useful programs. I would go with CCS.

    However, the one I use, and the best deal of all is Source Boost. A full license for non commercial use is less than $70. Find it here:
    SourceBoost Technologies - Home of BoostC Free PIC C Compiler and BoostBasic Free Pic Basic Compiler

    All of them offer demo versions, and I think all have sample programs (although I haven't looked at HiTech lately.) CCS has the best forums though.

  12. #12
    eng1 Excellent eng1 Excellent eng1 Excellent eng1 Excellent eng1 Excellent
    Join Date
    Apr 2006
    Location
    Italy
    Posts
    938

    Default

    Quote Originally Posted by jhanus View Post
    So, which one would you choose Hi-Tech PICC or CSS?, I'm asking because of examples, because with them I will surly learn faster.
    I think that both are good. Hi-Tech PICC compiler is my personal favourite for the PIC16. I am quite surprised that few people say they're using it on this forums, especially since it's been installed by MPLAB.
    I believe that it produces the highest-quality code. However, the Lite version doesn't support all the 16F devices. I've used it to develop some programs for the 16F627A (628A is not supported), 16F690, 16F887 and 12F629/675, for example. Despite those limitations, the Lite version can be used for commercial applications and that's quite interesting!

  13. #13
    3v0
    3v0 is offline
    3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent 3v0 Excellent
    Join Date
    Jul 2006
    Location
    USA
    Posts
    6,464
    Blog Entries
    11

    Default

    CCS also has a support forum with a section to share code. It is a great resource to find code. The people there will also provide help. The one thing you need to keep in mind with CCS is that the compilers come with 90 days (I think) of support/updates. One year of support can be purchased at any time even after your support has expired for $100.

    I have not seen metrics on generated code size or open (admitted bugs) for any of the PIC compilers. About the only thing we have to go on is what people say (quite subjective) and the price.

    For the 18F family C18 is free. It is the only demo/free C compiler without memory size restrictions that I am aware of.

    BoostC is a good buy in that one inexpensive license covers several families.
    While working on an article for JPUG I found BoostC for the 18F generated 7 instructions to toggle a bit where C18 used one. I see this as a warning flag only. My sample code was very small and I did not look into optimization.
    Last edited by 3v0; 5th July 2008 at 03:12 PM.
    Please post questions to the forums. PM's are for personal communication.

    BCHS/3v0's Tutorials
    Junebug USB PIC programmer kit., USB Bit Whacker,
    The 15 Minute Printed Circuit Board! (+drill time)

  14. #14
    Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent Mike, K8LH Excellent
    Join Date
    Jan 2005
    Location
    Michigan, USA
    Posts
    2,522

    Default

    Quote Originally Posted by 3v0 View Post
    While working on an article for JPUG I found BoostC for the 18F generated 7 instructions to toggle a bit where C18 used one. I see this as a warning flag only. My sample code was very small and I did not look into optimization.
    3v0,

    May I see the BoostC and MCC18 instructions you used please (sorry for off-topic)?

    Mike
    Last edited by Mike, K8LH; 5th July 2008 at 03:15 PM.

  15. #15
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,193

    Default

    There is a review of several of the compilers here:
    PIC micros and C - CCS C review however SourceBoost is not reviewed.

    CCS also has a comparison page:
    CCS, Inc. - Compiler Comparison however their info on SB isn't up to date.

    CCS has its downside as well. The best way to use it (IMHO) is the PH Anderson does, without their propriety libraries, writing your own functions. I think CCS has improved their compilers quite a bit with regards to pointers, which are heart and soul of C. They often don't respond to bug requests, though.

    The one I like least is MikroC, as they seem very protective of their propriety stuff, and theirs doesn't even integrate into MPLab.

    I haven't tried the IAR, but it seems very high priced...

    Yes, C18 is the only free one without restrictions, but it isn't without problems either.

    Mike, I don't think you are off topic at all. I too would like to see those instructions.

+ Reply to Thread
Page 1 of 3
1 2 3 Last

Similar Threads

  1. Junebug PORTB header mod
    By futz in forum Micro Controllers
    Replies: 91
    Latest: 15th April 2008, 06:06 PM
  2. Need help with header pin mistake
    By kittydog42 in forum Electronic Projects Design/Ideas/Reviews
    Replies: 5
    Latest: 19th May 2007, 05:55 AM
  3. Header pin jumper wires.
    By Sceadwian in forum General Electronics Chat
    Replies: 23
    Latest: 21st February 2007, 09:58 PM
  4. Declartion of header file
    By kaleem in forum Micro Controllers
    Replies: 6
    Latest: 6th December 2006, 03:47 AM
  5. Looking for Header Assortment
    By sparks_n_wire in forum General Electronics Chat
    Replies: 1
    Latest: 14th April 2006, 11:28 PM

Tags for this Thread