Heres my claim: One of the best compilers available for the 12X, 16X and
17X PIC micros to date is Hi-Tech C.
Theres only a few good choices for a compiler, and the most popular ones are
Hi-Tech C and CCS
C and IAR C.
The latest version of Hi-Tech C has an extremely good optimizer. It manages
to produce tight, fast code, reasonably close to how I would do it in assembly.
I have never had any problems with the optimizer producing bad code. This
is unlike a certain Texas Instruments compiler, which I wont name. The rule
of thumb is - if the code doesnt work, the Hi-Tech C compiler can be virtually
be eliminated as a possible point of failure.
Hi-Tech C is quite powerful, too. It is fully ANSI compliant, but has certain
enhancements which are required by the PIC architecture.
of Hi-Tech C
A freeware version for the 16F84 is available. This is perfect for
evaluating the compiler.
of Hi-Tech C
Like anything, quality tends to cost more. The full version is recommended
for a commercial situation, but not suited to a small-time hobbyist on a tight
The best performance is gained by using Hi-Tech C, and CCS C is cheaper. If
you're developing for the 16F84, use the freeware version of Hi-Tech C.
Eliminate the bankX keyword, and give the option for the compiler automatically
organise the variables into banks. The compiler writers specifically designed
it this way to save code space, as it is difficult for the linker to work
out where variables should be stored. However, it would be nice for a future
version. The newest compiler for the 18C PIC micros has no bankX keyword.
A compiler for the 18F series of PIC micros is also available from Hi-Tech
C. Going by their previous track record, it is probably an excellent compiler.
I have had a few emails asking if I resell Hi-Tech C. I forward them all back
to the Hi-Tech C sales office. I can reassure you that I have no vested interest
in Hi-Tech C. My only motivation is that I want people to avoid the headaches
that I had with other inferior compilers.
Compiler: IAR C
From: Zdiode@email@example.com [mailto:Zdiode@firstname.lastname@example.org]
Sent: Wednesday, 20 September 2000 6:30 a.m.
Subject: IAR C
Have you compared with IAR? I have and found that I like Hi-Tech C better,
even though IAR costs substantially more. I have purchased Hi-Tech C and know
it quite well, so I am not a completely objective observer.
IAR C has its own simulator and development environment. If that is what you
are used to then it is a good idea. I am used to MPLAB, though.
I found one bug in the IAR C. If a 1 is written to a port it will clear the
port and increment it. This can cause a glitch condition. I told them about
it and assume the bug is fixed.
One thing I do admire about IAR is that they do NOT allow configuration of
the compiler for the 16C5x and 12c5xx parts. It is a bad idea to use a C compiler
on these parts and they don't let you make a bad choice.
-Bill Grimm Avorex Design
comparison: Hi-Tech C vs. CCS C
Date: Oct 1 14:80:27 2000
Subject: Hi-Tech vs CCS
I just ported some old code from CCS to Hi-Tech and my rom usage dropped from
5100 words to 3200 words. There really is no comparison between the two. With
the price price differance between a 8k part and a 4k part, Hi-Tech C pays
for it self easily.
[This may have been
true on earlier versions of CCS C, however, the latest compiler is extremely
good - Ed.]
Sent: Friday, 13 October 2000 7:19 a.m.
Subject: Comments from Hi-Tech C archive
This site is great, I've used your advice and examples to learn how to use
the HT demo compiler and I was able to solve my appilcation in a Day. I noticed
that Microchip also sells thier own C compiler. I would like to buy one. How
do you choose between HT and Microchip?
Good question. It really
depends on which microprocessor you are going to use.
If you're programming for the 12X series (such as the 12C509) I recommend
assembly. You can use C for extremely simple projects on this series.
I expect you'd be using a micro from the 16X series, such as the 16F84 or
16F876. Hi-Tech C is the best choice. Microchip dropped their compiler support
for the 16X series in favour of the third-party Hi-Tech C compiler. They officially
recommend Hi-Tech C.
If you're going for the 17X series (these are not as widely used as the 16X
series), you can use either the Hi-Tech C compiler or the Microchip compiler.
I have used both, in my opinion the Hi-Tech C compiler produces tighter code.
If you're going for the 18X series, you can use either compiler.
From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]
Sent: Friday, 9 March 2001 2:54 a.m.
Subject: Re: PicC vs. CC5X compiler ?
I used CC5X fora while
before switching to CCS. I found that CC5X was very limited as to complexity
of mathematical operations you could execute as one statement. CCS also has
a lot of included functions for various tasks (serial IO, delays, EEPROM read/write,
analog, etc) -- some good, some not so good. I also have found that trying
to port code from CC5X to any other C compiler requires pretty much a total
rewrite, but CCS is closer to standard ANSI C (notice I did not say it is
ANSI). While using CC5X it was easy to write code, as long as it was simple
code and didn't require too much complexity. With CCS I have found nothing
so far that has been terribly difficult to do. To be fair, I was using the
free version of CC5X, the full version may be better. I think CC5X may produce
better optimized code than CCS. The trade-off for me was a *lot* of development
time. I think there may be places where one would work better than the other,
but for my uses CCS looked like a much better choice, so that's what I switched
to. Hope this helps.
C vs. Assembly
[taken from forum]
I'm in programming of microprocessors from more then 20 years. I used to work
on assembler and my codes really become very tight.
When people compare C code with assembler code they usually compare assembler
code generated from very good programer (with good skills) and C code from
somebody that don't have so big experience in C. It's funny that the C code
is more eficient, portable, bugfree. Well, in some cases, where you have time
limitation, very complicated structures assembler is better. But I told you
- this advantage is only in few cases.
After I began to work with HiTech I sweared - never to touch assembler again.
My productivity increased several times. But if you wish to lose your time
with assembler - it's OK too. Only in some cases you have advantage to do
job on assembler and all these cases are not for beginners.
I even made competition between my program made on assembler and one made
on C. I'm shame to tell you that the C won - the code was less, used less
cells from the RAM.
If you start from the beginning to work with C you'll find very soon the good
results. With assembler you need more time, more patient, more attention,
more knowleges - for the same result.
Your choise. But my advice is - don't skip the opportunity to enjoy the HiTech.
Regards Luben Christov
I tend to agree with Luben. C is extremely good for optimizing a large amount
of code to make it smaller and faster. Its also more portable, to micros like
an Atmel or the 8051.
I like the way that with the use of local variables, one memory location can
be used for heaps of different variables, at different points in execution
in the program (I counted 16 variables in the same memory location, in my
last project). Trying to find the right combination of reusage in assembly
would be extremely difficult, and the program would be extremely brittle.
With C, you are guaranteed to get a working result.
However, I do have one piece of advice: if you need good interrupt service
routines, or extremely time critical code, write them in assembly. However,
this comprises only about 5% of a project, and C is better for the rest.
This site is non-profit. Ad revenue almost covers hosting costs.