Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

ccs compiler and header files

Status
Not open for further replies.
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)
 

Attachments

  • bitwisefunctions.png
    bitwisefunctions.png
    6.1 KB · Views: 183
Last edited:
I am not quite sure where you found this but it is incorrect.
jhanus said:
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
 
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).
 
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.



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.
 
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:
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.

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...

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...
 
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:
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:
[B]inline[/B] void my_function([I]arguments[/I]){
//[I] code here[/I]
}

without the '#'.
 
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:
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.

As I said earlier I do not think it makes much difference which compiler you use. If you are working in isolation the online support you can get via this forum or the vendors forum is more important then the differences between the compiler.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top