please dont rip this site

PIC Micro Controller C/C++ Languages

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 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 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  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 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 C-compiler runs on Win-95, DOS and Linux and compiles for PIC and SX

CC5X optomizing C-compiler (free limited version, up to 1 kB, integrates with MPLAB?) all 14- and 12-bit PIC

CCS  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 70 to 100 pounds UK. Grew from: PicC  C-Compiler $59, source level debugger $79. ?

pico-C produces assembler code (free)

Visual C free demo


SDCC the Small Device C Compiler

Several people have started developing IDEs to connect to SDCC.

Small-C for the PIC'84 http:// John Favata's modification of Small-C for the PIC '84 that generates Parallax SPASM assembly code. A free beta release of a new PIC18Cxxx compiler




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:



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.
file: /Techref/microchip/language/cs.htm, 11KB, , updated: 2016/5/2 07:57, local time: 2024/7/12 16:54, owner: SM-SRTS-QCA,

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF=""> PIC Micro Controller C/C++ Languages</A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.

Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

  PICList 2024 contributors:
o List host: MIT, Site host, Top posters @none found
- Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!