How to read data directly from lcd display Referring to post: LCD data read and show on computer
It was not clear what the final code is. Could you post the code and schema again, and if possible, an explanation of how it works?

My problem:

I need to read the information of a lcd 20x4 display, which is controlled by a PLC (which has the protected hex code), and send the data through the serial port.

For this I am using an arduino one to do the reading. I connected the arduino in parallel with the display data bus, to try to read the bits and convert later.

This is the schematic I'm using:


Note: I have placed 1k resistors to make the pulldown on each pin, to avoid reading errors.

With this code:




The problem is that I'm having these results in reading:


No matter what appears on the screen, they are always invalid characters.
If someone identifies where my problem is, I'll be very grateful.
I would recommend ditching the the digitalRead in this case - it is performed sequentially, and is rather slow.
As you only need to read 8 input lines, consider using Port register: The Arduino Uno comes with a total of three Ports which "hold" all of the I/O pins.
Those are


PORTB = Digital Pins 8 through 13 plus the crystal pins
PORTC = Analog Input 0 through 5, reset pin
PORTD = Digital Pin 0 through 7


Since you need the RX and TX lines (Digital pin 0 and 1) for your serial communication, you will have to split the signal onto two registers.

I would recommend connecting D0 through D3 to Digital Pins 8 through 11 for the first four bits (meaning they'll go to bits 3 to 0 of Port B), and D4 through D7 to Analog Pins 0 To 3 (meaning they'll go to bits 3 to 0 of Port C).
RW goes to Pin 7, RS to Pin 6, E to Pin 5.

The code you would then use to read the data would be this:
    uint8_t byte_displaydata = 0x00;
    uint8_t RW = 7;
    uint8_t RS = 6;
    uint8_t E = 5;

void setup() {
  Serial.begin(1200); //perhaps increase this a bit
  pinMode(RW, INPUT); //some speed is lost compared to register manipulation, but that is likely insignificant
  pinMode(RS, INPUT);
  pinMode(E,INPUT);
  DDRB &amp;= ~((1 &lt;&lt; DDRB0) | (1 &lt;&lt; DDRB1) | (1 &lt;&lt; DDRB2) | (1 &lt;&lt; DDRB3)); //technical not necessary since they're initialized with 0
  DDRC &amp;= ~((1 &lt;&lt; DDRC0) | (1 &lt;&lt; DDRC1) | (1 &lt;&lt; DDRC2) | (1 &lt;&lt; DDRC3));
  PORTB &amp;= ~((1 &lt;&lt; PORTB0) | (1 &lt;&lt; PORTB1) | (1 &lt;&lt; PORTB2) | (1 &lt;&lt; PORTB3)); //disable internal pullups
  PORTC &amp;= ~((1 &lt;&lt; PORTC0) | (1 &lt;&lt; PORTC1) | (1 &lt;&lt; PORTC2) | (1 &lt;&lt; PORTC3));

}

void loop() {
  if(digitalRead(RS) == HIGH &amp;&amp; digitalRead(E) == HIGH){
    byte_displaydata = 0x00; //reset byte_displaydata
    byte_displaydata = PINB &lt;&lt; 4; //push PINB bits 3 to 0 to bits 7 to 4
    byte_displaydata |= (PINC &amp; 0x0F); //filter PINC bits 3 to 0 and OR them into result bits 3 to 0
    Serial.println(byte_displaydata,BIN);
  }
}


Please note that I have not tested this, and only recently have gotten started in AVR / Arduino.
If anyone can look this over, I'd greatly appreciate it.

Source: Microchip ATmega328P datasheet, Arduino pin mapping