PIC Microcontroller Compiler Types and Introduction

This article is about the PIC microcontroller compiler. We will discuss different types of pic microcontroller compilers, their introduction, their features, and the main characteristics of these pic microcontroller compilers. If you do not know what a compiler is, you probably have not come across programming languages ever. So let’s start with a basic introduction to compilers, and then we will tell about three major compilers used to program PIC microcontrollers.

Introduction to Compiler

If we look around ourselves, then we have so many automatic systems. In all these automatic systems, the embedded system plays a very important role in their automation. Similarly, the microcontroller is also a very essential part of this system, and different types of microcontrollers are currently in use in these systems, such as PIC or Atmel. The programming of these microcontrollers is not direct; rather, they require a compiler for their programming, and each type of microcontroller has a separate compiler. The compiler basically converts the source language into a program language, which is the target language of any system. In other words, the compiler converts the high-level language into machine language or binary instructions. Suppose we look at a simple example of a programming language; usually it is the “Hello World” program. For a simple hello world program, refer to the code below.

#include <stdio.h>

Void main ()

{

print ("Hello, world!");

}

We can print this basic “Hello World” program on any LCD or computer screen. This is not so simple; there are so many complex things behind it. In the above example, we write the code in C, which is a high-level language. The computer or controller can’t understand this high-level language because it only understands machine-language or assembly-level language. To make the computer or controller understand this code, we would have to convert it into a low-level language, such as machine-level language. This is only done through the compiler. We can see the compiler process drawing in the figure below. It shows how the source files convert into object files and program files.

compiler process drawing
The compiler process drawing

Different types of compilers are available on the market, but here we will only talk about the best PIC microcontroller compilers, which are easily available on the market.

Best PIC Microcontroller Compilers

  1. MPLAB XC8 C Compiler
  2. MPLAB XC16 C Compiler
  3. MPLAB XC32 C Compiler
  4. Mikro C Compiler
  5. PIC CSS Compiler

MPLAB XC8 C PIC Microcontroller Compiler

The MPLAB XC8 C Compiler is the best compiler, and it only supports 8-bit PIC microcontrollers such as PIC 10, PIC 12, and PIC 18. It is also known as an ANSI C compiler. It is developed by “microchip” to program the PIC microcontrollers. This is free to use and is available on the Microchip official website. To install this compiler, first we need to install the MPLAB software, then we can install the XC8 compiler. It is also available on the official Microchip website. In this compiler, the user writes the code in C, and then the compiler converts this code into assembly language. The size of its latest installation package is 75MB. It is a more flexible compiler. When we write code, we need to imagine that we are writing on a PIC microcontroller. It is very easy to use for beginners.

MPLAB XC16 C PIC Microcontroller Compiler

MPLAB XC16 C Compiler is a version of the MPLAB XC compiler, but this version only supports 16-bit PIC microcontrollers such as PIC 24F, PIC 24H, PIC 24E, DSPIC 30F, DSPIC 33F, and DSPIC 33E. This version of the compiler has the same features as the XC8 C compiler, only the bits of the microcontrollers differ. It is easy to use, and its setup is available on the Microchip official website.

MPLAB XC 32C PIC Microcontroller Compiler

The MPLAB XC32 C Compiler is also a version of the MPLAB XC compiler, but it only supports the programming of 32-bit microcontrollers such as PIC32 MZ, PIC32 MX, and PIC32 MM. It also has the same features as the XC8 C compiler, only the bits of the microcontrollers differ. It is also easy to use and quick to learn. This compiler is available on the Microchip official website. We can see all the MPLAB XC C compilers in the figure below.

MPLAB pic microcontroller compiler
MPLAB XC C compiler window

MikroC  for PIC Microcontroller Compiler

The Mikro C compiler is the second-best compiler on our list. It is developed by the Mikroelektronika company. It supports and programs all types of PIC microcontrollers. This is not free, but its student version is totally free and is available on the Mikroelektronika official website. It is easy to use and has a friendly environment for all users. It has over 600 functions in its library. This compiler has a powerful IDE with additional software tools. It is compatible with the Mikroelektronika development board for a friendly user interface. When the user purchases it, he will pay only once because it has an auto-update setting and always supports the new chip families.

Its efficient debugging process means it debugs the whole program step-by-step and fast. It has the TFT window in its library, which has graphical user interface tools. We can close this window by seamlessly pressing the keyboard shortcut F12. The user can easily drag and drop the graphic elements while the compiler generates the code automatically by using the background source. This MicroC compiler also has integration of tools such as the LCD custom character tool, UART terminals, UDP terminals, HID terminals, ASCII chart, GLCD bit map editor, seven segment editors, active comments editor, advanced statistics, etc. The features in every version of MikroC are almost the same. For reference Its window is shown in the figure below.

Mikro c for pic microcontroller compiler
MikroC Compiler Window

PIC CSS Microcontroller Compiler

The PIC CSS compiler is the third-best compiler on our list. It was developed by a CSS development company over 20 years ago. It provides software solutions in embedded systems for PIC microcontrollers and DSC devices. This compiler is quick to learn and easy to use for users who have less experience in the field of programming or software use. It has a textbook with details and deep explanations of the C language and how to apply it to PIC microcontrollers. This compiler has pro-level optimization, which means the memory size of the instructions, hardware stack size, peripheral resources, functionality of pins and memory banks, etc.

It has the largest built-in functional library, such as data types (int1, int32, short, long, and float, etc.), standard C syntax (if, else, while, do, switch, and break, etc.), and powerful pre-processor commands for the PIC microcontroller. This includes ready-to-run examples of programs for user understanding. It has the facility to migrate from one microcontroller to another. This compiler covers each type of PIC microcontroller. It has standard C constructs and peripheral drivers with minimum development time. There are so many convenient functions, such as #bit and #byte, etc. It also has bits and interrupts to manage and define facilities. We can see its window in the figure below:

PIC CCS pic microcontroller compiler
PIC CSS compiler window

Difference Between Best PIC Microcontroller Compilers

In the above descriptions, we have explained different types of C compilers, but there is not much difference between all the compilers. If we talk about the back-end-generated machine code, then these are almost the same, but if we talk about their syntax in the C language, then these are quite different from each other. Suppose we are working on an LCD. To display anything on the LCD screen, the print command would be different for different compilers. Therefore, switching any user from one compiler to another is not quite difficult. We just have to understand the differences between libraries and the syntax of these compilers.

Conclusion

In conclusion, this article provides an in-depth overview of different compilers for PIC microcontrollers. It covers MPLAB, MikroC, and, lastly, CSS compilers for C programming of PIC microcontrollers to help us better understand the differences between each compiler. At the end, we discuss the differences between these compilers. You can utilize this and choose the one that suits your taste. Hopefully, this article was helpful in expanding your knowledge about the best compilers for PIC microcontrollers.

You may also like to read:

This concludes today’s article. If you face any issues or difficulties, let us know in the comment section below.

2 thoughts on “PIC Microcontroller Compiler Types and Introduction”

Leave a Comment