Electronic – Why does MPLAB IDE has so many compilers

compilermicrocontrollerpicprogramming

I have learnt that the MPLAB IDE has different compilers like C18, XC8 and HI-Tech.

I want to know the following things:

  1. Why are there different compilers when one can do the job?
  2. Are certain compilers only used for specific microcontrollers?
  3. Are there more compilers than these 3 that I need to be aware of?
  4. If any compiler can be used for say compiling PIC18F code, then what decides which one I choose? I really want to know how to decide which one to go with.

Best Answer

Why are there different compilers when one can do the job?

Because people improve them over time.

C18 has been superseded by XC8. C18 is old and rubbish, so they made XC8 which is much better. They also took the opportunity to name it something more logical.

HI-Tech is a third party compiler written by someone else that Microchip bought the rights to. It's also deprecated in favour of XC8.

Are certain compilers only used for specific microcontrollers?

Yes. As new chips are released the compiler has to support them. Old compilers that don't get updated won't support the new chips.

Are there more compilers than these 3 that I need to be aware of?

There is also the open source SDCC compiler, but it's very basic and only has partial PIC support, and doesn't (as far as I know) work with MPLAB.

Another one, which uses its own IDE, is called CCS, though I have never used it.

If you don't like C, then there are a number of BASIC compilers for 8-bit PIC chips, including Swordfish.

If any compiler can be used for say compiling PIC18F code, then what decides which one I choose? I really want to know how to decide which one to go with.

That's simple - you choose XC8 since it's the currently supported one. All the others are old and deprecated.