This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

L104 and L16

I am getting error like this...program is running fine,when all file made to one main file..bt problem while creating different file....can some one suggest,how to clear this.
linking...
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: LCD_INIT MODULE: lcd.obj (LCD)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: _LCD_STR MODULE: lcd.obj (LCD)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: _LCD_CMD MODULE: lcd.obj (LCD)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: _LCD_DATA MODULE: lcd.obj (LCD)
*** ERROR L104: MULTIPLE PUBLIC DEFINITIONS SYMBOL: _DELAY MODULE: lcd.obj (LCD)
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?_LCD_STR?LCD
*** WARNING L16: UNCALLED SEGMENT, IGNORED FOR OVERLAY PROCESS SEGMENT: ?PR?LCD_INIT?LCD
Program Size: data=15.0 xdata=0 code=652

Parents Reply Children
  • MAIN.c:-

    #include <REGX51.H>
    #include"SERIAL.c"
    #include"LCD.c"
    
    sbit rf=P2^0;
    sbit motor=P0^0;
    
    unsigned char asc,ok[2],r[4],a,i,oxoa, a,m[20],j,temp[10],temp1[10];
    void cmdwrt_lcd(unsigned char cmd);
    void serial_transmit(unsigned char *srstr);
    void command(unsigned char d[]);
    void serial_tx(unsigned char srda);
    void delay1();
    
    void gsm_send()
            {
                    command("AT");
                    delay1();
                    command("AT+CMGF=1");
                    delay(65000);
                    delay(65000);
                    serial_transmit("AT+CMGS=");
                    serial_tx('"');
                    serial_transmit("9710362655");
                    serial_tx('"');
                    serial_tx(0x0d);
                    serial_tx(0x0a);
                    delay(65000);
                    delay(65000);
                    serial_transmit("Vehicle Thefted ");
                    serial_tx(0x0a);
                    serial_transmit("Send Stop message to stop the vehicle");
                    serial_tx(0x0a);
                    delay(650);
                    serial_tx(0x1A);
                    delay(65000);
                    delay(65000);
            }
    
    void gsm_send1()
            {
                    command("AT");
                    delay1();
                    command("AT+CMGF=1");
                    delay(65000);
                    delay(65000);
                    serial_transmit("AT+CMGS=");
                    serial_tx('"');
                    serial_transmit("9710362655");
                    serial_tx('"');
                    serial_tx(0x0d);
                    serial_tx(0x0a);
                    delay(65000);
                    delay(65000);
                    serial_transmit("Your Vehicle has been stopped");
                    serial_tx(0x0a);
                    delay(650);
                    serial_tx(0x1A);
                    delay(65000);
                    delay(65000);
            }
    
    
    void wait_0x0a()
            {
                    do
                            {
                            a=serial_rx();
                            }while(a!=0x0a);
    
            }
    
    void rec_msg()
            {
            unsigned char i=0;
                    do
                       {
                            while(RI==0);
                            temp[i]=SBUF;
                            i++;
                            RI=0;
                            } while(temp[i-1]!=0x0A);
               }
    
    void check_ok()
    {
     unsigned char i;
            for(i=0;i<=3;i++)
                    {
                            while(RI==0);
                            temp1[i]=SBUF;
                            RI=0;
                    }
    }
    
    void command(unsigned char d[])
            {
                    serial_transmit(&d[0]);
                    cmdwrt_lcd(0x80);
                    serial_tx(0x0d);
                    wait_0x0a();
                    check_ok();
                    temp1[2]='\0';
                    delay(65000);
                    delay(65000);
                    cmdwrt_lcd(0xc0);
            }
    
    void delay1()
            {
                            delay(65000);delay(65000);delay(65000);
            }
    
    
    void gsm_read()
            {
                    command("AT");
                    delay1();
                    command("AT+CMGF=1");
                    delay1();
                    command("AT+CGSMS=1");
                    delay1();
                    command("AT+CMGD=1");
                    delay1();
                    cmdwrt_lcd(0x01);
                    cmdwrt_lcd(0x80);
                    display_lcd("Waiting for Msg");
                    for(j=0;j<=15;j++)
                            {
                                    while(RI==0);
                                    m[j]=SBUF;
                                    RI=0;
                            }
                    delay1();
                    cmdwrt_lcd(0xC0);
                    display_lcd(&m[0]);
                    delay1();
                    cmdwrt_lcd(0x01);
                    cmdwrt_lcd(0x80);
                    serial_transmit("AT+CMGR=1");
                    display_lcd("AT+CMGR=1");
                    serial_tx(0x0d);
                    wait_0x0a();
                    rec_msg();
                    delay1();
                    temp[4]='\0';
                    cmdwrt_lcd(0xc0);
                    display_lcd(&temp[0]);
                    delay1();
                    delay1();
                    if(temp[0]=='S'&& temp[1]=='t'&&temp[2]=='o'&&temp[3]=='p')
                            {
                                    motor=0;
                                    cmdwrt_lcd(0x01);
                                    cmdwrt_lcd(0x80);
                                    display_lcd("Vehicle Stopped");
                                    gsm_send1();
                            }
            }
    
    void main()
            {
                    serial_init();
                    lcd_init();
                    P0=0x00;
                    display_lcd("VEHI.THEFT ALERT");
                    cmdwrt_lcd(0xC0);
                    display_lcd("SYSTEM USING GSM");
                    motor=1;
                    delay(65000);
                    while(1)
                    {
                                    if(rf==0)
                                    {
                                    cmdwrt_lcd(0x01);
                                    display_lcd(" VEHICLE THEFTED");
                                    gsm_send();
                                    gsm_read();
                                    while(rf==0);
                                    }
                    }
            }</prev>
    
    
    CODE FOR SERIAL:-(SERIAL.c)
    
    #include <REGX51.H>
    #include"header.h"
    
    void serial_init()
            {
            TMOD = 0x20;
            TH1 = 0xFD;
            SCON = 0x50;
            TR1 = 1;
            }
    
    void serial_tx(unsigned char srda)
            {
                    SBUF = srda;
                    while(TI == 0);
                    TI = 0;
            }
    
    void serial_transmit(unsigned char *srstr)
            {
            while(*srstr != '\0')
                    {
                    serial_tx(*srstr);
                    srstr++;
                    }
            }
    
    unsigned char serial_rx()
            {
            unsigned char rbuf;
            while(RI == 0);
            RI = 0;
            rbuf = SBUF;
            return rbuf;
            }
    
    
    
    
    

  • CODE FOR LCD.c:-(LCD.c)

    #include <REGX51.H>
    
    sbit rs = P3^5;
    sbit rw = P3^6;
    sbit en = P3^7;
    
    void delay(unsigned int dela)
       {
       unsigned int i;
       for(i=0;i<dela;i++);
       }
    
    void cmdwrt_lcd(unsigned char cmd)
            {
            P1 = cmd;
            rs = 0;
            rw = 0;
            en = 1;
            delay(15);
            en = 0;
            delay(150);
            }
    
    void datawrt_lcd(unsigned char datas)
            {
            P1 = datas;
            rs = 1;
            rw = 0;
            en = 1;
            delay(15);
            en = 0;
            delay(150);
            }
    
    void display_lcd(unsigned char *lcdstr)
            {
            while (*lcdstr !='\0')
                    {
                    datawrt_lcd(*lcdstr);
                    lcdstr++;
                    }
            }
    
    void lcd_init()
            {
            cmdwrt_lcd(0x38);
            cmdwrt_lcd(0x0C);
            cmdwrt_lcd(0x01);
            cmdwrt_lcd(0x80);
            }
    

    CODE FOR HEADER.h:-(header.h)

    #ifndef HEADER_H
    #define HEADER_H
    
    extern void serial_tx(unsigned char);
    extern void serial_transmit(unsigned char *);
    extern unsigned char serial_rx();
    extern void serial_init();
    extern void lcd_init();
    extern void display_lcd(unsigned char *);
    extern void datawrt_lcd(unsigned char);
    extern void cmdwrt_lcd(unsigned char);
    extern void delay(unsigned int);
    
    #endif
    

  • #include"SERIAL.c"
    #include"LCD.c"

    DO NOT #include .c files

    Erik

  • void gsm_send1()
            {
                    command("AT");
                    delay1();
                    command("AT+CMGF=1");
                    delay(65000);
                    delay(65000);
                    serial_transmit("AT+CMGS=");
                    serial_tx('"');
                    serial_transmit("9710362655");
                    serial_tx('"');
                    serial_tx(0x0d);
                    serial_tx(0x0a);
                    delay(65000);
                    delay(65000);
                    serial_transmit("Your Vehicle has been stopped");
                    serial_tx(0x0a);
                    delay(650);
                    serial_tx(0x1A);
                    delay(65000);
                    delay(65000);
            }
    

    This is a very bad approach!

    All AT commands give a response to indicate success or failure; you are ignoring these responses and just ploughing blindly on assuming success!!

    In addition, AT+CMGS gives a Prompt when it is ready for input...

  • sir, that is equal to one(AT+CMGF = 1)..my friend types wrong in thread..but in coding we have done tht...u just tell, how we should avoid tht error of multiple public definition and un called segment...

  • Maybe look at all the examples you got installed together with the compiler - don't they seem to sometimes contain multiple C files, without using #include to compile them?

  • There are no "typing wrong in thread".

    There are copy and paste.

    The difference between typing and copying/pasting is that code that is typed is meaningless for us to look at. Why look at something that isn't identical to what the compiler will see? It's just a waste of our time to consider code that has been retyped. And the time spent retyping would be a waste of time for the one retyping it too...

  • Yes i got it.....thanks to all...

    that is the big mistake i committed here...
    should not add #include to .c files....

    Once again thks to all....
    especially Per Westermark sir....

    Regard
    Zakir

  • Don't have more than 1 (ie, "multiple") definition for each public symbol!!