i'm trying to display a phrase to a 16x2 LCD using 8051 and C programming .But a line of square dots keep on displaying on the LCD,without displaying the phrase. can u help me verify what wrong with the code???? your help is greatly appreciated. Code: #include <reg52.h> #include <intrins.h> typedef unsigned char bit_8; #define CLR 0 #define SETB 1 sbit DB0 = P1^0; sbit DB1 = P1^1; sbit DB2 = P1^2; sbit DB3 = P1^3; sbit DB4 = P1^4; sbit DB5 = P1^5; sbit DB6 = P1^6; sbit DB7 = P1^7; sbit EN = P3^7; sbit RS = P3^6; sbit RW = P3^5; sbit DATA = P1; sbit D7=P1^7; bit_8 code *days[]={"*Sun*","*Mon*","*Tue*","*Wed*","*Thu*","*Fri*","*Sat*"}; bit_8 code *val[]={"0","1","2","3","4","5","6","7","8","9","10","11","12"}; bit flag; bit_8 month=1,date=1,hh,lmin,hmin,hsec,lsec,day=0,lyear=5,hyear=0,date_count; sbit Ready = P3^7; void ini(void); void command(bit_8); void data_in(bit_8*); void busy(void); void main() { bit_8 temp; ini(); data_in("i love u"); } void ini() { command(56); command(12); command(1); command(6); } void busy() { D7=1; RS=0; RW=1; while(D7!=0) { EN=0; EN=1; } } void command(bit_8 val) { busy(); P1=val; RS=0; RW=0; EN=1; EN=0; } void data_in(bit_8 *string) { bit_8 i; busy(); for(i=0;string[i]!='\0';i++) { P1=string[i]; RS=1; RW=0; EN=1; EN=0; } }
attach '/0' and then send "i love you" to data_in(). Or attach it in data_in () before FOR loop. try it ... i am not sure...