+ Reply to Thread
Page 2 of 3
First 1 2 3 Last
Results 16 to 30 of 31

Thread: ccs compiler and header files

  1. #16
    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,463
    Blog Entries
    11

    Default

    Quote Originally Posted by Mike, K8LH View Post
    3v0,

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

    Mike
    Please note that I feel this needs further study. This is the first boostC program I ever compiled. I am not saying it is a bad compiler. I still need to work through each instrucion to see what is going on but it looks like BoostC is testing the bit and setting or clearing it based on the test. What you would do if the bit toggle instruction did not exist.

    BoostC
    Code:
    23:                  while(1)
      004C    D7F4     BRA 0x36
    24:                  {
    25:                    lata.7 = ! lata.7;
      0036    6A01     CLRF 0x1, ACCESS
      0038    AE89     BTFSS 0xf89, 0x7, ACCESS
      003A    2A01     INCF 0x1, F, ACCESS
      003C    B001     BTFSC 0x1, 0, ACCESS
      003E    8E89     BSF 0xf89, 0x7, ACCESS
      0040    A001     BTFSS 0x1, 0, ACCESS
      0042    9E89     BCF 0xf89, 0x7, ACCESS
    26:                    delay_ms(500);
      0044    0EF4     MOVLW 0xf4
      0046    6E01     MOVWF 0x1, ACCESS
      0048    EC02     CALL 0x4, 0
      004A    F000     NOP
    
    MCC18
    Code:
    17:                  while(1)
      012A    D7F9     BRA 0x11e
    18:                  {
    19:                    LATAbits.LATA7 = ! LATAbits.LATA7;
      011E    7E89     BTG 0xf89, 0x7, ACCESS
    20:                    Delay10KTCYx(50);
      0120    0E32     MOVLW 0x32
      0122    6EE6     MOVWF 0xfe6, ACCESS
      0124    EC65     CALL 0xca, 0
      0126    F000     NOP
      0128    52E5     MOVF 0xfe5, F, ACCESS
    
    I was working on an article for JPUG when I ran into this. I was attempting to show how procedural languages generated similar code. In this case Swordfish and C18. I was curious what BoostC would look like.

    LATA.7 is undefined so I used PORTA

    Swordfish LATA.7 is undefined so I used PORTA
    Code:
    7:                 While True
    8:                    Toggle(PORTA.7)
      0058    7E89     BTG 0xf89, 0x7, ACCESS
      005A    9E92     BCF 0xf92, 0x7, ACCESS
    9:                    DelayMS(500)
      005C    0E01     MOVLW 0x1
      005E    6E05     MOVWF 0x5, ACCESS
      0060    0EF4     MOVLW 0xf4
      0062    DFD3     RCALL 0xa
      0064    D7F9     BRA 0x58
    
    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)


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

    Default

    can you do the debugging in ccs or do you transfer it over to mplab and do it that way

  3. #18
    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,463
    Blog Entries
    11

    Default

    Quote Originally Posted by jay543_uk View Post
    can you do the debugging in ccs or do you transfer it over to mplab and do it that way
    You do not need to transfer files. CCS integrates with MPLAB. Use MPLAB project wizzard to create project using CCS compiler. After that you can build debug and run from inside MPLAB.

    CCS sell its own IDE but it is more money and I prefer to a single IDE for all compiler. MPLAB.
    Last edited by 3v0; 5th July 2008 at 08:21 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)

  4. #19
    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,521

    Default

    Quote Originally Posted by 3v0 View Post
    Please note that I feel this needs further study. This is the first boostC program I ever compiled. I am not saying it is a bad compiler. I still need to work through each instrucion to see what is going on but it looks like BoostC is testing the bit and setting or clearing it based on the test. What you would do if the bit toggle instruction did not exist.
    Thank you for the example. I'm very impressed that you look at the generated assembly code.

    BoostC seems to be missing a toggle_bit() function to compliment their set_bit() and clear_bit() functions. This is one of those situations where having a good assembler background comes in handy as you test different C instruction constructs to find the one that generates the assembler code you're lookin' for (grin).

    Anyway, you'll find the following BoostC instruction construct will generate the correct or preferred single word btg lata,7 assembler instruction;

    Mike

    Code:
      lata.7 ^= 1;
    
    Last edited by Mike, K8LH; 6th July 2008 at 12:07 AM.

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

    Default

    Quote Originally Posted by BeeBop View Post
    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.


    If we don't look at the price tag, because my collage will finance it, then only remains quality of compiler itself and service(demo code, boards).

    I looked at both reviews and they were extremely informative:
    PIC micros and C - CCS C review

    CCS also has a comparison page:
    CCS, Inc. - Compiler Comparison

    Hi-Tech does look like best but with only 14 example programs vs 130 from css, there is no comparison, also css has good community, but Hi-Tech is recommended from Microchip and has this, which is mainly for Hi-Tech PICC.

    So what it seems to me is that Microchip is pushing Hi-Tech PICC and that eventually it will get same popularity as CSS(maybe not because of price tag), but when?

    Also CSS operates weird:
    (copy from link above)
    In the HiTech, C18 and IAR you can do the following:

    RA0=1;
    For the C18 you will have to define RA0 like:
    #define RA0 PORTAbits.RH0

    However there is no way to do such an assignment in the CCS compiler their you have to call a internal function:
    #define RA0 PIN_A0
    output_high(RA0);

    The net result is that if you want to keep your code portable to the CCS compiler you would need to do something like this for all the other compilers:

    #define output_high(x) {x=1;}
    Thus you would have to use the output_high function/macro anytime you set a bit.

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

    Default

    3v0, I think that '!' can't be used as a bitwise operator with BoostC, hence the larger code.


    Mike, I wrote my functions that do bitwise operations for Hi-Tech PICC - that did not (and probably still does not) have built-in functions for the task - and they do work with BoostC too.
    Code:
    #define bitset(var,bitno) var|=(1<<bitno)
    #define bitclr(var,bitno) var&=~(1<<bitno)
    #define bittoggle(var,bitno) var^=(1<<bitno)
    
    Attached Images
    Last edited by eng1; 6th July 2008 at 08:19 AM.

  7. #22
    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,463
    Blog Entries
    11

    Default

    I am not quite sure where you found this but it is incorrect.
    Quote Originally Posted by jhanus
    In the HiTech, C18 and IAR you can do the following:

    RA0=1;
    For the C18 you will have to define RA0 like:
    #define RA0 PORTAbits.RH0
    However there is no way to do such an assignment in the CCS compiler their you have to call a internal...
    Peter Anderson has shown how to do this in his execlent tutorials.

    Code:
    #byte PORTA      = 0xF80
    
    // ------- PORTA Bits -----------------------------------
    
    #bit RA6 	= PORTA.6
    #bit RA5 	= PORTA.5
    #bit RA4 	= PORTA.4
    #bit RA3 	= PORTA.3
    #bit RA2 	= PORTA.2
    #bit RA1 	= PORTA.1
    #bit RA0 	= PORTA.0
    
    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)

  8. #23
    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,463
    Blog Entries
    11

    Default

    As a rule one uses uC and compiler you are asked to work with. To that end I try to be language and compiler neutral.

    Microchip is pushing Hi-Tech PICC
    I would not read too much into this type of partnership. Both see it as a plus at a very low cost. A marriage of convenience with little commitment.

    The CCS demo compiler also ships with MPLAB. I am not sure which parts it supports.

    On the other hand the fact that Microchip is releasing their own compilers speaks volumes. They are pushing their own (where they exist).
    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. #24
    jhanus Newbie
    Join Date
    Mar 2007
    Location
    Croatia, my homeland
    Posts
    102

    Default

    Quote Originally Posted by 3v0 View Post
    I am not quite sure where you found this but it is incorrect.

    Peter Anderson has shown how to do this in his execlent tutorials.
    Here, under Ports and Registers, altough it does says CCS have introduced a function in later versions which makes this CCS port assignment unnecessary.
    Can I get a link to Peter Anderson tutorials, thx.



    Quote Originally Posted by 3v0 View Post
    I would not read too much into this type of partnership. Both see it as a plus at a very low cost. A marriage of convenience with little commitment.

    The CCS demo compiler also ships with MPLAB. I am not sure which parts it supports.

    On the other hand the fact that Microchip is releasing their own compilers speaks volumes. They are pushing their own (where they exist).

    I totally agree, but then again I must ask myself if they are all of similar quality how come there exists products which price is tenfold of other.

    There must be something. I simply don't want to learn one and after 6 monthes it struck me, ohhh maybe that wasn't the best choice.

  10. #25
    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,463
    Blog Entries
    11

    Default

    This is a link to his site. He sells the tutorials for about $50.

    Peter H. Anderson - Embedded Processor Control
    PC Parallel Port, BasicX, BASIC Stamp®, 68HC11, PIC®, PICAXE, Data Acquisition and Control

    It is not suprising
    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)

  11. #26
    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,463
    Blog Entries
    11

    Default

    Quote Originally Posted by jhanus View Post
    Here, under Ports and Registers, altough it does says CCS have introduced a function in later versions which makes this CCS port assignment unnecessary.
    That is wrong too.

    I totally agree, but then again I must ask myself if they are all of similar quality how come there exists products which price is tenfold of other.

    There must be something. I simply don't want to learn one and after 6 months it struck me, ohhh maybe that wasn't the best choice.
    If you were a hobby type you could learn one and stick with it, as an EE you will have to use the compiler the project is using. Most often not your choice.

    The price of a compiler has more to do with the nature of the company then quality of the compiler. If you have a small shop with a few programmers you can sell a compiler for much less then if you have a CEO, CFO, HR director and all the departments associated with them. The overhead in some companies is huge.

    C18 is a $500 a seat and 5K$ for a site license. The student version lacks some optimization but is free. Given the size and speed of 18F memory chips this is not a limitation you (a student) will bump into soon.

    What classes related to programing and embedded systems do you plan to take?

    EDIT: What you do not want in a compiler is bad code generation. With a few #defines and macros you can work with most any of them.
    Last edited by 3v0; 6th July 2008 at 01:03 PM. Reason: More info:
    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)

  12. #27
    BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent BeeBop Excellent
    Join Date
    Dec 2005
    Location
    Vancouver Canada
    Posts
    1,192

    Default

    Quote Originally Posted by Mike, K8LH View Post
    Thank you for the example. I'm very impressed that you look at the generated assembly code.

    BoostC seems to be missing a toggle_bit() function to compliment their set_bit() and clear_bit() functions. This is one of those situations where having a good assembler background comes in handy as you test different C instruction constructs to find the one that generates the assembler code you're lookin' for (grin).

    Anyway, you'll find the following BoostC instruction construct will generate the correct or preferred single word btg lata,7 assembler instruction;

    Mike

    Code:
      lata.7 ^= 1;
    
    You found that one quick! I was busy changing the neighbor's spark plugs and no time to play...
    I would have tried ~= first, but...

    It would be worth giving feed back to Pavel on this one. They seem to take most bug reports and enhancement requests seriously.

    Quote Originally Posted by jhanus View Post
    If we don't look at the price tag, because my collage will finance it, then only remains quality of compiler itself and service(demo code, boards).
    ...
    Hi-Tech does look like best but with only 14 example programs vs 130 from css, there is no comparison, also css has good community, but Hi-Tech is recommended from Microchip and has this, which is mainly for Hi-Tech PICC. ...
    Sorry, I should have given the link the HiTech's forums as well:
    HI-TECH Software Forums: Viewing forum: PICmicro & dsPIC
    It does look like they are active, but I don't think they enjoy the community CCS does. This is a quess though, as I haven't been on the hiTech forums much at all. Admittedly, the SB forums do not have any new posts most days, and I have seen questions go unanswered. CCS forums are worth visiting even if you don't use their tools!

    That said, I do think HiTech has lead the pack for a number of years, and they probably are still at the top end, however I don't make any profit and often make programs which do not fit in 2k program space...

    I think both HiTech and C18 are based on gcc, but not sure about that. (I know the best ARM compilers are gcc based, and are high priced.) This sort of sheds some light on the price differences...

    Open source software can still make money, and you can see this with some of the Linux distributions; the provider is selling support. Better support sells for more.

    Years ago, I was heavy into Frontier, a scripting and data base tool, which was open source. When the product started to shine (It was the first to develop Remote Procedure Calls) it went commercial, and I was left out, as support was about $1000 for six months or so...

    Quote Originally Posted by 3v0 View Post

    The CCS demo compiler also ships with MPLAB. I am not sure which parts it supports.

    On the other hand the fact that Microchip is releasing their own compilers speaks volumes. They are pushing their own (where they exist).
    The CCS compiler installed with MPLab, as far as I know is fully functional, but for the 12xxx chips.

    At one time Microchip had a compiler for 16cxx PICs, but dropped it. I think they did not see value in pursuing it as the 12x and 16x were difficult to make a compiler for...

  13. #28
    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,463
    Blog Entries
    11

    Default

    I like #inline and #separate compiler directives. CCS has them but they are not unique to CCS. These are used just prior to a function. The #inline forces the compiler to include the code for the function each time the function is used. It avoids the overhead of a function call.

    A #inline function can often be used in place of a macro. A function is easier to debug unless the toolchain show the code generated by the macro.

    Does BoostC have #inline or similar ?
    Last edited by 3v0; 6th July 2008 at 02:02 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. #29
    eng1 Excellent eng1 Excellent eng1 Excellent eng1 Excellent eng1 Excellent
    Join Date
    Apr 2006
    Location
    Italy
    Posts
    938

    Default

    Quote Originally Posted by 3v0 View Post
    I like #inline and #separate compiler directives. CCS has them but they are not unique to CCS. These are used just prior to a function. The #inline forces the compiler to include the code for the function each time the function is used. It avoids the overhead of a function call.

    A #inline function can often be used in place of a macro. A function is easier to debug unless the toolchain show the code generated by the macro.

    Does BoostC have #inline or similar ?
    The correct sysntax with BoostC is
    Code:
    inline void my_function(arguments){
    // code here
    }
    
    without the '#'.

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

    Default

    Quote Originally Posted by 3v0 View Post
    What classes related to programing and embedded systems do you plan to take?
    I just finished third year, orientation automatisation, only class which covered MCU was (in translation) Computer structure, it covered basics of MCU(specifically outdated 16F84A), there was very little interest in my collage(for anything additional), so I covered every function of 16F family(on 16F87xA) alone in assembler.

    Now, I'm going to 18F and I need to choose proper compiler, obviously I can't decide should I go PICC or CSSC, probably I'll go with CSSC for more code, tutorials and books to learn from as BeeBop emphasized.
    Last edited by jhanus; 6th July 2008 at 03:29 PM.

+ Reply to Thread
Page 2 of 3
First 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