LCD4Bit for 20x4 displays!

I tried your modified version of the LCD4Bit on **tm404a:**http://www.tianma.com/index.php?mod=productmgr&task=product&idcat=1&id=139.
It worked very fine on the first two lines of my display.

This display has a second HD44780 for the third and fourth line with its own Enable Input.
So I wired the second Enable Input to pin 3 on the arduino and edited mainly LCD4Bit::cursorTo(int line_num, int x) a little to work with this display.

//non-core stuff --------------------------------------
//move the cursor to the given absolute position.  line numbers start at 1.
//if this is not a 2-line LCD4Bit instance, will always position on first line.
//
//legba7: second controller, with its own Enable input, for line 3 and 4
void LCD4Bit::cursorTo(int line_num, int x){

  //if we are on a 1-line display, set line_num to 1st line, regardless of given
  if (g_num_lines==1){
    line_num = 1;
    Enable = Enable1;
  }
  //offset 40 chars in if second line requested
  //
  switch (line_num){
  case 1:
    Enable = Enable1;
    x=0x00 ; break;;
  case 2: 
    Enable = Enable1;
    x= 0x40 ; break;;
  case 3: 
    //line_num = 1;
    Enable = Enable2;
    x=0x00; break;;
    //x+= 0x14 ; break;; // In fact, line 3 is an extension of the line 1 (beyond the 20 first characters)
  case 4: 
    Enable = Enable2;
    //x+= 0x54 ; break;; // Line 4 is an extension of line 2
    x= 0x40 ; break;; // Line 4 is an extension of line 3
  }
  
  commandWrite(0x80+x);
}

and the pinpart

// --------- PINS -------------------------------------
//is the RW pin of the LCD under our control?  If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.
//this stops us sending signals to the RW pin if it isn't being used.
int USING_RW = false;

//RS, RW and Enable can be set to whatever you like
int RS = 12;
int RW = 11;
//legba7: two HD44780; per HD44780 one Enable Input
int Enable1 = 2;
int Enable2 = 3;
int Enable = Enable1;
//DB should be an unseparated group of pins  - because of lazy coding in pushNibble()
int DB[] = {7, 8, 9, 10};  //wire these to DB4~7 on LCD.

//--------------------------------------------------------

//how many lines has the LCD? (don't change here - specify on calling constructor)
int g_num_lines = 2;

the library is now a little bit different to handle, example:

// --------- PINS -------------------------------------
//is the RW pin of the LCD under our control?  If we're only ever going to write to the LCD, we can use one less microcontroller pin, and just tie the LCD pin to the necessary signal, high or low.
//this stops us sending signals to the RW pin if it isn't being used.
int USING_RW = false;

//RS, RW and Enable can be set to whatever you like
int RS = 12;
int RW = 11;
//legba7: two HD44780; per HD44780 one Enable Input
int Enable1 = 2;
int Enable2 = 3;
int Enable = Enable1;
//DB should be an unseparated group of pins  - because of lazy coding in pushNibble()
int DB[] = {7, 8, 9, 10};  //wire these to DB4~7 on LCD.

//--------------------------------------------------------

//how many lines has the LCD? (don't change here - specify on calling constructor)
int g_num_lines = 2;

i put the stuff under Arduino Playground - LCD4BitLibrary-tm404a
with kind regards,
legba7