Garbage on n LCD12864

Hi

I’ve just received a 12864 LCD, with a ST7920 controller, running on a mega.
I have been using lcd 1602 and 2004’s with success, but I cant get this working properly.

So far I have a very simple code to display some static text, but i am getting noise or garbage on the screen.
I have
re-soldered connections,
moved to different pins on my Mega

Has anyone else had this sort of problem?

Dave

/*

Thermometer based on Maxims DS600u+ chip


*/


#include "U8glib.h"
#include <math.h>

 // U8GLIB_ST7920_128X64_4X u8g(8, 9, 10, 11, 4, 5, 6, 7, 18, 17, 16);   // 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di=17,rw=16
U8GLIB_ST7920_128X64_4X u8g(25, 26, 27, 28,29,30, 31, 32, 24, 22, 23);   //  Daves 8Bit Com: D0..D7: 8,9,10,11,4,5,6,7 en=18, di/rs=17,rw=16



void u8g_prepare(void) {
  u8g.setFont(u8g_font_6x10);
  u8g.setFontRefHeightExtendedText();
  u8g.setDefaultForegroundColor();
  u8g.setFontPosTop();
}


void setup(void) {
  // flip screen, if required
  //u8g.setRot180();
  // assign default color value
    analogWrite(3, 50);
  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 
  //u8g.setContrast(0x30); 
  pinMode(13, OUTPUT);          
  digitalWrite(13, HIGH);  
  u8g_prepare();  
}

void draw(void) { 
//u8g.setFont(u8g_font_osb35);
u8g.setFont(u8g_font_gdr30);
u8g.drawStr(5, 50, "27");  


}

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

Hi

Somehow the ST7920 seems to be a very sensitive device. Here are some ideas: Is there a PSB pin? If yes: It MUST be connected to 5V (parallel mode). Use short wires. Wire lenth should not exceed 10cm.

Oliver

Thanks Oliver

You were right, I didn't have PSB connected So i have tied it to 5v, and it stopped the garbage, but now i get no display at all.

LED is up, contrast is ok, but none of the pixels are lit at all.

Even if I disconnect the PSB pin, I get no display..

I have re-checked my connections, everything is ok.

Not sure now. Maybe its dead?

Are you really sure you did noch change anything else?

It might be possible that the logic of the PSB pin is inverted, so maybe try connecting PSB to GND. Another question: What is the power supply of the display? Hopefully 5V....

Oliver

Thanks Oliver.

I was sure the wiring was all ok, so i started back to the basic example code from the u8g library, and that worked.

Something in my test code was wrong, perhaps the use of drwstr instead of print?

So using the u8g example - "PrintTest.pde", its working properly.

Thanks heaps for your help!.

Cheers dave