12864ZW - Not working

Hi,

I cannot get a 128x64 display working. Given the markings on the back, "12864ZW", I believe the datasheet is this: http://www.digole.com/images/file/Digole_12864_LCD.pdf

Problem 1: can't set the contrast. Unfortunately the datasheet doesn't say how to do it. With a 10k VR wiper connected to the V0 pin, I've tried connecting the other VR pins to: VSS/VDD, VDD/VOUT, neither combination worked. They all give the same result as leaving V0 floating. So I presume contrast has been pre-set on the module.

Problem 2 (Main problem): No data I send to the module seems to do anything. The only way I can get any change in what's displayed is by holding the reset pin low or letting it float high. When I hold reset low, as per the photo, the whole screen is blue, I presume that means all pixels are off. When I let reset float high (or hold it high) as per the other photo, it seems all pixels are on (white). Being optimistic, to me this suggests at least that the contrast is adequately pre-set.

The pin connections I've used with the Arduino Nano is as follows:

LCD -> Nano
VSS (1) -> GND (12)
VDD (2) -> 5V (19)
V0 (3) -> NC
RS (4) -> D2 (11)
R/W (5) -> GND (12) (puts into write mode)
E (6) -> D3 (10)
DB0 (7) -> D4 (9)
DB1 (8) -> D5 (8)
DB2 (9) -> D6 (7)
DB3 (10) -> D7 (6)
DB4 (11) -> D8 (5)
DB5 (12) -> D9 (4)
DB6 (13) -> D10 (3)
DB7 (14) -> D11 (2)
PSB (15) -> float high (puts into parallel mode)
NC (16) -> NC
RST (17) -> D12(1)
VOUT(18) -> NC
BLA (19) -> 5V (19) via 470ohm resistor
BLK (20) -> GND (12)

The code I've used is as follows. I have used significantly longer delays than the datasheet specifies. I was hoping the least I'd get is either a blinking cursor, or for all pixels to turn off. Sadly absolutely nothing happens, I just get all pixels on, as if I hadn't sent any commands or data at all.

Please help! I'm at a complete loss here now. Thanks!

int RST = 12;
int RS = 2;
int EN = 3;
int DB0 = 4;
int DB1 = 5;
int DB2 = 6;
int DB3 = 7;
int DB4 = 8;
int DB5 = 9;
int DB6 = 10;
int DB7 = 11;
int LED = 13;
int ledOn = 0;

void setup() {
  initLCD();
}
void loop() { 
}

void initLCD(){
  
  pinMode(RST, OUTPUT);
  pinMode(RS, OUTPUT);
  pinMode(EN, OUTPUT);
  pinMode(DB0, OUTPUT);
  pinMode(DB1, OUTPUT);
  pinMode(DB2, OUTPUT);
  pinMode(DB3, OUTPUT);
  pinMode(DB4, OUTPUT);
  pinMode(DB5, OUTPUT);
  pinMode(DB6, OUTPUT);
  pinMode(DB7, OUTPUT);
  
  digitalWrite(RST, 0);

  // ensure EN starts off low
  digitalWrite(EN, 0);

  // delay while screen resets
  delay(100);

  // come out of reset
  digitalWrite(RST, 1);

  // lcd start up time
  delay(100);
  
  // set 8 bit mode & basic instruction set
  send(0, 0, 0, 1, 1, 0, 0, 0, 0);
  delayMicroseconds(200);
  
  // do it again (as per datasheet flow chart)
  send(0, 0, 0, 1, 1, 0, 0, 0, 0);
  delayMicroseconds(100);
  
  // Display ON/OFF
  // 0, 0, 0, 0, 0, 1, DISPLAY, CURSOR, BLINK;
  // I have tried both of the following:
  // send(0, 0, 0, 0, 0, 1, 0, 0, 0);
      send(0, 0, 0, 0, 0, 1, 1, 1, 1);
  delayMicroseconds(200);
  
  // Display Clear
  send(0, 0, 0, 0, 0, 0, 0, 0, 1);
  delay(20);
  
  // Entry mode set
  //   0, 0, 0, 0, 0, 0, 1, I/D, S
  send(0, 0, 0, 0, 0, 0, 1, 0, 0);
}

