- Compiler
- A compiler is computer software that transforms computer code written in one programming language (source language) into another programming language (target language). The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower-level language.
If you are a developer writing your application code in C, you'll need to download the MPLAB® XC Compiler that takes care of converting your C code to assembly language (the language the microcontroller understands).
The MPLAB XC Compiler then launches the assembler which takes that assembly code, converts it to machine code, and outputs it into an Intel HEX file.
Note:
Intel HEX consists of lines of ASCII text that are separated by a line feed and/or carriage return. "Each text line contains hexadecimal characters that encode multiple binary numbers. The binary numbers may represent data, memory addresses, or other values, depending on their position in the line and the type and length of the line." ("Intel HEX," n.d.)
That HEX file is programmed into the target microcontroller and contains the binary code (1s and 0s) that the MCU needs to work.
Microchip offers three different MPLAB XC compilers. The MPLAB XC8 C compiler which is used for all 8-bit devices including the PIC10, PIC12, PIC16, and PIC18 MCUs. The MPLAB XC16 for all 16-bit devices including PIC24 MCUs, dsPIC30, and dsPIC33. The MPLAB XC32 for all 32-bit devices including the PIC32MX and PIC32MZ families.
Each compiler is available for Windows®, MacOS® X, and Linux® hosts.
The compilers can be run in two different modes, free or pro. These modes set the level of optimization when compiling a project and they determine how much memory your code will require and how fast your code will execute. The pro mode can be unlocked with the purchase of a license.