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.

C compiler for 14-bit PICs

Status
Not open for further replies.

winterhunter

New Member
Hi everyone,

I'm starting to program 14-bit PICs in C (actually, C + inline ASM), and was wondering what is the compiler/IDE that you recommend?

So far I have been using the free version of SourceBoost, which even if it is slow in emulation mode and has some quirks, seems to do the job quite nicely.

But before commiting myself more to this particular compiler, I wanted to know your advice.
Is it any good?
Which compiler gives the most for your money (SourceBoost full version is quite accessible)?
What about the others that are out there (PIXIE, mikroE, etc.)?
What do you recommend?

Thanks a lot for your ideas!

Regards,

Gonzalo

P.D: Whichever I finally choose, it must have an IDE, inline assembly, an emulator and some way of interacting with the environment while running a simulated PIC (like buttons, LEDs, or better still, logic analysers).
 
Last edited:
In my opinion, SourceBoost/BoostC is the best choice for hobbyists, because it can do pretty much everything you need, it's VERY affordable compared to pretty much all other compilers, has MPLAB integration (which some compilers do not), and the guys that develop it (Dave and Pavel) are very nice on their support forums. I have run into _some_ limitations myself, such as anonymous structs in unions and flexibility of pointers to program memory, however I have NEVER felt that any of them were serious enough to warrant paying literally hundreds of dollars more for a different compiler.

And no, I'm not affiliated with them, but I did like it enough to buy a Pro license.
 
Can't you just use the C18 compiler provided by Microchip? The 14-bit PIC is the the 18f series (is it?), so C18 should do it. You can also use the student edition. It is a 60 day trial.
 
BOBKA said:
Can't you just use the C18 compiler provided by Microchip? The 14-bit PIC is the the 18f series (is it?), so C18 should do it. You can also use the student edition. It is a 60 day trial.
no - the 16F series is the 14-bit word, the 18F series is a 16-bit word, not to be confused with an actual 16-bit core as in the 24F series... They're easy to confuse :p
So, the C18 compiler won't be useful unless the OP switches to 18F-series PICs.
 
Last edited:
evandude said:
no - the 16F series is the 14-bit word, the 18F series is a 16-bit word, not to be confused with an actual 16-bit core as in the 24F series... They're easy to confuse :p
So, the C18 compiler won't be useful unless the OP switches to 18F-series PICs.
Which may be the best route to take. More memory. speed, and a free compiler for $2-$3 more a chip. That is unless you are going to make more the a handful of any one project.
 
3v0 said:
Which may be the best route to take. More memory. speed, and a free compiler for $2-$3 more a chip. That is unless you are going to make more the a handful of any one project.

Not only that, but it's good to understand that the 16F core does not work really well with C. One of the reasons for the 18F architectural changes was supposed to be making it more C-friendly, at least that's what I heard. Not that a compiler can't make code for a 16F, just that it may not be as efficient in terms of speed, ROM size, and/or RAM usage as an 18F compilation.

BTW, C is used for microcontrollers. C++ is used for PCs and such. C++ won't really work with microcontrollers because its object-oriented structure and memory management would be very difficult to support with the given resources, in particular the type of stack available.
 
Thanks for your answers!

I know that 18F cores are suppossed to be optimized for C programming (mainly concerning the stack, I've read somewhere). But what the heck, the very few times where I need more speed some inline assembly does the trick quite nicely (also, just reviewing the ASM code generated by Sourceboost can sometimes help to figure out ways to optimize the code).

So I'm not sure that using 18F cores instead of 16F is the solution (one could also argue based on price difference that using dsPIC30F is the way to go, since you get lots of more nice-to-haves like less bank switching, hardware multiply and divide, 0-overhead circular buffers and full 16-bit architecture - The price difference, for a hobbyist project using maybe 5 processors would is almost nil).

@Oznog:
If you REALLY want to use C++ for µcontrollers, you can always use the top-of-the-range ones (µprocessors turned into µcontrollers, like the ARM).

One question on C18 though... After 60 days, what is happening? Turning all the optimizations off sounds like a very bad idea...

Another question concerning sourceboost : is there any way to use it with an ICD?
 
Last edited:
winterhunter said:
Thanks for your answers!

One question on C18 though... After 60 days, what is happening? Turning all the optimizations off sounds like a very bad idea...

It doesn't turn all the optimisations off, just some of them - if you want to keep the full optimisation you simply need to purchase the product - however, I would suspect in practice the difference would be fairly slight anyway!.
 
I think the main thing is that it disables the use of the 'extended' instructions available in the 18F core by the compiler. I don't know a lot about them, but I did look into it briefly and didn't get the impression that those instructions would be very important to the average hobbyist anyway. I've used the C18 compiler quite successfully outside the 60-day period and never had a problem. The code is still a lot more efficient than code for the 16F series, due to the inherent hardware advantages for C on the 18F PICs, even without the extended instructions and whatnot.
 
Another question concerning sourceboost : is there any way to use it with an ICD?

Yes, you just run the boost compiler from inside of MPLab; it works well. The only downside I have found is that it doesn't go to the line where the error is when you double click the error.

You can get a copy of Source Boost on eBay, for cheap. I paid around fifty dollars, and after using it for a while, it seems to be in the same league as high-tech, or the C18, compilers.

I also think the C18, after the evaluation period is over, would serve you well.
 
Status
Not open for further replies.

Latest threads

Back
Top