COMPILE TIME ERROR::mini project.c(49): warning C206: 'lcddata': missing function-prototype ::mini project.c(49): error C267: 'lcddata': requires ANSI-style prototype
PROGRAM
#include<reg51.h> sfr LCD=0x80; sbit RS=P2^6; sbit EN=P2^7; unsigned int a=0,i=0,v; void tm(); void delay(unsigned char time) { unsigned int a,b; for(a=0;a<time;a++) for(b=0;b<1275;b++); } void lcdmd(unsigned char value) { LCD=value; RS=1; EN=1; delay(10); EN=0; } void lcd_init() { lcdmd(0x38); delay(20); lcdmd(0x0c); delay(20); lcdmd(0x01); delay(20); lcdmd(0x06); delay(20); } void ISR_ex0(void)interrupt 0 { while(1) { tm(); a++; } } void ISR_ex1(void) interrupt 2 { unsigned char m,n,temp,o; v=100/a; m=v/100; temp=v%100; n=temp/10; o=temp%10; lcdmd(0xc6); lcddata(m+48); lcddata(n+48); lcddata(o+48); a=0; lcddata('m'); lcddata('m'); lcddata('/'); lcdddata('s'); lcddata('e'); lcddata('c'); lcddata('') lcddata('') } void main() { unsigned char w[]="WELCOMESPEED=WAITING..."; IT0=1; //Configure interrupt 0 for falling edge on/INT0 (P3.2) EX0=1; //Enable EX0 Interrupt IT1=1; //Configure interrupt 1 for falling edge on/INT0 (P3.2) EX1=1; //Enable EX1 Interrupt EA=1; //Enable Global Interrupt Flag IP=0x04; //Priority of ex 1 high lcd_int(); lcdcmd(0x84); for(i=0;i<7;i++) lcddata(w[i]); lcdmd(0xc0); for(i=7;i<13;i++) lcddata(w[i]); for(i=13;i<24;i++) lcddata(w[i]); while(1) } void tm() { int y=0; for(y=0;y<15;y++) { TMOD=0x01; TL0=0xFD; TH0=0x4B; TR0=1; while(TF0==0); TR0=0; TF0=0; } }
CAN ANYONE PLEASE HELP ME WITH THIS
you are also missing the ability to read instructions (Place source code between ...)
So provide one, then!
@erik can you please correct this!! PLEASE
@Erik and @Andrew Got this Program from here www.slideshare.net/.../speed-checker-on-highway-using-8051
can you guys please take a look and repost the correct program?? please....i am noob here!! Expect your kind replies!
Hey dude.
I advise to you to not listen to the half answers. She obviously doesn't understand the finer detail of how compiler and linkers operate.
I am at the other end of the spectrum and am now studying for my professorship. It will be obvious to you that I am very smart. I will try to impart a smidgen of my immense knowledge onto you.
The code is calling the function 'lcddata' but the compiler doesn't know what that function is or anything about it. You must include detail of the function. If you put the function ABOVE all the other code then you do not need a separate prototype coz the function will be enough for the compiler to know all it needs to know. if you put the function BELOW all the other code or in a separate module then you MUST include a prototype to tell the compiler the minimum detail it needs to access the function.
I'm sure that for ordinary people this is all going to sound very confusing, but stick with it and maybe one day you will understand.
The mentioned code for 8051 C is "spagheti code" !
But the lcddata() function that is missing is a pair to the lcdmd() using the RS line different RS=1 command, RS=0 data have a look
void lcdmd(unsigned char value) { LCD=value; RS=1; EN=1; delay(10); EN=0; } void lcddata(unsigned char value) { LCD=value; RS=0; EN=1; delay(10); EN=0; }
...