MPLAB® XC8 C Compiler

Microchip’s latest compiler line, the MPLAB® XC, provides a comprehensive solution for your project’s development software needs and replaces all MPLAB C and HI-TECH compilers. The MPLAB XC8 compiler:

  • Supports all 8-bit PIC® MCUs
  • Integrates with MPLAB® X IDE to provide a full graphical front end:
    • Editing errors and breakpoints match the corresponding lines in source code
    • Single step through C source code to inspect variables and structures at critical points
    • Data structures with defined data types, including floating point, display in watch windows
  • Runs on Windows, Linux and Mac OS X
  • Offers different optimization levels to suit your needs with FREE downloads available
Click image to enlarge.

 Learn More


 Self-Paced Training

The material in these training modules exists elsewhere on this site in a general reference format. However, the training modules present it in an organized, step-by-step sequence to help you learn the topic from the ground up.

 Frequently Asked Questions

Why does the program counter not reach the start of main()?
Why do I get data corrupted on the stack when using MPLAB® XC8 v1.30 or later?
Why do I get a C syntax error on compiling a rotate left instruction asm("RLF aux, w");?
Unstable Digital Output Pins Behavior
Pointer Comparison Fails
How do you reserve a RAM location/address in the Application code so that the linker does not allocate this memory?
Ensuring Compiler HPA is Recognized
Defining Variables for Common/Shared RAM Addresses
MPLAB® XC8, XC16, XC32 Compiler License Questions
How do you read the EEPROM memory of a PIC18F46J50?
How do you check if your MPLAB® XC compiler license is activated?
Migration from MPLAB® C18 to XC8 Compiler
Can I still use the HI-TECH C Compiler?
Why can’t I build in PRO Mode, even though the client machine is configured to use the Network Server license?
Where can I find the Peripheral Library for MPLAB® XC8/16/32?
C compilers - Casting to an expression is not working
How can I find my MPLAB® XC Compiler Activation key?
How can I move an MPLAB® XC compiler license from one microchipDIRECT account to another?
Hexmate - How can I calculate checksum for my code, and store the result at a particular location?
Why is the compiler removing some of my code?
Where can information about MPLAB XC8 library functions be found?
How can I cancel or renew my MPLAB® XC Compiler subscription license?
Why is the compiler not listed for my target device under MPLAB® X IDE?
Compilers - Can a subscription license be used as a network license?
In the MPLAB® X IDE output window, what does the message "HPA has ended" mean?
Can I remove the license from my machine to install on a newer machine?
How can I renew my HPA?
Why am I encountering errors in my code pointing to missing Peripheral Library routines?
Where can I find older versions of the compiler?
What does the warning "(752) Conversion to shorter data type" mean?
Will HPA make my support for non-compiler related queries faster?
Why do I get a warning "(1273) Omniscient Code Generation not available in Free mode" even though I have a valid license?
How do I change the output.hex file name in MPLAB® X IDE?
The Extended CPU Mode configuration bit is enabled but the program was not built using extended CPU instructions.
Why Does It Take So Long To Build My Project?
Can the XC8 Compiler check for MISRA compliance?
What could cause glitches on an output port?
What could cause pins in a port to change from values I assign to them?
What could cause corrupted variables or code failure when I am using interrupts?
How do I fix errors relating to 'illegal conversion between pointer types' or 'illegal conversion of integer to pointer'?
Why don't the line numbers in an error message match the problematic line of code?
What does an error like "Can’t generate code" mean?
Why do I get the fixup error, and how can I correct it?
Why do I get an "arithmetic overflow in constant expression" message?
Why is the "can’t find space error" message issued even though there is plenty of space left in a device’s memory?
How do I interpret the pointer reference graph in the list file generated by the XC8 compiler?
How do I interpret the call graph in the XC8 list file?
Where can I find the Call Graph produced by the XC8 Compiler?
How can I use the TO and PD bits to determine the cause of reset on PIC® devices?
How do I access a variable in external program space of PIC18 Device?
How do I fill unused program memory with a known value using the XC8 compiler?
How do I position code or variables at a specific location with the XC8 compiler?
How do I ensure declarations are consistent across files?
How do I write and read data from EEPROM using the XC8 compiler?
How do I program the PIC® MCU's ID Locations?
How do I read the OSCCAL value for my PIC® device?
How do I access bits in a RAM variable?
How can I speed up my interrupt service routine?
How do I write interrupt routines in XC8?
How do I create an array of pointers in program space (ROM)?
What does printf() output do in an XC8 program?
Why are some of my variables shown as not used?
Why are SFRs undefined in my assembly code?
How can I create a delay in my XC8 program?
Can I access XC8 C pointers from assembly code?
What do I need to do to C code that assigns an integer to a pointer when migrating this code to the XC8 compiler?
When should I cast an expression?
Do I need to do anything to C source code that contains a #pragma interrupt_level directive with XC8 compiler?
What do I need to do to assembly code that reserves data memory when migrating this code to XC8 compiler?
Do I need to do anything to a project that includes user-defined libraries when porting this to XC8 compiler?
How do I allow C variables to be accessed by assembly code that expects them in certain banks?
Is there any limit to the size of objects I can define?
What are the nesting limits of function calls on 8-bit PIC® devices?
Can I define a function that will be expanded inline?
Does XC8 Compiler support malloc-style functions?
Does the XC8 compiler support the extended instruction set?
Why don’t checksums or fills work when generating a binary output?
How can I reserve memory and prevent it being used by the compiler?
What identifier lengths are supported in the XC8 Compiler?
How can I create a library?
Can I install two or more versions of the XC8 compiler?
How do I install XC8 compiler on a Linux Machine?
How do I install the Mac® version of XC8 compiler?
Where can I find the older compiler versions?
Where can I find information about compiler messages?
Does the same XC8 Compiler serial number work with Windows, OS X and Linux compilers?
Are administrator rights required to use the compiler in MPLAB® X IDE?
What is HPA (High Priority Access)?
Do you support this device?
© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.