C Compiler questions

Electronics Computer Programming Q&A
Post Reply
Sparkmaster
Posts: 5
Joined: Tue Dec 02, 2008 6:48 pm
Contact:

C Compiler questions

Post by Sparkmaster » Wed Apr 22, 2009 8:36 pm

OK, I've used the Hi Tech PICC-Lite C Compiler in Chuck Hellebuyck's book Beginner's Guide to Embedded C Programming. I purchased another book, Programming 8-Bit PIC Microcontrollers in C by Martin Bates, which uses the CCS PCM C Compiler. I've heard of BoostC, which seems relatively inexpensive but uses its own IDE instead of MPLAB.

I'd like to purchase a decent C Compiler but I have some questions. I can't afford some of them, so I'm looking for something reasonably priced. I don't want a trial or scaled-back version; I don't want to start coding, only to reach the end of a time limit of a trial version or size limitation. I'd like it to be compatible with MPLAB since I have a little experience with it. Can I use any C compiler to write code for a PIC uC? Will they work with MPLAB? I have a PICkit 2 hooked up now; can I use any compiler with it? Would it be better to buy mikroElektronika's Easy PIC 5 development system, which includes a compiler and hardware? Could I use their compiler with a PICkit 2 and a third party IDE? Are these things proprietary and possibly incompatible?

I apologize for all the questions, but I'd like to move on to creating some programs and don't know the most cost-effective way to do it. I'd appreciate any suggestions from my fellow N&V readers.

languer
Posts: 2
Joined: Mon Mar 09, 2009 4:32 pm
Contact:

Re: C Compiler questions

Post by languer » Wed Apr 22, 2009 10:01 pm

Any compiler should work with PICKIT2. That is just a programmer and works with any hex file. Personally I've used Hi Tech PICC-Lite C, CCS PCM C, and PICBASIC. They're all compatible with MPLAB if you that is what you want to use. Currently use CCS PCM C and have no reason to change. Keep in mind that Microchip just acquired HiTech, this may influence your decision (or not).

bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: C Compiler questions

Post by bodgy » Thu Apr 23, 2009 1:28 am

Two other reasonably priced C compilers for Pic's are Wiz-C (which I use) and Mikroelectronika C.

Mikro C comes with a lot of libraries and is easy to use. It's biggest drawback is it doesn't produce optimised code.

Fed-C (Wiz-C) produces reasonably optimised code, but has quirks within its IDE mainly dealing with syntax errors and cutting and pasting. It comes with the choice of using either a RAD environment or as plain editor which is how I use it. Both compilers will do the 16 and 18F series. Neither compiler auto links into MPLAB, though Wiz-C does produce a lst file that can be used by MPLAB. Wiz-C comes with converters allowing a HiTech and CCS code to be converted to FED-C.

The Forest product comes with an excellent simulator, which is the main reason I use it.

www.mikroelektronica.com

www.fored.co.uk

Colin
On a clear disk you can seek forever.

elproducts
Posts: 2
Joined: Thu Apr 23, 2009 6:13 am
Contact:

Re: C Compiler questions

Post by elproducts » Thu Apr 23, 2009 6:29 am

First of all, thanks for buying my book.

Second, I've tried almost all the various C compilers prior to writing my book and the HI-TECH is my choice. They offer a compiler for 10f,12fand 16f plus a second one for 18f, a third for 16bit PICs and a fourth for the PIC32. HI-TECH was purchased by Microchip so compatibility should maintain or improve with MPLAB. The lite version, though limited in optimization, supports all the parts not just a few and doesn't limit you to memory size.
The PICKit 2 is absolutely the best low cost development programmer I have ever used. Plus it offers a logic analyzer and UART tool when you run the standalone GUI. No otehr programmer compares to it for the price.

Once you learn C you can switch to just about any C compiler but what I like about the HI-TECH is it offers more ANSI standard approach and there are many example programs online.
www.microchipc.com has many examples.
I have friends who prefer CCS or MikroE and they also are good choices. What I found though is each compiler has its own personality and once you understand how it works you'll want to stick with it. What I didn't like was CCS sample version times out in 30 days. MikroE limits you to 2k. For my books I didn't want those limitations for the reader so HI-TECH was in my mind the best choice. The only limitation was the optimization but unless you need to fit a large program into a small memory part, you'll never need optimization anyway. I didn't see that as a limitation.

