Author Topic: problem when build program with mplab x  (Read 5069 times)

0 Members and 1 Guest are viewing this topic.

Offline wasabiTopic starter

  • Newbie
  • Posts: 4
  • Country: my
problem when build program with mplab x
« on: September 21, 2016, 09:13:24 pm »
hello, i'm new here. and i need some help from you.. i have make new project using mplab x and when i want to 'build project' it show error.this is my screenshot.



and this is my source code:

Quote
#define        KEYPAD_PORTA
#define EEPROM
#define        BLINK
#define TIMER0
#define ADC
#define        UART
#define        I2C
#define        HD44780
#define        DS1307
#define        IN                  PORTBbits.RB0
#define        RELAY1              PORTBbits.RB1
#define SET_GAS             50      //set gas at 50%
#define        PASSWORD_DIGIT      8                //digit password
#define        MEMORY_PASSWORD     10                //start password memory
#define        MEMORY_PHONE        90      //start password phone
#define        UART_BUFFER         200
#define BAUDRATE_GSM        9600

#include "LibraryHardware.h"
#include "LibraryPeripheral.h"
#include "LibraryUniversalDisplay.h"
#include "LibraryMath.h"
#include "LibraryChipI2C.h"
#include "LibraryKeypadPassword.h"
#include "LibraryGSM.h"
#include "LibrarySound.h"

__EEPROM_DATA(1,1,0,0,0,0,0,0);
__EEPROM_DATA(0,0,'0','0','0','0','0','0');
__EEPROM_DATA('0','0',0,0,0,0,0,0);

unsigned char data[UART_BUFFER];
char mode=0,count=0,keypad=0,sound,backlight,user[2],array[16];
char temp[2],message[UART_BUFFER],sensor,pass[PASSWORD_DIGIT];
int gas;

static void interrupt isr(void)
{
if(RCIF==1){
    get_phone_message(data);}
if(TMR0IF==1){
    TMR0IF=0;
    TMR0=6;
    blink_display();
    reset_yz();
    #if defined (DS1307)
        scroll_counter(_XTAL_FREQ/4000,42);
    #endif
}
}

void setup()
{
int i;
initialize();
TRISA=0b00001111;
TRISB=0b00000001;
TRISC=0b10000000;
TRISD=0b00000000;
TRISE=0b00000000;
timer0(8);
enable_tmr0();
enable_rc1();
BUZZER=1;
sms_init(BAUDRATE_GSM);
#if defined (DS1307)
    rtc_init();                         //initialize I2C
#endif
lcd_init();
user[0]=EEPROM_read(0);                                        //for no password
sound=EEPROM_read(1);
backlight=EEPROM_read(2);
user[1]=EEPROM_read(3);                                        //for no of phone no
lcd_goto(0,0);                                                //select first line
lcd_string("   GSM MODEM    ");
while(gsm_ready(data)!=1) continue;
lcd_goto(0,1);                                                //select second line
lcd_string("     READY      ");
delay(1000);
sms_delete(1);
for(i=0;i<16;i++) array=' ';
#if defined (DS1307)
    scroll_pos=0;
#endif
gas=map(adc_read(12),0,1023,0,100);
if(gas>SET_GAS) sensor=(sensor<<1)|1;
else sensor=(sensor<<1);
sensor=sensor&0x03;   
}

