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

C51 : What problem with my code using 8051 microcontroller (AT89S52)

I want to ask. I use keil compiler. When I compiler the code, the software give warning and error. This is the warning and error.. How can I fix the error??

The question is, if i burn this code into pic, is it the pic working well with the code and not counter with problem? Please can anybody help me??

[code]
Build target 'Target 1'
linking...
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _DELAY MODULE: Project.obj (PROJECT)
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _MSGDISPLAY MODULE: Project.obj (PROJECT)
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: LCD_INIT MODULE: Project.obj (PROJECT)
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _LCDDATA MODULE: Project.obj (PROJECT)
*** WARNING L1: UNRESOLVED EXTERNAL SYMBOL SYMBOL: _LCDCMD MODULE: Project.obj (PROJECT)
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: LCD_INIT MODULE: Project.obj (PROJECT) ADDRESS: 0805H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDCMD MODULE: Project.obj (PROJECT) ADDRESS: 080AH
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _MSGDISPLAY MODULE: Project.obj (PROJECT) ADDRESS: 0813H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDCMD MODULE: Project.obj (PROJECT) ADDRESS: 0818H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _MSGDISPLAY MODULE: Project.obj (PROJECT) ADDRESS: 0821H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDCMD MODULE: Project.obj (PROJECT) ADDRESS: 082DH
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 083CH
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0845H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0854H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0863H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 086FH
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0889H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDCMD MODULE: Project.obj (PROJECT) ADDRESS: 088EH
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDDATA MODULE: Project.obj (PROJECT) ADDRESS: 094FH
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0956H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDDATA MODULE: Project.obj (PROJECT) ADDRESS: 0960H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0967H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _LCDDATA MODULE: Project.obj (PROJECT) ADDRESS: 0971H
*** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL: _DELAY MODULE: Project.obj (PROJECT) ADDRESS: 0978H
Program Size: data=15.0 xdata=0 code=407
"Project" - 0 Error(s), 24 Warning(s).
[/code]

This is my code.

[code]
#include<reg51.h>
#include"lcddisplay.h"
#include<intrins.h>
sbit rd = P2^0;
sbit wr = P2^1;
sbit intr = P2^2;
sbit finger = P2^5;
sbit buz = P2^3;
#define adcdata P3
void convert(unsigned char );
void lcd_init(void);
void lcdcmd(unsigned char value);
void msgdisplay (unsigned char*);
void delay(int);
void lcddata(unsigned char );
unsigned char a,pp=0,count=0,i;
void main()
{ buz=0;
finger=1;
lcd_init();
lcdcmd(0x85);
msgdisplay("WELCOME");
lcdcmd(0x01);
msgdisplay("temp hbeat");
rd=1;
intr=1;
adcdata=0xff;
while(1)
{ lcdcmd(0xc2);
//delay(500);
wr=0;
_nop_();
_nop_();
_nop_();
_nop_();
wr=1;
delay(50);
rd=0;
delay(10);
a=adcdata;
convert(a);
delay(500);
for(i=0;i<100;i++)
{ count+=1;
if(finger==0)
{ delay(1000);
if(!finger)
{ buz=1;
delay(500);
pp=1;
buz=0;
break;
} else
pp=0;
} }
delay(500);
lcdcmd(0xca);
if(pp)
{ convert(count);
} else
convert(0);
pp=0;
} }
void convert(unsigned char temp_value)
{ unsigned char value,d1,d2,d3;
temp_value = temp_value;
value=temp_value/10;
d3=temp_value%10;
d1=value/10;
d2=value%10;
d1=d1+0x30;
lcddata(d1);
delay(10);
d2=d2+0x30;
lcddata(d2);
delay(4);
// msgdisplay(".");
d3=d3+0x30;
lcddata(d3);
delay(10);
}

#include<reg51.h>
#include"lcddisplay.h"
#include<intrins.h>
sbit rd = P2^0;
sbit wr = P2^1;
sbit intr = P2^2;
sbit finger = P2^5;
sbit buz = P2^3;
#define adcdata P3
void convert(unsigned char );
void lcd_init(void);
void lcdcmd(unsigned char value);
void msgdisplay (unsigned char*);
void delay(int);
void lcddata(unsigned char );
unsigned char a,pp=0,count=0,i;
void main()
{ buz=0;
finger=1;
lcd_init();
lcdcmd(0x85);
msgdisplay("WELCOME");
lcdcmd(0x01);
msgdisplay("temp hbeat");
rd=1;
intr=1;
adcdata=0xff;
while(1)
{ lcdcmd(0xc2);
//delay(500);
wr=0;
_nop_();
_nop_();
_nop_();
_nop_();
wr=1;
delay(50);
rd=0;
delay(10);
a=adcdata;
convert(a);
delay(500);
for(i=0;i<100;i++)
{ count+=1;
if(finger==0)
{ delay(1000);
if(!finger)
{ buz=1;
delay(500);
pp=1;
buz=0;
break;
} else
pp=0;
} }
delay(500);
lcdcmd(0xca);
if(pp)
{ convert(count);
} else
convert(0);
pp=0;
} }
void convert(unsigned char temp_value)
{ unsigned char value,d1,d2,d3;
temp_value = temp_value;
value=temp_value/10;
d3=temp_value%10;
d1=value/10;
d2=value%10;
d1=d1+0x30;
lcddata(d1);
delay(10);
d2=d2+0x30;
lcddata(d2);
delay(4);
// msgdisplay(".");
d3=d3+0x30;
lcddata(d3);
delay(10);
}

  • The question is, if i burn this code into pic, is it the pic working well with the code and not counter with problem?

    Burning code produced from C51 into a PIC will result in a lot of wasted time.

  • It's complaining about external function you're not supplying, figure out what libraries or source you need to add to your project, and add them.

    And try reading the posting instructions so your code is actually readable when you post it.

  • "So, you cannot help me?"

    When the compiler/linker supplies so nice error messages as:

    REFERENCE MADE TO UNRESOLVED EXTERNAL SYMBOL
    


    and you come to a forum totally lost what could be wrong, then it's quite likely that we can't help you.

    It would have been a completely different issue if you had come to the forum claiming: My project does contain these functions - supplied in source file x or library file y - but for some reason the linker doesn't seem to recognize them but without any error message that it can't find the source file and/or library file. Then you would have shown that you had moved past the trivial step of actually reading the error messages and investing 10-20 seconds of own thinking. The compiler/linker manuals contains more information. Google or other search engines can also bring up lots of additional information.

    Software development is all about problem solving. From decoding the requirements specification to figuring out what hardware to use, what algorithms to use, how to structure the software. How to build, debug, test, verify, validate. Reading the error messages is a very small part of that. But obviously a vital part.