Two problems LCD 4x40 matrix orbital

Hi guys.I would like to use LCD Smartie but I have two problems.

1-The first line shows the correctly,but If you set 2x40 or 4x40 picture broken.

2-I know that lcd has 2 chipset, but how is connect? Will I have to join some other parts?

My board is Arduino nano v 3.0,LCD jhd404a-4,datasheed: http://pdf1.alldatasheet.com/datasheet-pdf/view/276116/JHD/JHD404A.html

My Arduino code:

/*
 arduino-matrixorbital.ino
 A software emulator for Matrix Orbital character display commands on Arduino.
 
 V1.5 28/12/2011
 Added fixes by yosoyzenitram, prettified code a little and added all Matrix Obrital commands for display model LK204-25.
 
 V1.0 6/2/2010
 Coded by giannoug <giannoug@gmail.com>
 Based on code by nuelectronics <http://www.nuelectronics.com/>
 
 You can use whatever screen size you want, but you will
 have to make proper adjustments to both this file and at
 LCDSmartie's configuration menu or whatever program you
 might use.
 
 Matrix Orbital LK204-25 manual (for command reference):
 http://www.matrixorbital.ca/manuals/LK_Series/LK204-25/LVK204-25%20%28Rev1.3%29.pdf
 
 The circuit (make sure to power the LCD):
 * LCD RS pin to digital pin 12
 * LCD E pin to digital pin 11
 * LCD D4 pin to digital pin 5
 * LCD D5 pin to digital pin 4
 * LCD D6 pin to digital pin 3
 * LCD D7 pin to digital pin 2
 * LCD Ve pin (contrast) to digital pin 6
 
 */

#include <LiquidCrystal.h>

// You can define your own pins here.
#define RS 12
#define E  11
#define D4 5
#define D5 4
#define D6 3
#define D7 2
#define BR 6

#define VERSION 1

#define GPO1 8 // Not yet implemented. (pg. 18 of the manual)

LiquidCrystal lcd(RS, E, D4, D5, D6, D7);

void setup() {
  Serial.begin(9600); // Default baudrate.
  lcd.begin(40, 4); // Change this for other screen sizes.

  analogWrite(BR, 0); // Set maximum brightness.

  lcd.print("Arduino");
  lcd.setCursor(1, 1);
  lcd.print("Matrix Orbital!");
}

