4
\$\begingroup\$

Specifically, the PIC24 series.

I tried out microchips C30 compiler, but it seems to be a bit too complicated for me, and I couldn't find any libraries with it.

Then I tried CCS, and it seems far too simple, and I cannot view the code for say, I2C_write, which is quite unnerving for me.

What about Hi-tech C? I did not get a chance to check it out yet, is it in your opinion good or bad?

Are there any other C compilers for pic24 out there? Does not matter if they are free or not, as long as they have some examples.

\$\endgroup\$

4 Answers 4

9
\$\begingroup\$

Microchip's C30 compiler comes with extensive libraries for all the peripherals, and lots of other stuff can be downloaded. I bought the full version but the free version is adequate for most users. All the Microchip code examples use it.

Most people use C30 for the PIC24 and dsPIC. The other compilers don't have a very good reputation, judging from comments on the Microchip forum.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ I can second this. The C30 compiler is probably the best one you'll find for the price (free). As for Hi-tech C, I suspect it is deprecated as Microchip seem to own the compiler now and the C30 is what they focus on. \$\endgroup\$ Commented Nov 26, 2010 at 19:07
  • 1
    \$\begingroup\$ I haven't used the C30 compiler but the libraries that came with the C18 compiler were really bad, very inefficient and buggy, even simple stuff like the SPI library. So i would recommend looking through the code before you use their libraries. \$\endgroup\$
    – Mark
    Commented Nov 26, 2010 at 21:09
  • \$\begingroup\$ @Mark, always good advice with anyone's libraries. \$\endgroup\$
    – Kortuk
    Commented Nov 26, 2010 at 23:27
  • 2
    \$\begingroup\$ @Mr. Hedgehog, Hi-Tech C is only for the 8-bit range, whereas C30 is for the 16-bit range. \$\endgroup\$
    – Thomas O
    Commented Nov 28, 2010 at 2:39
  • \$\begingroup\$ @Thomas, Ah, yes, you are right. \$\endgroup\$ Commented Nov 28, 2010 at 9:20
4
\$\begingroup\$

MPLAB C30 is a very powerful variant of GCC. I'd recommend you use it because it's what Microchip use for all their code examples and thus gives compatibility. I'm currently using it for my project; but I am not using any libraries apart from standard stuff (e.g. printf.)

\$\endgroup\$
2
  • 1
    \$\begingroup\$ The new MPLAB X supports Linux and OSX with GCC \$\endgroup\$ Commented Nov 26, 2010 at 20:39
  • \$\begingroup\$ @Joby Taffey really? I didn't know there was an MPLAB X. Off to download it! (n.b. I run Ubuntu and currently run MPLAB in VirtualBox under XP.) I never thought I'd see the day: Microchip and Linux. :) \$\endgroup\$
    – Thomas O
    Commented Nov 26, 2010 at 22:25
3
\$\begingroup\$

C30 is OK but has a major downside in that (unless they've fixed this recently) the linker is so dumb it can't be told to eliminate ( or even identify) unused code sections.

The reason that this is an issue is Microchip provide lots of nice source libraries for networking, graphics, USB etc, and as these are general-purpose, they will inevitably contain features that any particular user won't use, yet they get included anyway, wasting space.

It's hardly rocket science I can't believe anyone has the nerve to charge for a compiler without such a fundamental optimisation - pathetic.

\$\endgroup\$
2
\$\begingroup\$

HiTech C for the PIC24 generates code that is not at all size optimized. I called the support team about this and the well optimized code generator is not available for PIC24. They had promised to do this work, but then were acquired by Microchip, and work on the HiTech PIC24 "C" compiler stopped. They suggested C30. I had already paid a lot of money for HiTech PIC24 "C" a while back and got stranded with a half finished compiler and no offer to swap for Microchip C30. Also our large code base was written with HiTech intrinsics and library use, and would have been a pain to port. We're out of ROM space on our PIC24 part which is a shame because a better compiler would free up about 20% of the space based on the wasteful assembly the compiler produces. All-in-all I think Microchip did not think all aspects of their tool support through, and left many of us stranded.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.