I'm using it again in my "Volume 2" Beginner's Guide to Embedded C Programming which should be out by summer 2009 which will cover interrupts, timers, displays and communication.

Sparkmaster
Posts: 5
Joined: Tue Dec 02, 2008 6:48 pm
Contact:

Re: C Compiler questions

Post by Sparkmaster » Fri Apr 24, 2009 6:50 am

Thank you all for sharing your information and expertise. Chuck, I'm looking forward to your next book (I'm the one who's been emailing you lately :wink: ) and will probably stick with HI-TECH PIC Lite for now because that's what you use, but I hate the message that reminds me after compilation that my code isn't optimized! Another downside is all the different versions; what happens if I purchase their compiler for 16F chips and want to step up to a PIC32 chip; do I have to purchase a completely different compiler? Theirs are quite expensive. I was very close to purchasing a package that includes MicroC because they now offer a pro version (not sure what that means but it's very competitively priced), but I wasn't aware their code isn't optimized! Wiz-C looks like an inexpensive alternative, especially with the device simulation and waveform analyzer, but I don't like that it's "quirky" and won't autolink into MPLAB. If I want to follow the exercises in Bates' book, I'll need to download the CCS compiler he uses, but it's limited to 30 days of use. He also includes a table (page 237) comparing C compilers that causes me to raise more questions, like what type of peripheral support do I need and what type of function library is adequate?

At this point I'll probably throw all this information into a spreadsheet and pick the one with the least number of drawbacks :!:

brandonl
Posts: 5
Joined: Tue May 19, 2009 1:32 pm
Contact:

Re: C Compiler questions

Post by brandonl » Tue May 19, 2009 6:02 pm

I have been using the free version of mikroC and have been very pleased. The full version is reasonably priced (i think under $300), and they having a very active and helpful forum.

Sparkmaster
Posts: 5
Joined: Tue Dec 02, 2008 6:48 pm
Contact:

Re: C Compiler questions

Post by Sparkmaster » Wed May 20, 2009 7:50 pm

Thanks brandonl, I've been giving them a lot of consideration lately. I'm thinking of purchasing their EasyPIC5 + mikroC kit, which includes their new pro version of their C compiler. I'm a little strapped for cash right now, so I may have to wait a bit. I was looking at another compiler called BoostC. It's reasonably priced (from $5 for a lite version to $70 for the standard version) and they occasionally put one up on eBay. I saw a standard version get auctioned for $15.50 last month. I wonder if anyone has any experience with that one.

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: C Compiler questions

Post by philba » Wed May 27, 2009 12:03 pm

A bit late to this thread but...

I'm playing with Boost C right now. It appears to be of pretty high quality. it does integrate into MPLAB (above statement was incorrect). You can download and use the lite version for free. Only the pro version is allowed to be used for commercial products.

A couple of complaints, like most of the inexpensive compilers out there, it's error reporting could be a lot better. It doesn't implement bit fields (and give you weird error messages). You have to use setbits rather than a direct assignment. They are very confused about PIC Special Function Register (SFR) names. They declare them in lower case unlike most other compilers. And then they use upper case for sub fields (only when used in an expression). Just plain weird. Once you get past those, it seems reasonably done.

One other thing, the developers can be snarky on their support site. One example I found pretty unsupportive of some one trying to use their product. To summarize, some one wrote in that they couldn't get their program to compile. Posted source showed they were using upper case (PORTB, for example) for SFRs instead of lower case. One of the developers writes back - "There are errors in your program." Yeah, there were but he forced the guy to figure out the problem. Note, I had exactly this problem. Scratched my head, searched forum and found out. I've been programming C for 30 years. I probably won't pay them any money for that crappy attitude.

User avatar
philba
Posts: 2050
Joined: Tue Nov 30, 2004 1:01 am
Location: Seattle
Contact:

Re: C Compiler questions

Post by philba » Wed May 27, 2009 1:18 pm

