about interfacing a 16x2 lcd with 89s51

Status
Not open for further replies.

eeHassan

Member level 2
Joined
Jan 28, 2011
Messages
52
Helped
0
Reputation
2
Reaction score
1
Trophy points
1,288
Location
Lahore, Pakistan
Activity points
1,615
I urgently need an LCD Read Program that reads all the characters displayed on the 16x2 LCD......please help me in that... I made this program to read char wise but it doesn`t work

char read()
{

char h;
Rs=1;
Rw=1;
E=0;
delay(1);
E=1;
delay(1);
h=P1;

return h;
}
 

your program should be altered like this

e=1;
delay(1);
e=0;
delay(1);


and put while(1);

---------- Post added at 21:25 ---------- Previous post was at 21:19 ----------

Code:
void lcd_cmdwrt(unsigned char cmd)
{
	unsigned char LCD;
	LCD=cmd ;
	lcd=LCD;
   	RS=0;
   	EN=1;
   	delay(1);
	EN=0;		
}

void dat(unsigned char dt)
{		
 	unsigned char LCD;
   		LCD=dt ;
		lcd=LCD;
   		RS=1;
   		EN=1;
   		delay(1);  
		EN=0;
		   		
} 

void lcd_datawrt(unsigned char *str)
{		
 while(*str)
  {
   dat(*str);
   str++;
  }	
}	  
/************************************************************************************
Function Name   : lcd_init()
Return value	: None       
Purpose of this function: To initialising the LCD

/************************************************************************************/
void lcd_init()
{
 	lcd_cmdwrt(0x38);
	delay(1); 	
	lcd_cmdwrt(0x0f);
	delay(1);	
	lcd_cmdwrt(0x01);
	delay(1); 	
	lcd_cmdwrt(0x06);
	delay(1); 	
	lcd_cmdwrt(0x80);
	delay(1);
}
 

I asked for the LCD READ program not the WRITE program.......i.e i have to read the data from the internal registers of an LCD

---------- Post added at 21:55 ---------- Previous post was at 21:47 ----------

and remember that for read operation we give L-H pulse NOT H-L pulse
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…