void loop()
{
int i,j;
LCD_LIGHT=!backlight;
#if defined (DS1307)
    for(i=0;i<7;i++) rtc=rtc_get(i);
#endif
keypad=read_keypad();
if(keypad>0){
    if(sound==0) BUZZER=0;
    delay(100);
    if(sound==0) BUZZER=1;
    delay(100);}

gas=map(adc_read(12),0,1023,0,100);
if(gas>SET_GAS) sensor=(sensor<<1)|1;
else sensor=(sensor<<1);
sensor=sensor&0x03;
if(sensor==1) mode=SEND_SMS;
if(sms_receive(data)==1) mode=RECEIVE_SMS;

switch(mode){
case 0:{
    lcd_goto(0,0);
    lcd_string("   INTRUDERS : ");
    lcd_number(gas,DEC,3);
    lcd_string("%   ");
    #if defined (DS1307)
        scroll_time_date(rtc,1);
    #else
        lcd_goto(0,1);
        lcd_string("                ");
    #endif

    switch(keypad){
    case 12:{
        if(user[0]>0){
            mode=1;
            lcd_goto(0,0);
            lcd_string("Key In Password ");
            lcd_goto(0,1);
            lcd_string("                ");}
        else mode=2;
        count=0;
    break;}
    case 17:{
        mode=2;
    break;}}
break;}

case 1:{
    count=keypad_keyin(ACCESS,keypad,pass,count,1);
    if(keypad==11) mode=0;

    if(count==PASSWORD_DIGIT){
        temp[0]=password_check(ACCESS,user[0],pass,PASSWORD_DIGIT,MEMORY_PASSWORD,1);
        if(temp[0]==1) mode=2;
        else mode=0;}
break;}

case 2:{
    lcd_goto(0,0);
    lcd_string("   Admin Mode   ");
    lcd_goto(0,1);
    lcd_string(" Press A,B,C,D  ");

    switch(keypad){
    case 1:{
        RELAY1=!RELAY1;
        delay(200);
    break;}
    case 11:{
        mode=0;
    break;}
    case 13:{
        mode=3;
        lcd_goto(0,0);
        lcd_string("Set Password    ");
        lcd_goto(0,1);
        lcd_string("                ");
        delay(1000);
    break;}
    #if defined (DS1307)
        case 14:{
            mode=8;
            lcd_goto(0,0);
            lcd_string("Set Time & Date ");
            lcd_goto(0,1);
            lcd_string("                ");
            delay(1000);
        break;}
    #endif
    case 15:{
        mode=9;
        lcd_goto(0,0);
        lcd_string("Set Phone Number");
        lcd_goto(0,1);
        lcd_string("                ");
        delay(1000);
    break;}
    case 16:{
        mode=14;
        lcd_goto(0,0);
        lcd_string("Set Others      ");
        lcd_goto(0,1);
        lcd_string("                ");
        delay(1000);
    break;}}
break;}

case 3:{
    lcd_goto(0,0);
    lcd_string(" NO OF PASSWORD ");
    lcd_goto(0,1);
    lcd_string("       ");
    lcd_number(user[0],DEC,2);
    lcd_string("       ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 15:{
        mode=4;
        count=0;
    break;}
    case 16:{
        mode=5;
    break;}
    }
break;}

case 4:{
    lcd_goto(0,0);
    lcd_string("  ADD PASSWORD  ");
    lcd_goto(0,1);
    lcd_string("    Press #     ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 12:{
        if(user[0]==10){
            lcd_goto(0,1);
            lcd_string("  Password Full ");
            delay(1000);}
        else{
            mode=6;
            count=0;
            lcd_goto(0,1);
            lcd_string("                ");}
    break;}
    case 15:{
        mode=5;
    break;}
    case 16:{
        mode=3;
    break;}
    }
break;}

case 5:{
    lcd_goto(0,0);
    lcd_string(" DELETE PASSWORD ");
    lcd_goto(0,1);
    lcd_string("    Press #     ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 12:{
        if(user[0]>0){
            mode=7;
            count=0;}
        else{
            lcd_goto(0,1);
            lcd_string("  No Password   ");
            delay(1000);}
    break;}
    case 15:{
        mode=3;
    break;}
    case 16:{
        mode=4;
    break;}
    }
break;}

case 6:{
        count=keypad_keyin(SAVE,keypad,pass,count,1);
        if(keypad==11) mode=3;

    if(count==PASSWORD_DIGIT){
        temp[0]=password_check(SAVE,user[0],pass,PASSWORD_DIGIT,MEMORY_PASSWORD,1);
            if(temp[0]==1) EEPROM_write(0,++user[0]);
        mode=3;}
break;}

case 7:{
    if(user[0]==0) mode=3;

    lcd_goto(0,0);
    lcd_string("  PASSWORD ");
    lcd_number(count+1,DEC,2);
    lcd_string("   ");
    lcd_goto(0,1);
    lcd_string("    ");
    for(i=0;i<PASSWORD_DIGIT;i++) lcd_write(EEPROM_read(PASSWORD_DIGIT*(count)+i+MEMORY_PASSWORD));
    lcd_string("    ");

    switch(keypad){
    case 11:{
        mode=3;
    break;}
    case 12:{
        pass[0]=count+1;
        pass[1]=PASSWORD_DIGIT*(user[0]-count-1);
        pass[2]=PASSWORD_DIGIT*count+MEMORY_PASSWORD;
        password_check(DELETE,user[0],pass,PASSWORD_DIGIT,MEMORY_PASSWORD,1);
        EEPROM_write(0,--user[0]);
        count=0;
    break;}
    case 15:{
        if(count<user[0]-1) count++;
        else count=0;
    break;}
    case 16:{
        if(count>0) count--;
        else count=user[0]-1;
    break;}}
break;}