Sparkmaster wrote:Thanks brandonl, I've been giving them a lot of consideration lately. I'm thinking of purchasing their EasyPIC5 + mikroC kit, which includes their new pro version of their C compiler. I'm a little strapped for cash right now, so I may have to wait a bit. I was looking at another compiler called BoostC. It's reasonably priced (from $5 for a lite version to $70 for the standard version) and they occasionally put one up on eBay. I saw a standard version get auctioned for $15.50 last month. I wonder if anyone has any experience with that one.
I'll be quite honest, the EasyPIC5 seems like a lot of money for something that you will use a few times and then move on from.

Simply put, I can't recommend trainers. You won't use them in a product/project and it's limited to a specific PIC. They look good on paper but I'd rather buy the components I need for a project, experiment with them, and then use them to build the project. No waste and much cheaper.

I do recommend the following: solderless breadboard+jumper wires, pickit2, crystal+caps, LEDs, assortment of resistors (330, 10K at minimum) and a few caps (start with 100nF). If you shop well, less than $35+$10. Then you can select any PIC you want and plug in any special devices you want.

Also, like I said, boost C is free. Don't buy anything until you are sure you need teh fuller features.

Sparkmaster
Posts: 5
Joined: Tue Dec 02, 2008 6:48 pm
Contact:

Re: C Compiler questions

Post by Sparkmaster » Tue Jun 16, 2009 5:39 am

I think I'll take your advice, philba. I was looking for an out-of-the-box solution which is sort of the lazy way to do it. I already have most of the parts so I went ahead and downloaded a C compiler. I'll let you now how I make out; I'm sure I'll be posting again with more questions!

bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: C Compiler questions

Post by bodgy » Fri Jul 03, 2009 2:52 am

Sparkmaster wrote: I went ahead and downloaded a C compiler. I'll let you now how I make out;
Out of interest which one?



Colin
On a clear disk you can seek forever.

Sparkmaster
Posts: 5
Joined: Tue Dec 02, 2008 6:48 pm
Contact:

Re: C Compiler questions

Post by Sparkmaster » Fri Jul 03, 2009 3:56 pm

I downloaded BoostC and bought a license on eBay from the manufacturer for $38, a little more than half price. I don't mind paying a little, so I skipped the free Lite version. I haven't used it yet, though; other things have taken precedence in my life. This will have to take a back seat unitl I get some other things in order. I hope to come back here after I've had a chance to play with it a little. I also plan to read Chuck Hellebuyck's new book when it comes out, and if it's like the previous one he'll use the Hi Tech PICC-Lite C Compiler again.

I guess it can't hurt to use more than one, right? Actually, that's the upshot of all the information I've received so far. It seems the best strategy is to learn and familiarize oneself with as many compilers as you can and find the one that meets your needs the best.

stevech
Posts: 138
Joined: Mon Jun 05, 2006 10:27 pm
Contact:

Re: C Compiler questions

Post by stevech » Mon Jul 20, 2009 8:08 pm

Sparkmaster wrote:It seems the best strategy is to learn and familiarize oneself with as many compilers as you can and find the one that meets your needs the best.
Also a good idea to consider/learn/use other microprocessors, e.g., Atmel AVR. Free GCC compiler and IDE (Atmel Studio). Several free but limited C compilers (IAR, etc). Lots of competitive C and other compilers such as ImageCraft. And for AVRs, there's a great Visual Basic like environment from ZBasic.net.

RufusPerna
Posts: 1
Joined: Sat Aug 07, 2010 9:52 am
Contact:

Re: C Compiler questions

Post by RufusPerna » Sat Aug 07, 2010 9:54 am

The free version is pretty good but I can't afford to spend all that money on the full version at the moment. What do you get extra in the full version that makes it worth payong for?

bodgy
Posts: 1044
Joined: Tue Dec 04, 2001 1:01 am
Location: Australia
Contact:

Re: C Compiler questions

Post by bodgy » Sat Aug 07, 2010 7:55 pm

RufusPerna wrote:The free version is pretty good but I can't afford to spend all that money on the full version at the moment. What do you get extra in the full version that makes it worth payong for?
Full version of which one? Are you referring to Visual Basic or ........?
On a clear disk you can seek forever.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest