LCD data Read

I am trying to read data coming from LCD.When i'm simulating in proteus it is working but when i try to read it on hardware it is not working.Can anyone help me plzzzz????

when i try to read it on hardware it is not working.

What hardware? You wrote something to the LCD. Why can't you simply remember what you wrote?

moheed_sikandar: I am trying to read data coming from LCD.When i'm simulating in proteus it is working but when i try to read it on hardware it is not working.Can anyone help me plzzzz????

When you connect the LCD you need to connect the R/W pin to one of the Arduino pins instead of connecting it to 5V or GND. That will let you control whether you are reading from or writing to the LCD. Unless I missed it, though, it doesn't look like the LiquidCrystal library supports reading from the LCD.

moheed_sikandar:
I am trying to read data coming from LCD.When i’m simulating in proteus it is working but when i try to read it on hardware it is not working.Can anyone help me plzzzz???

The stock LiquidCrystal library doesn’t support reading the LCD, but in the past I’ve had the need to do just that, so check out this sketch… it uses a VIRTUAL LCD (a buffer) that you send data to, then you can update the buffer to the LCD (to display the contents) as well as use the buffer to print the data anywhere else. Hope this helps.

/////// Virtual LCD demo ////////
#include <LiquidCrystal.h>

// LCD pin connections
#define _RW 38
#define _EN 39
#define _V0 40
#define _RS 41
#define _D7 42
#define _D6 43
#define _D5 44
#define _D4 45
#define _D3 46
#define _D2 47
#define _D1 48
#define _D0 49

#define chars 16
#define lines 2

static LiquidCrystal LCD (_RS, _RW, _EN, _D0, _D1, _D2, _D3, _D4, _D5, _D6, _D7);

char vbuf[(lines + 1)][(chars + 1)]; // virtual LCD screen (the +1 is for end of line null)
uint8_t x, y; // vars

// erase virtual LCD buffer, does NOT update the LCD
void vclr (void)
{
	for (y = 0; y < lines; y++) {
		for (x = 0; x < chars; x++) {
			vbuf[y][x] = ' '; // write space to erase
		}
		vbuf[y][x] = 0; // terminate line (for other print methods)
	}
}

// print string to virtual buffer (lines start at 0)
void vprint (const char *str, uint8_t line)
{
	for (x = 0; x < strlen (str); x++) {
		vbuf[line][x] = str[x]; // copy string to buffer
	}
}

// update (copy) the virtual buffer to the LCD
void vupd (void)
{
	for (y = 0; y < lines; y++) {
		LCD.setCursor (0, y);
		for (x = 0; x < chars; x++) {
			LCD.write (vbuf[y][x]);
		}
	}
}

int main (void)
{
	init ();
	Serial.begin (115200);

	LCD.begin (chars, lines); // init display

	vclr (); // erase virtual buffer
	vprint ("Hello World", 0); // print string to virtual line 0
	vprint ("This is line 1!", 1); // print string to virtual line 1
	vupd (); // update virtual to lcd

	// demo reading what is on the LCD
	Serial.print ("The LCD is displaying:");
	Serial.print ("\n");
	Serial.print (vbuf[0]);
	Serial.print ("\n");
	Serial.print (vbuf[1]);
	Serial.print ("\n");

	while (1);
}