There is a constant flow of debate over the use of C or Assembly to program microcontrollers. While it is true that C compilers may generate less efficient code from a quickly written line of C than a human working in hand coded / hand optimized assembly, in most cases, well written C compilers can come very close. In some cases, a C compiler can optimize code in a way that would be very difficult for a human, even surpassing well written human assembly when very complex constructs are involved. Byte Craft did an interesting test on one of thier C compilers^ where they verified that for every instruction in the processors instruction set, there is some C sequence that compiles into that single instruction. At least with that compiler, for every possible Assembly program there exists a C program that generates the same (if not less) code.
C17/C18 http://www.microchip.com/1010/pline/tools/picmicro/code/mplab18/index.htm The "official" Microchip versions of C. That link will most likely be wrong in a few days since Microchip apparently rearranges the web site on a weekly basis, but if you go to microchip.com and search for C18, you will find it.
Data Types, size and range:TYPE SIZE RANGE char(1,2) 8 bits -128 127 signed char 8 bits -128 127 unsigned char 8 bits 0 255 int 16 bits -32,768 32,767 unsigned int 16 bits 0 65,535 short 16 bits -32,768 32,767 unsigned short 16 bits 0 65,535 short long 24 bits -8,388,608 8,388,607 unsigned short long 24 bits 0 16,777,215 long 32 bits -2,147,483,648 2,147,483,647 unsigned long 32 bits 0 4,294,967,295 float 32 bits 1.17549435 e-38 to 6.80564693 e+38 double 32 bits 1.17549435 e-38 to 6.80564693 e+38
Byte Craft http://www.bytecraft.com/ MPC (Microchip PIC Compiler). ByteCraft developed the first C compiler for the PIC and Microchip licensed that code as a start on MPLAB C although it has been developed seperatly since then. MPC goes for $1,750.00^ USD. There is a demo version, but I have no information on the limitations.
Hi-Tech http://www.htsoft.com/ FREE! PICC-Lite is essentially the same as our full-featured, industrial grade PICC compiler, support is limited to the 16F877, 16F877A, 12F675, 12F629, 16F627, 16C84, 16F84 and 16F84A devices. MPLAB compatible. In March 2009, Microchip aquired Hi-Tech and will narrow thier focus to Microchip products.
C2C http://www.geocities.com/SiliconValley/Network/3656/c2c/c.html C-compiler runs on Win-95, DOS and Linux and compiles for PIC and SX
CC5X http://www.bknd.com/ optomizing C-compiler (free limited version, up to 1 kB, integrates with MPLAB?) all 14- and 12-bit PIC
CCS http://ccsinfo.com/ C-Compiler (usefull examples can be downloaded) James Newton says: "Based on (clumsy) link spamming, shoddy support for the SX (PIC clone) and bad personal experiences, I do NOT recommend this compiler. Your milage may vary."
Wiz-C http://www.fored.co.uk 70 to 100 pounds UK. Grew from: PicC http://members.aol.com/piccompile/products.htm C-Compiler $59, source level debugger $79. ?
pico-C http://personal.eunet.fi/pp/jokinen/ produces assembler code (free)
Visual C http://home.t-online.de/home/Swen.Gosch/epic.htm free demo
Linux:
SDCC the Small Device C Compiler
Several people have started developing IDEs to connect to SDCC.
Small-C for the PIC'84 http://http://www.gnupic.org/compile/pic_cc.zip John Favata's modification of Small-C for the PIC '84 that generates Parallax SPASM assembly code.
http://ejames2.freeyellow.com/GGC.htm A free beta release of a new PIC18Cxxx compiler
Also:
Comments:
Questions:
PIC C compiler from Microchip has disappeared. I do not find it any where. Also C17 compiler doesn't support PIC16 CPUs. Is that correct. I got error message for 16F628 and other CPUs. Is there any solution. Is Microchip C compiler is available for download.
Ned T Konz of MetaMagix Says:
The PIC C compiler from Microchip has hardly disappeared. They just don't have any support for the 12-bit and 14-bit parts.
But you can get demos of the C17 and C18 compilers. The C18 especially bears looking at; it produces good code and is reasonably ANSI compatible.
See also:
http://www.microchipc.com/ Shane Tolmie
http://www.microchipc.com/
hosts a discussion forum for people who program Microchip PIC micros with C. He mostly uses Hi-Tech C, but seems open to other C compilers.
Questions:
Interested:
C2C with SourceBoost has an excellent PIC16xxx simulator with it, which requires no additional hardware, AND has 'plug-in' simulated hardware (like LED's, buttons, even an 8-bit logic analyzer).
You should be aware that C2C is a subset of Ansi C, with 8 and 16-bit unsigned math only. However, the assembly output is very easy to follow.
The CCS-C compiler is Ansi-C with extensions for the PIC. However, it's source-level debugger requires attached PIC hardware to work.