void send(
  byte rs,
  byte d7, byte d6, byte d5, byte d4, 
  byte d3, byte d2, byte d1, byte d0){
  
  digitalWrite(RS, rs);
  digitalWrite(EN, 1);
  digitalWrite(DB7, DB7);
  digitalWrite(DB6, DB6);
  digitalWrite(DB5, DB5);
  digitalWrite(DB4, DB4);
  digitalWrite(DB3, DB3);
  digitalWrite(DB2, DB2);
  digitalWrite(DB1, DB1);
  digitalWrite(DB0, DB0);

  // data setup time >40ns, enable pulse width > 160ns
  delayMicroseconds(1);

  digitalWrite(EN, 0);

  // data hold time >20ns
  delayMicroseconds(1);

  // enable cycle time > 1.8delayMicroseconds
  delayMicroseconds(10);
}

Edit note: I have added reset code and wiring since taking the photos. Now reset is held low while EN is set low, just in case the LCD was picking up erroneous data as the pins were initialised. However, the problems remain.

20130504_153454b.jpg

20130504_153530b.jpg

With a 10k VR wiper connected to the V0 pin, I've tried connecting the other VR pins to: VSS/VDD, VDD/VOUT, neither combination worked.

My guess is that you need the other possibility for the two ends of the potentiometer, VSS and VOUT.

Don

Thanks Don - sadly no luck with that either

Hi

I suggest to force PSB to the intended level.
The "send()" procedure looks different than the one i programmed for u8glib: Google Code Archive - Long-term storage for Google Code Project Hosting..

Oliver

Thanks for your reply Oliver,

I have tried it also holding the PSB pin high, sadly that didn't work either.

Re: your code - I don't think my LCD module is the same as yours - for starters, mine does not have pins CS1 and CS2. Saying that, I think my code is roughly the same as yours, I've just avoided using pointers and use longer delays just to be safe.

I'm not a great C/C++ programmer so have kept my code as literal as possible to make it obvious what it's doing. If I tried to use your library I can almost guarantee I'd not be able to get it to work!!!

I also bought a cheap 12864zw lcd on Ebay. Got mine to work using spi and the U8glib. Cheap 128×64 graphic lcd (12864zw) - Bajdi electronics

Ah, excellent, good idea, thanks Bajdi! I hadn't tried 4bit or serial interface yet. I'm not confident about using that library but I will give it a go from scratch writing serially and in 4 bit in case the jumper settings have hard-wired it into one of those modes.

I don't suppose you could post your code for the parallel mode with the library?

I've only tried the example sketches that come with the u8glib so far. But the library is well documented: Google Code Archive - Long-term storage for Google Code Project Hosting. Don't think its very hard to show some graphics and text on the lcd :slight_smile:

Thank you thank you thank you!!

I managed to get a u8glib Hello World example working, both in 8 bit and serial mode by uncommenting the U8GLIB_ST7920_128X64_1X line.

The problem I have now is the "Hello World" text is barely visible, and only when held very flat. I'm wondering if the jumpers can be changed so I can use a variable resistor to change the contrast, I don't know if anyone has had any luck with that?

The attached photo shows J1 is disconnected which explains why contrast wasn't changing. I'm thinking of connecting it, but I don't know if that could damage the unit? Also R12 is missing so Vout is also disconnected.

EDIT: Contrast is now fixed as well! I soldered J1. This resulted in V0 floating to 7.5v. So all I had to do was attached a variable resistor between V0 and Vdd. (The third pin of the variable resistor wasn't needed.) The VR I used was 10k ohm.

Thank you for your help, Don, Oliver, Bajdi!

Some of those boards already have a 10K pot soldered in position VR1 in your photo.

Jodes:
Thank you thank you thank you!!

I managed to get a u8glib Hello World example working, both in 8 bit and serial mode by uncommenting the U8GLIB_ST7920_128X64_1X line.

The problem I have now is the "Hello World" text is barely visible, and only when held very flat. I'm wondering if the jumpers can be changed so I can use a variable resistor to change the contrast, I don't know if anyone has had any luck with that?

The attached photo shows J1 is disconnected which explains why contrast wasn't changing. I'm thinking of connecting it, but I don't know if that could damage the unit? Also R12 is missing so Vout is also disconnected.

EDIT: Contrast is now fixed as well! I soldered J1. This resulted in V0 floating to 7.5v. So all I had to do was attached a variable resistor between V0 and Vdd. (The third pin of the variable resistor wasn't needed.) The VR I used was 10k ohm.

Thank you for your help, Don, Oliver, Bajdi!

Hi friend.
May I ask how this display connected to the AVR (ATmega16 necessary)? If I wanted to use serial communication? I found this connection: http://www.bajdi.com/wp-content/uploads/2013/03/glcd-pinout.jpg ,but I would like to control the contrast.

So what I need to connect a jumper (see picture)? thank you