#if defined (DS1307)
    case 8:{
        if(keypad==11){
            set=0;
            mode=2;}
        set=set_time_date(keypad,set,rtc,0);
    break;}
#endif

case 9:{
    lcd_goto(0,0);
    lcd_string(" NO OF PHONE NO ");
    lcd_goto(0,1);
    lcd_string("       ");
    lcd_number(user[1],DEC,2);
    lcd_string("       ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 15:{
        mode=10;
        count=0;
    break;}
    case 16:{
        mode=11;
    break;}
    }
break;}

case 10:{
    lcd_goto(0,0);
    lcd_string("  ADD PHONE NO  ");
    lcd_goto(0,1);
    lcd_string("    Press #     ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 12:{
        if(user[1]==10){
            lcd_goto(0,1);
            lcd_string("  Phone No Full ");
            delay(1000);}
        else{
            mode=12;
            count=0;
            lcd_goto(0,1);
            lcd_string("                ");}
    break;}
    case 15:{
        mode=11;
    break;}
    case 16:{
        mode=9;
    break;}
    }
break;}

case 11:{
    lcd_goto(0,0);
    lcd_string(" DELETE PHONE NO ");
    lcd_goto(0,1);
    lcd_string("    Press #     ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 12:{
        if(user[1]>0){
            mode=13;
            count=1;}
        else{
            lcd_goto(0,1);
            lcd_string(" No Phone Number");
            delay(1000);}
    break;}
    case 15:{
        mode=9;
    break;}
    case 16:{
        mode=10;
    break;}
    }
break;}

case 12:{
    switch(keypad){
    case 1: case 2: case 3:
    case 4: case 5: case 6:
    case 7: case 8: case 9:
    case 10:{
        phone1[count]=keypad%10+'0';
        lcd_goto(count+2,1);
        lcd_write(phone1[count]);
        count++;
        phone1[count]=0;
    break;}
    case 11:{
        mode=10;
    break;}
    case 12:{
        count--;
        lcd_goto(count+2,1);
        lcd_write(' ');
        phone1[count]=1;
    break;}
    case 16:{
        temp[0]=phone_check(SAVE,user[1],phone1,count,MEMORY_PHONE,1);
        if(temp[0]==1) EEPROM_write(3,++user[1]);
        mode=9;
    break;}
    }
break;}

case 13:{
    if(user[1]==0) mode=9;

    lcd_goto(0,0);
    lcd_string("  PHONE NO ");
    lcd_number(count,DEC,2);
    lcd_string("   ");
    lcd_goto(0,1);
    lcd_string("  ");
    i=0;
    temp[0]=1;
    while(temp[0]!=0){
        temp[0]=EEPROM_read(15*(count-1)+i+90);
        if(temp[0]!=0) lcd_write(temp[0]);
        else lcd_write(' ');
        i++;}
    while(i<14){
        lcd_write(' ');
        i++;}

    switch(keypad){
    case 11:{
        mode=11;
    break;}
    case 12:{
        if(count!=user[1]){
            for(i=0;i<(15*(user[1]-count));i++)
                EEPROM_write(15*(count-1)+i+MEMORY_PHONE,EEPROM_read(15*count+i+MEMORY_PHONE));}

        EEPROM_write(3,--user[1]);
        lcd_goto(0,1);
        lcd_string("Phone No Deleted");
        count=1;
        delay(1000);
    break;}
    case 15:{
        if(count<user[1]) count++;
        else count=1;
    break;}
    case 16:{
        if(count>1) count--;
        else count=user[1];
    break;}}
break;}

case 14:{
    lcd_goto(0,0);
    lcd_string("     SOUND      ");
    lcd_goto(0,1);
    lcd_string("      ");
    if(sound==0) lcd_string("ON ");
    else lcd_string("OFF");
    lcd_string("       ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 12:{
        sound=!sound;
        EEPROM_write(1,sound);
    break;}
    case 15: case 16:{
        mode=15;
    break;
    }}
break;}

