Write to display without using library

Does anybody has a code that I can use to test a display based on HD44780? I have a old one that is not working, maybe slow and LiquidCrystal.h is not compatible.
I’m trying to write LOW and HIGH, direct into the PINs without success.
I tested the code also using my new display (that one the comes with Arduino) and also didn’t work, so that why I believe the code is not OK. On the new if I use the library it works good
I found this code, but didn’t work either.

/*
 * Driving LCD Display without library
 * Augusto
 */

//PINS(RS to D7): (2,3,4,6,7,8,9,10,11,12,13);


// WRITE HITACHI (datasheet)

/*
 *     RS RW D7 D6 D5 D4 D3 D2 D1 D0
 * 2.  0  0  0  0  1  1  0  0  *  * -> Function set
 * 3.  0  0  0  0  0  0  1  1  1  0 -> Display ON/OFF control
 * 4.  0  0  0  0  0  0  0  1  1  0 -> Entry Mode set (INCREMENT)
 * 5.  1  0  0  1  0  0  1  0  0  0 -> H
 * 6.  1  0  0  1  0  0  1  0  0  1 -> I
 * 7.  ...
 * 8.  1  0  0  1  0  0  1  0  0  1 -> I (HITACHI) 
 * 9.  0  0  0  0  0  0  0  1  1  1 -> Entry Mode set (INCREMENT) - Display Shift
 * 10. 1  0  0  0  1  0  0  0  0  0 -> Escreve um espaco
 * 
 */


/*  0000 0000 01 LIMPA
    0000 0000 1— RETORNA HOME
    0000 0 0 0 1 I/D S ENTRY MODE SET
    000 0 0 0 1 DCB SETS ENTIRE DISPLAY ON/OFF
*/
 
/* 
 *  Instruction RS R/W DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0 Description fOSC is 270 kHz)
                1  0                                   Write data Writes data into DDRAM or

                1  1                                   Read data Reads data from DDRAM or

    I/D = 1: Increment
    I/D = 0: Decrement
    S = 1: Accompanies display shift
    S/C = 1: Display shift
    S/C = 0: Cursor move
    R/L = 1: Shift to the right
    R/L = 0: Shift to the left
    DL = 1: 8 bits, DL = 0: 4 bits
    N = 1: 2 lines, N = 0: 1 line
    F = 1: 5 × 10 dots, F = 0: 5 × 8 dots
    BF = 1: Internally operating
    BF = 0: Instructions acceptable

*/


#define RS 2
#define RW 3
#define E 4
#define DB0 6
#define DB1 7
#define DB2 8
#define DB3 9
#define DB4 10
#define DB5 11
#define DB6 12
#define DB7 13


void setup() {

    for (int i = 2; i <= 4; i++) {
        pinMode(i, OUTPUT);
    }

    for (int i = 6; i <= 13; i++) {
        pinMode(i, OUTPUT);
    }

    
    
    digitalWrite(E, 0);
    returnHome();
    delay(100);
    limpa();
    delay(100);
}

void loop() {
    
    functionSet();
    displayOnOff();
    entryModeSet(HIGH, LOW);
    //A
    escreve(1, 0, 0, 1, 0, 0, 0, 0, 0, 1); //Writes A
    //piscaE();
    //U
    escreve(1, 0, 0, 1, 0, 1, 0, 1, 0, 1); //Writes U and so on...
    //G
    escreve(1, 0, 0, 1, 0, 0, 0, 1, 1, 1);
    //U
    escreve(1, 0, 0, 1, 0, 1, 0, 1, 0, 1);
    //S
    escreve(1, 0, 0, 1, 0, 1, 0, 0, 1, 1);
    //T
    escreve(1, 0, 0, 1, 0, 1, 0, 1, 0, 0);
    //O
    escreve(1, 0, 0, 1, 0, 0, 1, 1, 1, 1);
    piscaE();   

    entryModeSet(HIGH, HIGH);

    //escreveEspaco();
    
    while(1) {} //infinite loop to "stop" void loop()

}


void escreve(int rs, int rw, int db7, int db6, int db5, int db4, int db3, int db2, int db1, int db0) { // Function to WRITE something on the display
    
    piscaE();
    digitalWrite(RS, rs);
    digitalWrite(RW, rw);
    digitalWrite(DB7, db7);
    digitalWrite(DB6, db6);
    digitalWrite(DB5, db5);
    digitalWrite(DB4, db4);
    digitalWrite(DB3, db3);
    digitalWrite(DB2, db2);
    digitalWrite(DB1, db1);
    digitalWrite(DB0, db0);
    //piscaE();
    delay(10);

}


void escreve(int db7, int db6, int db5, int db4, int db3, int db2, int db1, int db0) {
    digitalWrite(RS, HIGH);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, db7);
    digitalWrite(DB6, db6);
    digitalWrite(DB5, db5);
    digitalWrite(DB4, db4);
    digitalWrite(DB3, db3);
    digitalWrite(DB2, db2);
    digitalWrite(DB1, db1);
    digitalWrite(DB0, db0);
}


