We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have done a program with keil,getting error while linking. but the same program is running in single file, i think problem with linking only...up to me,i linked the program..i dont know why is not linking...can any body suggest me.
MAIN FILE:-
#include <REGX51.H> #include "lcd.c"
unsigned int i=0,l=0; sbit alsen=P2^0; sbit eyesen=P2^2; sbit Buz=P0^2; sbit motor=P0^4;
void timer_init() { IE=0x82; TMOD=0x01; TH0=0x4B; TL0=0xFD; TR0=1;
}
void main() { unsigned int j;
lcd_init(); timer_init(); Buz=1; motor=1; delay(65000); delay(65000);
while(1) { if(alsen==1) { lcd_cmd(0x80); lcd_str("Alcohol Detected"); lcd_cmd(0xc0); Buz = 0; motor=0; while(1);
} else if(alsen==0) { lcd_cmd(0x80); for(j=0;j<1000;j++); lcd_str("Alcohol Normal "); lcd_cmd(0xc0);
if(l==100) { if(i>20) { lcd_cmd(0xc0); for(j=0;j<500;j++); lcd_str("I Blink Normal"); lcd_cmd(0x80);
l=0; i=0; } else { lcd_cmd(0xc0); for(j=0;j<500;j++); lcd_str("I Blink Abnormal"); Buz = 0; motor=0;
lcd_cmd(0x80); l=0; i=0; while(1); }
} if(eyesen==1) { i++;
} } }
LCD.C:-(lcd.c)
#include<REGX51.h>
sbit rs=P3^5; sbit rw=P3^6; sbit en=P3^7;
void delay(unsigned int d) { while(d--); } void lcd_data(unsigned char c) { P1=c; rs=1; rw=0; en=1; delay(150); en=0; } void lcd_cmd(unsigned char c) { P1=c; rs=0; rw=0; en=1; delay(150); en=0; } void lcd_str(unsigned char *s) { while(*s) { lcd_data(*s); s++; } }
void lcd_init() { lcd_cmd(0x38); lcd_cmd(0x0c); lcd_cmd(0x01); lcd_cmd(0x80); }
Or even looking in the Linker Manual for the description:
http://www.keil.com/support/man/docs/bl51/bl51_l16.htm
Google finds that one too.