cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from LCD Display. (Without I2C)

MMust.5
Senior II

tim.png

I don't understand how to use these two display modes:
Read Busy Flag and Address Counter
Read Data from RAM

png.png

Datasheet LCD2004A
I can describe how writing to DDRAM works.

 

First, I put the cursor on the display where I want to write the character:
LCD_SendCommand(0x02); //Return Cursor Home
And in this place I write a symbol:
LCD_SendData('F');

 

And I don’t understand what it does and what principle of operation for these two modes.
Read Busy Flag and Address Counter
Read Data from RAM
I think if you tell me the algorithm of work, then I can write the code itself.

On the Internet, I could not find a description that I would understand.

13 REPLIES 13

Hello

yes you probably must also write read address.

But you must also add this

EN(1);

after setting RS and RW to enable display to write value to bus.

Then after reading the value set En to zero, just like in your write command or data- functions. Check display controller manual to find out correct signaling for read operation (page 8).

BR J.T

It depends I suppose on what's being requested, registers, Display RAM, etc. These displays are quite antiquated at this point, I'm using SSD130x base OLEDs via I2C these days as simpler, cleaner and higher resolution.

There's perhaps some learning value here, and in going over the docs and timing diagrams, etc, I'm just not that personally invested in doing so. You're basically bit-banging an old 8-bit bus method with GPIO, you'll need to go over the datasheets, and emulate faithfully the intent / expectations expressed therein.

https://www.sparkfun.com/datasheets/LCD/HD44780.pdf

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

 

LCD_SendCommand(0x80); //I add the address of the display from where I need to read the 
                       //character code
GPIOE->MODER=0;        //Enable input on port E
RS(1);
RW(1);

EN(1); //Enable EN
HAL_Delay(10);
EN(0); //Disable EN

 

I already did it before.

The result is the same. All pins from DB0 to DB7 output a logical one.

 

Understood.

Everything is as you described:
>Then after reading the value set En to zero, just like in your write command or data-functions.
And I read the value from the display pins after EN (0);


The thing is that the transfer of information occurs between EN (1); and EN(0);
And it is also necessary to read information from the display pins between EN (1); and EN(0);

It was very helpful for me.
I thought that reading information occurs after EN (0);
Although of course this is even a logically incorrect reasoning.

AFTER EN(0); ALL DISPLAY PINS TAKE A LOGICAL ONE.
That is, the code in the message above was correct.
Only I needed between EN(1); and EN(0); read information.

As a result, this code will be correct:

 

 LCD_SendCommand(0x02); //Return Cursor Home
 HAL_Delay(10);

uint8_t str[]={"Hello World"};

 for(uint8_t i=0; str[i]!=0; i++)
{ 
 LCD_SendData(str[i]);
}
LCD_SendCommand(0x81); //I add the address of the display from where I need to read the 
                       //character code


GPIOE->MODER=0;       //Enable input on port E
RS(1);
RW(1);
uint8_t receive=0;
    EN(1); // EN 1_________EN 1_________EN 1_________EN 1_________EN 1_________EN 1
//The display outputs voltage to its pins, I read this from the IDR receive register.
    HAL_Delay(1000);
    if(GPIOE->IDR & 1 << GPIO_IDR_ID0_Pos){receive|=1 << 0;} 
    if(GPIOE->IDR & 1 << GPIO_IDR_ID1_Pos){receive|=1 << 1;} 
	if(GPIOE->IDR & 1 << GPIO_IDR_ID2_Pos){receive|=1 << 2;} 
	if(GPIOE->IDR & 1 << GPIO_IDR_ID3_Pos){receive|=1 << 3;} 
	if(GPIOE->IDR & 1 << GPIO_IDR_ID4_Pos){receive|=1 << 4;} 
	if(GPIOE->IDR & 1 << GPIO_IDR_ID5_Pos){receive|=1 << 5;} 
	if(GPIOE->IDR & 1 << GPIO_IDR_ID6_Pos){receive|=1 << 6;} 
	if(GPIOE->IDR & 1 << GPIO_IDR_ID7_Pos){receive|=1 << 7;} 
	EN(0); //EN 0_________EN 0_________EN 0_________EN 0_________EN 0_________EN 0

 

With this code, I read information from this address LCD_SendCommand(0x81);
In this case it is the letter 'e' from the array uint8_t str[]={"Hello World"};