void piscaE() { //Function to blink ENABLE pin

    // NOT shure how enable pin works
    digitalWrite(E, 1);
    delay(11);
    digitalWrite(E, 0);
}


void limpa() { //Function to clear display
    piscaE();
    digitalWrite(RS, LOW);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, LOW);
    digitalWrite(DB6, LOW);
    digitalWrite(DB5, LOW);
    digitalWrite(DB4, LOW);
    digitalWrite(DB3, LOW);
    digitalWrite(DB2, LOW);
    digitalWrite(DB1, LOW);
    digitalWrite(DB0, HIGH);
    returnHome();
}


void entryModeSet(int id, int s) {

    //0 0 0 0 0 0 0 1 I/D S   -   ENTRY MODE SET
    
    digitalWrite(RS, LOW);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, LOW);
    digitalWrite(DB6, LOW);
    digitalWrite(DB5, LOW);
    digitalWrite(DB4, LOW);
    digitalWrite(DB3, LOW);
    digitalWrite(DB2, HIGH);
    digitalWrite(DB1, id);
    digitalWrite(DB0, s);
}


void functionSet() {
    // 0  0  0  0  1  1  0  0  *  * -> Function set

    digitalWrite(RS, LOW);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, LOW);
    digitalWrite(DB6, LOW);
    digitalWrite(DB5, HIGH);
    digitalWrite(DB4, HIGH);
    digitalWrite(DB3, LOW);
    digitalWrite(DB2, LOW);
    
}


void displayOnOff() {
    //0  0  0  0  0  0  1  1  1  0 -> Display ON/OFF control

    digitalWrite(RS, LOW);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, LOW);
    digitalWrite(DB6, LOW);
    digitalWrite(DB5, LOW);
    digitalWrite(DB4, LOW);
    digitalWrite(DB3, HIGH);
    digitalWrite(DB2, HIGH);
    digitalWrite(DB1, HIGH);
    digitalWrite(DB0, LOW);
}


void escreveEspaco() { //Function to write a space
    //1  0  0  0  1  0  0  0  0  0 -> Writes a space
    piscaE();
    digitalWrite(RS, HIGH);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, LOW);
    digitalWrite(DB6, LOW);
    digitalWrite(DB5, HIGH);
    digitalWrite(DB4, LOW);
    digitalWrite(DB3, LOW);
    digitalWrite(DB2, LOW);
    digitalWrite(DB1, LOW);
    digitalWrite(DB0, LOW);
    piscaE();
}


void escreveEspaco(int quant) { //Function to write a specific number of spaces
    //1  0  0  0  1  0  0  0  0  0 -> Writes a space

    for (int i = 1; i <= quant; i++) { 
        piscaE();
        digitalWrite(RS, HIGH);
        digitalWrite(RW, LOW);
        digitalWrite(DB7, LOW);
        digitalWrite(DB6, LOW);
        digitalWrite(DB5, HIGH);
        digitalWrite(DB4, LOW);
        digitalWrite(DB3, LOW);
        digitalWrite(DB2, LOW);
        digitalWrite(DB1, LOW);
        digitalWrite(DB0, LOW);
        //piscaE();
    }
    piscaE();
}


void returnHome() { //Function to return cursor to adress 0 according to datasheet
    piscaE();
    digitalWrite(RS, LOW);
    digitalWrite(RW, LOW);
    digitalWrite(DB7, LOW);
    digitalWrite(DB6, LOW);
    digitalWrite(DB5, LOW);
    digitalWrite(DB4, LOW);
    digitalWrite(DB3, LOW);
    digitalWrite(DB2, LOW);
    digitalWrite(DB1, HIGH);
    digitalWrite(DB0, LOW);
    piscaE();
}

So you want to learn all the intelligence that goes into a library?

Methinks you are barking up the wrong tree!

You do understand that LiquidCrystal.h is essentially obsolete and no longer supported, do you not?

Before proceeding with your own version - unless you really want to do it for your own amusement - you need to install Bill Perry's HD44780 library using the Library Manager and work through the test examples to fully probe your display.

If that library cannot operate your undocumented "old one", I fear you are in deep do-do!

I tested the code also using my new display (that one the comes with Arduino) and also didn’t work, so that why I believe the code is not OK. On the new if I use the library it works good

so this means for me:
the new display is working with the code from the library. The library is basically ok. Your “other” code is grab and the main problem is the “old display”.
Overal, if the “old” display is really a HD44780 display it should work with the working library as long as it is not damaged.

Continue with the working library.
Show good pictures of the display (front and back) and the wiring to your Arduino in such a quality that we can identify each and every wire
and post an adopted code fitting to your wiring.

EduAQA:
Does anybody has a code that I can use to test a display based on HD44780? I have a old one that is not working, maybe slow and LiquidCrystal.h is not compatible.
...

Have you tried doing a Google search for "LCD Programming Examples". In the US the first hit will take you to LCD Programming Examples .

Don