void loop() {
  byte rxbyte = serial_getch(); // Command
  byte temp; // Parameter

  if (rxbyte == 254) {
    switch (serial_getch()) {
    case 71: // Set cursor position (2 parameters, column, row)
      lcd.setCursor(serial_getch() - 1, serial_getch() - 1);
      break;
    case 72: // Cursor home (doesn't clear the screen!)
      //lcd.home();
      lcd.setCursor(0,0);
      break;
    case 74: // Underline cursor on
      lcd.cursor();
      break;
    case 75: // Underline cursor off
      lcd.noCursor();
      break;
    case 83: // Block cursor on
      lcd.blink();
      break;
    case 84: // Block cursor off
      lcd.noBlink();
      break;
    case 76: // Move cursor left
      lcd.command(16);
      break;
    case 77: // Move cursor right
      lcd.command(20);
      break;
    case 78: // Define custom character (2 parameters, id, data)
      lcd.command(64 + (serial_getch() * 8));
      for (temp = 7; temp != 0; temp--) {
        lcd.print(serial_getch());
      }
      break;
      //case 35: // Read serial number
      //case 36: // Read version number
    case 54: // Read version number
      Serial.print(VERSION);
      break;
    case 55: // Read module type
      Serial.print(9); // 9 for LK204-25
      break;
    case 80: // Set contrast (1 parameter, contrast)
      analogWrite(BR, 0xFF-serial_getch());
      break;
    case 81: // Auto scroll on
      lcd.autoscroll();
      break;
    case 82: // Auto scroll off
      lcd.noAutoscroll();
      break;
    case 86: // General Purpose Output off (1 parameter, number)
      //temp = serial_getch();
      //if (temp == 1) {
      //  digitalWrite(GPO1, LOW);
      //}
      break;
    case 87: // General Purpose Output on (1 parameter, number)
      //temp = serial_getch();
      //if (temp == 0) {
      //  digitalWrite(GPO1, HIGH);
      //}
      break;
    case 88: // Clear screen
      lcd.clear();
      break;
    case 35: // Place large number
    case 38: // Poll key presses
    case 51: // Change I2C slave address (1 parameter, address)
    case 57: // Change baud rate (1 parameter, baud rate)
    case 59: // Exit flow-control mode
    case 61: // Place vertical bar (2 parameters, column, length)
    case 64: // Change the startup screen
    case 65: // Auto transmit keypresses on
    case 67: // Auto line wrap on
    case 68: // Auto line wrap off
    case 66: // Backlight on (1 parameter, minutes)
    case 69: // Clear key buffer
    case 70: // Backlight off
    case 79: // Auto transmit keypress off
    case 85: // Set debounce time (1 paramater, time)
    case 96: // Auto repeat mode off
    case 152: // Set and save brightness (1 parameter, brightness)
    case 153: // Set backlight brightness (1 parameter, brightness)
    case 104: // Initialize horizontal bar
    case 109: // Initialize medium number
    case 110: // Initialize lange numbers
    case 111: // Place medium numbers
    case 115: // Initialize narrow vertical bar
    case 118: // Initialize wide vertical bar
    case 124: // Place horizontal bar graph (4 parameters, column, row, direction, length)
    case 126: // Set auto repeat mode (1 parameter, mode)
    case 145: // Set and save contrast (1 parameter, contrast)
    case 160: // Transmission protocol select (1 parameter, protocol)
    case 192: // Load custom characters (1 parameter, bank)
    case 164: // Setting a non-standart baudrate (1 parameter, speed)
    case 193: // Save custom character (3 parameters, bank, id, data)
    case 194: // Save startup screen custom characters (2 parameters, id, data)
    case 195: // Set startup GPO state (2 parameters, number, state)
    case 200: // Dallas 1-Wire
      switch (serial_getch()) {
      case 1: // Dallas 1-Wire transaction (6 parameters, flags, send, bits, receive, bits, data)
      case 2: // Search for a 1-Wire device
      default:
        break;
      }
      break;
    case 213: // Assign keypad codes
    default:
      /* All other commands are ignored 
       and parameter byte is discarded. */
      temp = serial_getch();
      break;
    }
    return; // Stop and start again.
  }

  // Otherwise its a plain char so we print it to the LCD.
  lcd.write(rxbyte);
}

/*
 * Waits for a byte to be available, reads and returns it.
 */
byte serial_getch() {
  while (Serial.available() == 0);

  return Serial.read();
}

and images setting 1x40 its ok http://www.2imgs.com/26982f05d6
setting 2x40 broken http://2imgs.com/2i/i/53f9d9a6/649d094a4e4c34071942d00f94409445/37893e14c7.f.png

Thank for answer.

Hi guys.I would like to use LCD Smartie but I have two problems....

I can't help you with LCD Smartie.

You have at least two options to deal with the dual controllers on a 40x4 display where there are two 'Enable' pins.

(1) You can treat this as being two displays in parallel as explained in this forum thread: --> http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1265969050

(2) You can use the LiquidCrystal1.0 library designed specifically for the 40x4 display. To get a copy start here:--> Google Code Archive - Long-term storage for Google Code Project Hosting. and follow the Downloads link to get to the latest version.

Don

LCD is connect right.
When i insert modifed basic code working good.Pin E1 control line 1,2 and pin E2 control line 3,4(besause lcd have two chipset)

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
LiquidCrystal lcd2(12, 10, 5, 4, 3, 2);

void setup() {
  // set up the LCD's number of columns and rows: 
  lcd.begin(40, 2);
  // Print a message to the LCD.
  lcd.print("1abcdefghchijklmnopqrstuvwxyzabcdefghi401abcdefghchijklmnopqrstuvwxyzabcdefghi40");
  // set up the LCD's number of columns and rows: 
  lcd2.begin(40, 2);
  // Print a message to the LCD.
  lcd2.print("2abcdefghchijklmnopqrstuvwxyzabcdefghi402abcdefghchijklmnopqrstuvwxyzabcdefghi40");
}

void loop() {
  // Turn off the display:
  lcd.noDisplay();
  delay(500);
   // Turn on the display:
  lcd.display();
  delay(500);
  // Turn off the display:
  lcd2.noDisplay();
  delay(500);
   // Turn on the display:
  lcd2.display();
  delay(500);
}