case 15:{
    lcd_goto(0,0);
    lcd_string("   BACKLIGHT    ");
    lcd_goto(0,1);
    lcd_string("      ");
    if(backlight==0) lcd_string("ON ");
    else lcd_string("OFF");
    lcd_string("       ");

    switch(keypad){
    case 11:{
        mode=2;
    break;}
    case 12:{
        backlight=!backlight;
        EEPROM_write(2,backlight);
    break;}
    case 15: case 16:{
        mode=14;
    break;
    }}
break;}

case SEND_SMS:{
    if(user[1]>0){
        lcd_goto(0,0);
        lcd_string("    SENDING     ");
        lcd_goto(0,1);
        lcd_string("    MESSAGE     ");

        delay(1000);

        lcd_goto(0,0);
        lcd_string("      GSM       ");
        lcd_goto(0,1);
        lcd_string("  INTRUDERS DETECT  ");

        for(i=0;i<user[1];i++){
            for(j=0;j<15;j++){
                phone1[j]=EEPROM_read(MEMORY_PHONE+15*i+j);
                if(phone1[j]==0) break;}

                sms_send(phone1);
                sms_string("WARNING, there is INTRUDERS detected in your home.");        //Text message
                sms_end();
                delay(5000);}}
    else{
        lcd_goto(0,0);
        lcd_string("  PHONE NUMBER  ");
        lcd_goto(0,1);
        lcd_string("   NOT EXIST    ");
        delay(1000);}
    mode=0;
break;}

case RECEIVE_SMS:{
    lcd_goto(0,0);
    lcd_string("    MESSAGE     ");
    lcd_goto(0,1);
    lcd_string("    RECEIVE     ");

    beep(2);
    text_mode();
    sms_read(data,1,phone1,message);
    sms_delete(1);
    count=shift_array(2,phone1);    //+601xxxx -> eliminate +6

    temp[0]=phone_check(ACCESS,user[1],phone1,count,MEMORY_PHONE,1);
    temp[1]=sms(message);

    if(temp[0]==1){
    switch(temp[1]){
    case L1_ON:{RELAY1=1;break;}
    case L1_OFF:{RELAY1=0;break;}
    }}
    else{
        count=0;
        while(message[count]!=0){
            for(i=0;i<=14;i++) array=array[i+1];
            array[15]=message[count++];

            lcd_goto(0,1);
            for(i=0;i<=15;i++) lcd_write(array);
            delay(400);}

        count=0;
        while(count<16){
            count++;
            for(i=0;i<=14;i++) array=array[i+1];
            array[15]=' ';

            lcd_goto(0,1);
            for(i=0;i<=15;i++) lcd_write(array);
            delay(400);}}

    sms_send(phone1);
    if(temp[0]>0){
    switch(temp[1]){
    case STATUS:{
        sms_string("INTRUDERS INSIDE");
        sms_number(gas,DEC,3);
        sms_string("%");                 
        sms_end();       
    break;}

    case L1_ON:{
        sms_string("Relay ");                                //Text message
        sms_number(temp[1]-L1_ON+1,DEC,1);
        sms_string(" is ON.");              //Text message
        sms_end();       
    break;}

    case L1_OFF:{
        sms_string("Relay ");                                //Text message
        sms_number(temp[1]-L1_OFF+1,DEC,1);
        sms_string(" is OFF.");             //Text message
        sms_end();
    break;}

    default:{
        sms_string("Unrecognized Code.");
        sms_end();
    break;}
    }}
    else{
        sms_string("Your phone number is denied.");
        sms_end();
    }
    mode=0;
break;}
}
}

i hope you can help me to solve this problem.. thank you
 

Offline ale500

  • Frequent Contributor
  • **
  • Posts: 427
Re: problem when build program with mplab x
« Reply #1 on: September 22, 2016, 06:40:02 am »
That is not the error !, you have to look for what exactly failed... maybe an unknown variable, or function, or something else...
 
The following users thanked this post: wasabi

Offline wasabiTopic starter

  • Newbie
  • Posts: 4
  • Country: my
Re: problem when build program with mplab x
« Reply #2 on: September 22, 2016, 01:51:53 pm »
That is not the error !, you have to look for what exactly failed... maybe an unknown variable, or function, or something else...

i do not have idea how to fix it because when i want build it show error..

