Help with pinout on a ST7920 128X64 LCD Display

Hi,

I have a 128x64 monochrome LCD display with an ST7920 chip, and I am trying to write to it using an Arduino MEGA rev3 using u8glib. The labels on the display are a little cryptic to me. I have some background in electronics, but am new to Arduino MEGA, and a day of searching has still left me uncertain what each pin does.

I managed to get the display to show the top left hand quarter of the word "HELLO" by trying to connect all possible permutations of pins 50, 51, and 52 to the three labelled ports (excluding of course VD and VS). This stopped working when I disconnected the board and reuploaded the code.

I am attaching below an image with a photograph of the labels on the output of the display. In the table below I list my current wiring and understanding of their function. I believe the other non-labelled ports are used for two other components on the display board: a rotating press button and a buzzer, and possibly also a button, based on this source.

+-----+------------------------------------+-------------------------------------+------------------+
| Pin | Label                              | Function                            | Arduino MEGA Pin |
+-----+------------------------------------+-------------------------------------+------------------+
| 1   | VS                                 | Ground                              | GND              |
+-----+------------------------------------+-------------------------------------+------------------+
| 2   |                                    |                                     |                  |
+-----+------------------------------------+-------------------------------------+------------------+
| 3   | E                                  | Clock?                              | 52               |
+-----+------------------------------------+-------------------------------------+------------------+
| 4   | RW                                 | Read write?                         | 51               |
+-----+------------------------------------+-------------------------------------+------------------+
| 5   |                                    |                                     |                  |
+-----+------------------------------------+-------------------------------------+------------------+
| 6   |                                    |                                     |                  |
+-----+------------------------------------+-------------------------------------+------------------+
| 7   | AO (the letter O not the number 0) | Command/data selection              | 50               |
+-----+------------------------------------+-------------------------------------+------------------+
| 8   |                                    |                                     |                  |
+-----+------------------------------------+-------------------------------------+------------------+
| 9   |                                    |                                     |                  |
+-----+------------------------------------+-------------------------------------+------------------+
| 10  | VD                                 | Positive power source for backlight | 5V               |
+-----+------------------------------------+-------------------------------------+------------------+

Here is the accompanying code (adapted from the Hello World code distributed with u8glib).

#include "U8glib.h"

U8GLIB_ST7920_128X64_4X u8g(51, 50, 52);	// SPI Com: SCK = en = 18, MOSI = rw = 16, CS = di = 17
void draw(void) {
  // graphic commands to redraw the complete screen should be placed here  
  u8g.setFont(u8g_font_unifont);
  u8g.drawStr( 0, 22, "Hello World!");
}

void setup(void) {
  // assign default color value
  if ( u8g.getMode() == U8G_MODE_R3G3B2 ) {
    u8g.setColorIndex(255);     // white
  }
  else if ( u8g.getMode() == U8G_MODE_GRAY2BIT ) {
    u8g.setColorIndex(3);         // max intensity
  }
  else if ( u8g.getMode() == U8G_MODE_BW ) {
    u8g.setColorIndex(1);         // pixel on
  }
  else if ( u8g.getMode() == U8G_MODE_HICOLOR ) {
    u8g.setHiColorByRGB(255,255,255);
  }
  
  pinMode(8, OUTPUT);
}

void loop(void) {
  // picture loop
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );
  
  // rebuild the picture after some delay
  delay(50);
}

My questions are:

  • What do the labels on the pins of the LCD stand for? I haven't seen this convention elsewhere
  • Why did only part of HELLO appear when I ran the code, and why does it now no longer appear at all?
  • How can I rewire/recode this so it works

I am new so please go easy!

Life is MUCH simpler when you post a link to the actual display that you bought. e.g. Ebay sale page

David.

It's actually saved from scrap! It is a Digipole 12864ZW-10. Here is the datasheet.