I want to write some program in C language for a PIC16F and a PIC18F. I searched in the internet and I got confused with the name of them! I want a free version and I know that my C program is less than 2 KB. Does MPLAB lonely enough? Or I need to install C16? C18? Which one I must install? Can I install both in a single computer?

I found four kind of MPLAB C18 Compiler here.I don't know which one should I use and what is the difference?

Is there any other free software that is better for a beginner? and also be good for biggish project?

And finally what is the difference between MPLAB IDE and MPLAB X IDE and these different CXs (C18 C24 ...)?

Finally please give me a full view about the advantages and disadvantages of different PIC compilers. And give me a good tutorial source about installation steps and the steps to build a simple flashing LED with PICs for step one to getting started with this kind of MCUs.

Note that I am familiar with AVRs and I worked with them about 1 year.

  • 1
    \$\begingroup\$ I don't do enough with PICs to be able to fully answer, but the one you've linked is no longer recommended so try MPLAB X from here: microchip.com/pagehandler/en-us/family/mplabx and take a look. I can't remember if it installs a compiler by default but I think it prompts you and the Microchip ones are free they just don't have the optimization levels of the paid versions. \$\endgroup\$
    – PeterJ
    Dec 20, 2014 at 5:54

1 Answer 1


I've personally found in my limited experience of PIC programming, that the Microchip MPLABX IDE and the XC compilers had all the functionality that I needed. As far as I am aware, the only pitfalls I found were that the free version doesn't allow high compiler optimization of your code, but I didn't find it impacted negatively on what I was doing.

I haven't tried any "free" PIC alternatives, but knowing the amount of pain I went through trying to set up a GCC for GNU compiler in Eclipse, I can say that MPLAB X is an absolute breeze to pick up for beginners.

NOTE: Microchip don't make it obvious, but the C18 compiler you linked is actually an older generation. The XC suite being the new one.

For you, I would recommend getting the MPLAB X IDE and then installing the MPLAB XC8 compiler, which supports PIC12, 16 and 18. (Check under the Downloads button)

I have only the XC16 compiler installed currently, but when I run MPLAB X IDE and click New Project and select a PIC18 as the device, it asks me for a toolchain to work with like so (I'm given a choice between C18 and the XC8 all-in-one, though some PIC16's are only supported by XC8):

enter image description here

Once you have installed the XC8 and the X IDE, in it, you can just click File > New Project, and then under Samples you will find a C template and example "blinky" code for all the targets.

enter image description here

You will also need a picKit for programming or debugging your code on your target.

Don't hesitate to comment if I haven't explained something properly :)

  • 1
    \$\begingroup\$ Your answer is awesome bro :) Thank you very much <3 \$\endgroup\$ Dec 20, 2014 at 6:26
  • \$\begingroup\$ Excuse me dear Longley --> microchip.com/pagehandler/en_us/devtools/mplabxc What is the difference between normal and Part-Support types? from your answer: 1- Download and install MPLAB X IDE 2- Download XC8 Compiler(For PIC10/12/16/18) or XC16(For PIC24F/H, dsPIC30F, dsPIC33F/E). And Also XC16 support some kind of 8-bit MCUs also. Is this right? And without XC compilers I can use MPLAB X IDE to program PICs, But I must write my programs in assembly. In the other word, XC Compilers are the tools that I need if I want to write my programs in C language. Is this right also? \$\endgroup\$ Dec 20, 2014 at 6:53
  • \$\begingroup\$ And also, why I can't see any XC18 there? (There is just XC8 XC16 and XC32) \$\endgroup\$ Dec 20, 2014 at 7:21
  • 1
    \$\begingroup\$ @TheGoodUser-Amir - XC8, XC16, and XC32 are compilers for 8-bit, 16-bit, and 32-bit microcontrollers, respectively. PIC18's are all 8-bits, so the XC8 compiler is the one to use for them. \$\endgroup\$ Dec 20, 2014 at 13:51
  • 1
    \$\begingroup\$ Microchip's naming conventions are quite strange. Pete is correct, XC8 contains all of the compilers for 8-bit PICs (PIC12,16,18). MPLAB X supports both assembly and C, even though your assembly doesn't technically need to be "compiled", it still needs to be "linked", which the XC8 suite can do. If you're working with any 8-bit PICs, all you need is XC8 and MPLAB X IDE \$\endgroup\$
    – Al Longley
    Dec 21, 2014 at 9:21

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.