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:
#include<xc.h>
// CONFIG1L
#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)
// CONFIG1H
#pragma config CP0 = OFF // Code Protection bit (Program memory is not code-protected)
// CONFIG2L
#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)
// CONFIG2H
#pragma config WDTPS = 32768 // Watchdog Timer Postscaler Select bits (1:32768)
// CONFIG3L
// CONFIG3H
#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:
#include<xc.h>
#include"config.h"
#define _XTAL_FREQ 8000000
void main()
{
TRISB=0X00;
PORTB=0X00;
while(1)
{
PORTB=0XFF;
__delay_ms(1000);
PORTB=0X00;
__delay_ms(1000);
}
}
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' failedmake[2]: Leaving directory
'/Users/saiteja/MPLABXProjects/TEST.X/example.X'
nbproject/Makefile-default.mk:84: recipe for target '.build-conf' failed
make[1]: Leaving directory
'/Users/saiteja/MPLABXProjects/TEST.X/example.X'
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)