Quote
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'C:/Users/wasabi/Desktop/GSM SIREN/GSM SIREN.X'
make  -f nbproject/Makefile-default.mk dist/default/production/GSM_SIREN.X.production.hex
make[2]: Entering directory 'C:/Users/wasabi/Desktop/GSM SIREN/GSM SIREN.X'
"C:\Program Files\Microchip\xc8\v1.38\bin\xc8.exe" --pass1  --chip=18F46K22 -Q -G  --double=24 --float=24 --emi=wordwrite --opt=default,+asm,+asmfile,-speed,+space,-debug --addrqual=ignore --mode=free -P -N255 --warn=-3 --asmlist --summary=default,-psect,-class,+mem,-hex,-file --output=default,-inhx032 --runtime=default,+clear,+init,-keep,-no_startup,-download,+config,+clib,-plib --output=-mcof,+elf:multilocs --stack=compiled:auto:auto:auto "--errformat=%f:%l: error: (%n) %s" "--warnformat=%f:%l: warning: (%n) %s" "--msgformat=%f:%l: advisory: (%n) %s"    -obuild/default/production/newfile.p1  newfile.c
newfile.c:20: error: (141) can't open include file "LibraryHardware.h": No such file or directory
(908) exit status = 1
nbproject/Makefile-default.mk:94: recipe for target 'build/default/production/newfile.p1' failed
make[2]: Leaving directory 'C:/Users/wasabi/Desktop/GSM SIREN/GSM SIREN.X'
nbproject/Makefile-default.mk:78: recipe for target '.build-conf' failed
make[1]: Leaving directory 'C:/Users/wasabi/Desktop/GSM SIREN/GSM SIREN.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[2]: *** [build/default/production/newfile.p1] Error 1
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

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

all header i has insert at mplab x..
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3923
  • Country: it
Re: problem when build program with mplab x
« Reply #3 on: September 22, 2016, 02:07:29 pm »
please, use the [ code ] tag.

Code: [Select]
newfile.c:20: error: (141) can't open include file "LibraryHardware.h": No such file or directorythere you go. this file can't be found.
it's not present at all, or it is not in the place the compiler is told to look at
 
The following users thanked this post: wasabi

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2332
  • Country: 00
Re: problem when build program with mplab x
« Reply #4 on: September 22, 2016, 03:29:27 pm »
Read with attention this


#include <file>
This form is used for system header files. It searches for a file named 'file' in a standard list of system directories. You can prepend directories to this list with the -I option while compiling your source code.

#include "file"
This form is used for header files of your own program. It searches for a file named 'file' in the directory containing the current file. You can prepend directories to this list with the -I option while compiling your source code.
 
The following users thanked this post: wasabi

Offline wasabiTopic starter

  • Newbie
  • Posts: 4
  • Country: my
Re: problem when build program with mplab x
« Reply #5 on: September 23, 2016, 06:28:36 pm »
i do not have idea about it.. what it mean?

Code: [Select]
make[2]: *** [build/default/production/newfile.p1] Error 1
Code: [Select]
make[1]: *** [.build-conf] Error 2
Code: [Select]
make: *** [.build-impl] Error 2
 

Offline wasabiTopic starter

  • Newbie
  • Posts: 4
  • Country: my
Re: problem when build program with mplab x
« Reply #6 on: September 23, 2016, 06:38:37 pm »


why has "attention" sign at eeprom? any error at there?
 

Offline Bruce Abbott

  • Frequent Contributor
  • **
  • Posts: 628
  • Country: nz
    • Bruce Abbott's R/C Models and Electronics
Re: problem when build program with mplab x
« Reply #7 on: September 23, 2016, 07:02:36 pm »
Code: [Select]
newfile.c:20: error: (141) can't open include file "LibraryHardware.h": No such file or directorythere you go. this file can't be found.
http://shahrulnizam.com/pic-lesson-compass-hmc6352/
Quote
julio says:   
11/10/2013 at 8:54 AM   

Hi, excellent project. Where I can download the library “LibraryHardware.h”?. thanks..
Reply

    Shahrul says:   
    11/10/2013 at 8:56 AM   

    julio, the library is mine, I’m not give for free.
    Reply
   :palm: :--
 

Offline JPortici

  • Super Contributor
  • ***
  • Posts: 3923
  • Country: it
Re: problem when build program with mplab x
« Reply #8 on: September 23, 2016, 07:30:19 pm »
jesus
:palm:
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf

 

- - -
-->