If you look at older PIC programming tutorials, you might see code that includes files like or . Microchip has deprecated this approach in favor of xc.h for several reasons:
It unlocks compiler-specific intrinsics, such as cycle-accurate delay functions ( __delay_ms() and __delay_us() ). Step-by-Step Guide to Downloading the xc.h Library
Using quotes #include "xc.h" tells the compiler to look in the current project folder , whereas angle brackets tell it to look in the system include paths . xc.h library download
You should see xc.h along with hundreds of supporting headers (e.g., pic.h , avr.h , i2c.h ).
#include <xc.h> #include <stdint.h>
void startElement(void *data, const char *element, const char **atts) printf("Start element: %s\n", element);
is integrated into the compiler, you obtain it by downloading the appropriate compiler version for your architecture: If you look at older PIC programming tutorials,
file is part of different compiler suites depending on your hardware: : For 8-bit PIC and AVR microcontrollers. : For 16-bit PIC and dsPIC devices. : For 32-bit PIC and SAM devices. Microchip Technology 2. Download and Installation Steps Visit the Official Site : Go to the MPLAB XC Compilers Select Your OS : Choose the installer for Windows, Linux, or macOS. Run the Installer : Follow the prompts. You can use the , which includes all necessary headers like but with fewer code optimizations. Add to Path
Last updated: 2025. Information accurate for XC8 v2.40+, XC16 v2.20+, XC32 v4.20+. You should see xc
To summarize: . The file is a proprietary component of Microchip’s XC compiler toolchain. The safe, professional, and reliable method is to:
Note: All XC compilers are available in a free "Community Edition" which provides full functionality and standard optimization levels. How to Install and Verify xc.h