As per the Microchip's guidelines, I downloaded MPLAB X IDE 3.8v and also installed the XC8 compiler version 1.38. I wrote the following example code for blinking LEDs:

Configure registers like this:


#pragma config WDTEN = OFF      // Watchdog Timer Enable bit (WDT disabled (control is placed on SWDTEN bit))
#pragma config STVREN = ON      // Stack Overflow/Underflow Reset Enable bit (Reset on stack overflow/underflow enabled)
#pragma config XINST = ON       // Extended Instruction Set Enable bit (Instruction set extension and Indexed Addressing mode enabled)

#pragma config CP0 = OFF        // Code Protection bit (Program memory is not code-protected)

#pragma config FOSC = ECPLL     // Oscillator Selection bits (EC Oscillator, PLL enabled, CLKO on RA6)
#pragma config FCMEN = ON       // Fail-Safe Clock Monitor Enable bit (Fail-Safe Clock Monitor enabled)
#pragma config IESO = ON        // Two-Speed Start-up (Internal/External Oscillator Switchover) Control bit (Two-Speed Start-up enabled)

#pragma config WDTPS = 32768    // Watchdog Timer Postscaler Select bits (1:32768)


#pragma config CCP2MX = DEFAULT // ECCP2 MUX bit (ECCP2/P2A is multiplexed with RC1)
#pragma config MSSPMSK = MSK7   // MSSP Address Masking Mode Select bit (7-Bit Address Masking mode enable)

// #pragma config statements should precede project file includes.
// Use project enums instead of #define for ON and OFF.

And my code is:



#define _XTAL_FREQ 8000000

void main()












The issue is:

config.h:13: error: (1504) the PIC18 extended instruction set was enabled

but is not supported by this compiler

(908) exit status = 1

nbproject/Makefile-default.mk:100: recipe for target
'build/default/production/main.p1' failed

make[2]: Leaving directory


nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed

make[1]: Leaving directory


nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

make[2]: *** [build/default/production/main.p1] Error 1

make[1]: *** [.build-conf] Error 2

make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 468ms)


1 Answer 1


The error is pretty self-explanatory..

config.h:13: error: (1504) the PIC18 extended instruction set was enabled

It means that the MPLAB XC8 compiler (which is based on the HI-TECH C compiler) does not support PIC18's extended instruction set.

Change this line:

#pragma config XINST = ON

to this:

#pragma config XINST = OFF

And it should work fine.

Additional info:

The compiler support all instruction sets for PIC10/12/16 devices as well as the standard (legacy) PIC18 instruction set. The extended instruction mode available on some PIC18 devices is not currently supported. Ensure you set the Configuration bits to use the PIC18 legacy instruction mode when appropriate.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.