Software > Software

Free C compiler for PIC?

(1/3) > >>

trigger:
I'll be working on a PIC 16xFx soon, and I can't find a free C compiler out there (other than the CCS/Hitech demos). I've worked in assembly before and can swing that, but I'd prefer C. Any thoughts?

Edit: I found ONE that is totally free (though demo-limited). It's the CC5X compiler (http://www.bknd.com/cc5x/introduction.shtml). Anyone have any experience with this?  The demo says that it is limited to 1024 instructions in any single C module.  How do they expect us to know how many instructions our code will produce until we compile it?  Weird.

Militoy:

--- Quote ---I'll be working on a PIC 16xFx soon, and I can't find a free C compiler out there (other than the CCS/Hitech demos).
--- End quote ---


Is the "CCS/Hitech demo" that you mentioned Hi-Tech's PICC-Lite? I actually thought that one looked pretty good for a freeware ANSI C compiler - even though it will only target a limited range of PIC12F and PIC16F processors. I had even thought of trying to do a download, and running some canned C code through it to see how it works - though most of my PIC16 code is targeted towards the PIC16F72 - and that apparently doesn't fall into the freeware compiler's capabilities.

http://www.htsoft.com/products/PICClite.php

trigger:

--- Quote from: Militoy on January 11, 2007, 11:51:48 AM ---
--- Quote ---I'll be working on a PIC 16xFx soon, and I can't find a free C compiler out there (other than the CCS/Hitech demos).
--- End quote ---


Is the "CCS/Hitech demo" that you mentioned Hi-Tech's PICC-Lite? I actually thought that one looked pretty good for a freeware ANSI C compiler - even though it will only target a limited range of PIC12F and PIC16F processors. I had even thought of trying to do a download, and running some canned C code through it to see how it works - though most of my PIC16 code is targeted towards the PIC16F72 - and that apparently doesn't fall into the freeware compiler's capabilities.

http://www.htsoft.com/products/PICClite.php

--- End quote ---


CCS has its own demo (30 day limited), and yes, I was referring to PICC-lite when I mentioned Hi-Tech.  I'm concerned by its limitations for my PIC (16F877). It says it only allows "2 RAM banks, 2K program memory supported." Maybe this is plenty, but I don't know. I'm used to programming on PCs, not MCUs, and 2K doesn't sound like a lot. Also, I wonder what it means by "2 RAM banks." Do you know?

Militoy:

--- Quote ---It says it only allows "2 RAM banks, 2K program memory supported." Maybe this is plenty, but I don't know.
--- End quote ---

--- Quote ---Also, I wonder what it means by "2 RAM banks." Do you know?
--- End quote ---

On sheet 12 of the datasheet for the PIC16F877, you'll see that the General Purpose Registers are split up into 4 "banks", each containing up to 7Fh (128 bytes) of 8-bit instructions. It looks to me from sheet 3 that the max number of instructions the chip will hold in program memory is 368 8-bit bytes. The compiler seems to be limited to using 256 bytes. So from what I can gather, with this compiler, you can use 2/3 of available memory for this device.

It will take a better programmer than me to tell you what you can achieve with 256 instruction registers - I'm much more involved with and adept at hardware than firmware, and when I run out of I/O pins (which happens to me way faster than memory) I tend to just add another processor to my bus. This chip also has an instruction set of only 35 1-word instructions. That can work for you, as well as against you. I will say that I've used the "little brothers" of this processor, including the part I mentioned above (with even less memory space), for some fairly complex controllers in military systems - so depending on what you are trying to achieve, you may have plenty of space. As a side note - you are probably already aware that programming in assembly instead of a higher-level language like C will save you memory space.

trigger:

--- Quote from: Militoy on January 11, 2007, 02:54:09 PM ---On sheet 12 of the datasheet for the PIC16F877, you'll see that the General Purpose Registers are split up into 4 "banks", each containing up to 7Fh (128 bytes) of 8-bit instructions. It looks to me from sheet 3 that the max number of instructions the chip will hold in program memory is 368 8-bit bytes. The compiler seems to be limited to using 256 bytes. So from what I can gather, with this compiler, you can use 2/3 of available memory for this device.

It will take a better programmer than me to tell you what you can achieve with 256 instruction registers - I'm much more involved with and adept at hardware than firmware, and when I run out of I/O pins (which happens to me way faster than memory) I tend to just add another processor to my bus. This chip also has an instruction set of only 35 1-word instructions. That can work for you, as well as against you. I will say that I've used the "little brothers" of this processor, with even less memory space, for some fairly complex controllers in military systems - so depending on what you are trying to achieve, you may have plenty of space. As a side note - you are probably already aware that programming in assembly instead of a higher-level language like C will save you memory space.

--- End quote ---

Thanks! This is helpful. Maybe I'll try both CC5X and PICC-lite and see which works out better in the end.

Navigation

[0] Message Index

[#] Next page

Go to full version