Hi every one,

First, please excuse my bad english (I'm from France).





I'm a beginner on MPLAB X IDE 3.26 and I would like to make a little program allowing to light a LED PORT B0 but I get errors that I do not understand. Here is my program named TextXC8 :


TestXC8.h :


/*
* File: TestXC8.h
* Author: dymentional
*
* Created on April 25, 2016, 1:53 PM
*/



// PIC16F1519 Configuration Bit Settings

// 'C' source line config statements

#include <xc.h>
#include <xc.inc>
#include "xc8debug.h"
#include "TestXC8.h"

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

// CONFIG1
#pragma config FOSC = INTOSC // Oscillator Selection (INTOSC oscillator: I/O function on CLKIN pin)
#pragma config WDTE = OFF // Watchdog Timer Enable (WDT disabled)
#pragma config PWRTE = OFF // Power-up Timer Enable (PWRT disabled)
#pragma config MCLRE = OFF // MCLR Pin Function Select (MCLR/VPP pin function is digital input)
#pragma config CP = OFF // Flash Program Memory Code Protection (Program memory code protection is disabled)
#pragma config BOREN = OFF // Brown-out Reset Enable (Brown-out Reset disabled)
#pragma config CLKOUTEN = OFF // Clock Out Enable (CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin)
#pragma config IESO = ON // Internal/External Switchover (Internal/External Switchover mode is enabled)
#pragma config FCMEN = ON // Fail-Safe Clock Monitor Enable (Fail-Safe Clock Monitor is enabled)

// CONFIG2
#pragma config WRT = OFF // Flash Memory Self-Write Protection (Write protection off)
#pragma config VCAPEN = OFF // Voltage Regulator Capacitor Enable bit (VCAP pin function disabled)
#pragma config STVREN = ON // Stack Overflow/Underflow Reset Enable (Stack Overflow or Underflow will cause a Reset)
#pragma config BORV = LO // Brown-out Reset Voltage Selection (Brown-out Reset Voltage (Vbor), low trip point selected.)
#pragma config LPBOR = OFF // Low-Power Brown Out Reset (Low-Power BOR is disabled)
#pragma config LVP = ON // Low-Voltage Programming Enable (Low-voltage programming enabled)


#define _XTAL_FREQ 8000000





TestXC8.c :


/*
* File: TestXC8.c
* Author: Dymentional
*
* Created on April 25, 2016, 2:11 PM
*/



#include <xc.h>
#include <stdio.h>
#include <stdlib.h>
#include <pic16f1519.h>
#include <htc.h>


#define led1 PORTB.F0 //RB0

/*
*
*/
int main(int argc, char** argv) {

OSCCON = 0x72; //Configure le registre OSCCON en oscillateur interne
PORTB = 0b11111111; //Init des pattes du µcontroleur
TRISB = 0b11111110; //Bit 0 du Port B en sortie


/*while (1)
{
LATBbits.LATB0 = ~LATBbits.LATB0; //crée une boucle de 1s
for (int countDelay=0; countDelay <20; countDelay ++)__delay_ms(50);
}
}*/he
while(1)n I
{
//Delay ~1 second (8MHz Internal Clock)
__delay_ms(8000000); //specify clock cycles directly
}

}


And when I build the project :


CLEAN SUCCESSFUL (total time: 302ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory '/home/colin/microchip/colin/TestXC8.X'
make -f nbproject/Makefile-default.mk dist/default/production/TestXC8.X.production.hex
make[2]: Entering directory '/home/colin/microchip/colin/TestXC8.X'
"/opt/microchip/xc8/v1.37/bin/xc8" --pass1 --chip=16F1519 -Q -G --double=24 --float=24 --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=std -P -N255 --warn=-3 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-osccal,-resetbits,-download,-stackcall,+clib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s" -obuild/default/production/TestXC8.p1 TestXC8.c
make[2]: *** [build/default/production/TestXC8.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
TestXC8.c:39: error: (192) undefined identifier "_XTAL_FREQ"
(908) exit status = 1
nbproject/Makefile-default.mk:94: recipe for target 'build/default/production/TestXC8.p1' failed
make[2]: Leaving directory '/home/colin/microchip/colin/TestXC8.X'
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed
make[1]: Leaving directory '/home/colin/microchip/colin/TestXC8.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed

BUILD FAILED (exit value 2, total time: 1s)



What can I do ?

Thank you very much !


Dymentional