4.1 Headers for Device-specific Resources

While MPLAB XC8 will build projects using the <avr/io.h> header, consider including <xc.h> instead.

Header files must be included into your project's source files to allow access to many device-specific resources, like special function registers (SFRs), interrupt vector names, and preprocessor macros specifying device configuration. When using AVR-GCC, the <avr/io.h> header will include the appropriate headers to define many of these resources for the selected device. All MPLAB XC projects, including those for MPLAB XC8, typically include <xc.h> as the top-level device-specific header to define the device's resources.

The <xc.h> header includes <avr/io.h>, so the definitions for SFRs and interrupt vectors will be identical, regardless of which header you include into your source files; however <xc.h> also includes other headers and defines other macros. The <xc.h> header must be included if you intend to use any Common C Interface features, described in Common C Interface, in which case the existing inclusion of the <avr/io.h> header can be removed.