LCD partially working?

Hi,
I’m a newbie.
I suppose pictures says it all… Any idea what could be wrong?

Any idea what could be wrong?

Either the software, the hardware, or both.

You won't get a better answer until you provide more information.

You might want to take a look at this: How to use this forum - please read.

Don

Hi,

Thanks for your reply Don.
I am not that specious about the software, since I used the GLCD diagnostics from GLCD library. I 've also tried some other examples and also wrote a sketch my self, however, the sections on the glcd (as shown in the pics) remain blank…

#include <glcd.h>
#include "glcd_Buildinfo.h"
#include "include/glcd_io.h"
#include "include/glcd_errno.h"
#include "fonts/SystemFont5x7.h"       // system font

/*
 * Macros to convert chip#s to upper and lower pixel coordinates.
 * x1,y1 is upper left pixel coordinate and x2,y2 is lower left right coordinate.
 */

#define chip2x1(chip) ((chip * CHIP_WIDTH) % DISPLAY_WIDTH)
#define chip2y1(chip) (((chip * CHIP_WIDTH)/DISPLAY_WIDTH) * CHIP_HEIGHT)
#define chip2x2(chip) ((chip2x1(chip) + CHIP_WIDTH) >= DISPLAY_WIDTH ? DISPLAY_WIDTH-1 : chip2x1(chip) + CHIP_WIDTH-1)
#define chip2y2(chip) ((chip2y1(chip) + CHIP_HEIGHT) >= DISPLAY_HEIGHT ? DISPLAY_HEIGHT-1 : chip2y1(chip) + CHIP_HEIGHT-1)

#include <avr/pgmspace.h>
#define P(name)   static const prog_char name[] PROGMEM   // declare a static string in AVR Progmem

#define MAX_ERRORS 10

#ifdef _AVRIO_AVRIO_
#define SerialPrintPINstr(x) \
  _SerialPrintPINstr(x, AVRIO_PIN2AVRPORT(AVRIO_PIN2AVRPIN(x)), AVRIO_PIN2AVRBIT(AVRIO_PIN2AVRPIN(x)))
#else
#define SerialPrintPINstr(x) _SerialPrintPINStr(x)
#endif

/*
 * declare a string for a horizontal line in program memory
 */
P(hline) =  "--------------------------------------------------------------------\n";


#define xstr(s) str(s)
#define str(...) #__VA_ARGS__

/*
 * Function to print a simple Quoted string to serial port.
 * The string is automagically forced to live in AVR flash/program space.
 */

#define SerialPrintQ(str) SerialPrintP(PSTR(str))

/*
 * print Progmem string to the serial port
 * (have to insert carriage returns as serial port runs in 'raw' mode)
 *
 */

void SerialPrintP(const prog_char * str )
{
  char c;
  const prog_char *p = str;

  while ((c = pgm_read_byte(p++)))
  {
    if(c == '\n')
      Serial.print('\r');
    Serial.print(c);   
  }
}

#ifdef SERIALPRINTF

/*
 * Define a REAL printf since Arduino doesn't have one
 *
 * SerialPrintf() will automatically put the format string in AVR program space
 * 
 */

#define SerialPrintf(fmt, ...) _SerialPrintf(PSTR(fmt), ##__VA_ARGS__)

extern "C" {
  int serialputc(char c, FILE *fp)
  { 
      if(c == '\n')
        Serial.write('\r'); 
    Serial.write(c); 
  }
}


void _SerialPrintf(const char *fmt, ...)
{
FILE stdiostr;
va_list ap;

  fdev_setup_stream(&stdiostr, serialputc, NULL, _FDEV_SETUP_WRITE);

  va_start(ap, fmt);
  vfprintf_P(&stdiostr, fmt, ap);
  va_end(ap);
}

/*
 * Define an eprintf() function for error output
 * (map it to the SerialPrintf() defined above)
 */
#define eprintf(...) SerialPrintf(__VA_ARGS__)

#endif //SERIALPRINTF


/*
 * GlcdPrintf() will automatically put the format string in AVR program space
 */
#define GlcdPrintf(fmt, ...) GLCD.Printf_P(PSTR(fmt), ##__VA_ARGS__)


void setup()
{
  Serial.begin(9600);

#ifdef CORE_TEENSY
  delay(2000);    // allow USB time to come up.
                  // plus give user time to start serial monitor
                  // NOTE: for Teensy users:
                  //       Watch for the serial monitor icon in the IDE
                  //       to briefly "flash". When it does, USB is up and the IDE
                  //       has noticed the Teensy board. You can then click on the icon
                  //       to connect the teensy board virtual com port.
#endif

  delay(5);    // allow the hardware time settle
  SerialPrintQ("Serial initialized\n");
}


/*
 * Attempt to show some graphical information on
 * the display that will easily visually demonstrate
 * whether or not the chip select lines are properly
 * connected.
 */
void showchipselscreen(void)
{
  /*
   * draw a trangle
   */
  for(int x = 0; x < GLCD.Width; x++)
  {
     GLCD.DrawVLine( x, 0, map(x, 0, GLCD.Right, 0, GLCD.Bottom));
     delay(50); // delay is to allow seeing if chip selects are duplicated or overlapping
  }   
  delay(4000);
  // show chips
  GLCD.ClearScreen();
  for(int chip = 0; chip < glcd_CHIP_COUNT; chip++)
  {
    // delay and flash is to allow seeing duplicate or overlapping chip selects
    for(uint8_t flash = 0; flash < 4; flash++)
    {
      GLCD.CursorToXY(chip2x1(chip), chip2y1(chip));
      if(flash & 1)
        GLCD.SetFontColor(BLACK);
      else
        GLCD.SetFontColor(WHITE);
      GLCD.print("Chip:");
      GLCD.print(chip);
      delay(350); 
    }
  }

  delay(5000);

  /*
   * show Version info and Sequential ascii characters 
   */
  GLCD.ClearScreen();
  GLCD.CursorTo(0,0);
  GLCD.print("GLCD   ver ");
  GLCD.println(GLCD_VERSION, DEC); 
  GLCD.print("gText  ver ");
  GLCD.println(GTEXT_VERSION, DEC); 
  GLCD.print("Device ver ");
  GLCD.println(GLCD_Device, DEC); // no newline to prevent erase EOL
  for(int i=0; i  < GLCD.Width / GLCD.CharWidth(' '); i++ )
  {
     GLCD.print(char('A' + i)); // show the ascii character
  }
  delay(5000);
}

void  loop()
{   // run over and over again

int lcount = 1;
unsigned int glcdspeed, kops, kops_fract;
int status;

  while(1)
  {
    /*
     * Dump GLCD config information *before* trying to talk to the GLCD
     * in case there is a problem talking to the GLCD.
     * This way ensures the GLCD information is always available on the serial port.
     */

    /*
     * dump the GLCD library configuration information to
     * the serial port.
     */
    showGLCDconfig();


    SerialPrintP(hline);
    SerialPrintQ("Diag Loop: ");
    Serial.println(lcount);

    SerialPrintQ("Initializing GLCD\n");
    status = GLCD.Init();   // initialise the library, non inverted writes pixels onto a clear screen

#ifndef GLCD_NOINIT_CHECKS
    if(status) // did the initialization fail?
    {
 SerialPrintQ("GLCD initialization Failed: ");
 switch(status)
 {
 case GLCD_EBUSY:
 SerialPrintQ("BUSY wait Timeout");
 break;
 case GLCD_ERESET:
 SerialPrintQ("RESET wait Timeout");
 break;
 }
 SerialPrintQ(" (status code: ");
 Serial.print(status);
 Serial.println(')');
     goto finished;
    }
#endif


    GLCD.SelectFont(System5x7, BLACK);


    SerialPrintQ("Displaying ChipSelect Screens\n");
    showchipselscreen();
    if( lcdmemtest())
    {
      /*
       * memory tests failed.
       */
      SerialPrintQ("TEST FAILED\n");
    }
    else
    {
      SerialPrintQ("Tests PASSED\n");

      /*
       * Diags report loop count on completion
       */
      GLCD.ClearScreen();
      GLCD.CursorTo(0,0);
      GLCD.print("Diag Loop: ");
      GLCD.println(lcount);
      GLCD.println("Tests PASSED");

      /*
       * All GLCD tests passed so now
       * perform a GLCD "speed" test.
       */

      glcdspeed = getglcdspeed();
      /*
       * Calculate the speed in K operations/sec
       * Since the speed value reported is 10x the actual value,
       * Dividing by 100 gives the integer K ops/sec
       * Modulo 100 gives the factional K ops/sec
       */

      kops = glcdspeed/100;
      kops_fract = glcdspeed %100;

      GLCD.print("K SetDot/s: ");
      GLCD.print(kops);
      GLCD.print(".");
      GLCD.println(kops_fract);


      SerialPrintQ("GLCD.SetDot() speed (K ops/sec): ");
      Serial.print(kops);
      SerialPrintQ(".");
      Serial.println(kops_fract);
    }

finished:

    delay(5000);
    lcount++;
  }
}


uint8_t lcdmemtest(void)
{
  uint8_t errors = 0;

  SerialPrintQ("Walking 1s data test\n");

  errors = lcdw1test();
  if(errors)
    return(errors);

}

Hi,

I highly appreciate if I could get some help on this,

I swapped another GLCD to verify if the problem is within the GLCD however got the same results. So I ruled out that the problem is coming from GLCD.

I swapped another arduino, still the same problem persists.

I am using glcd lib V3.

The wiring configuration was done following the provided table for ks0108 type B.

GLCD Connection pins Arduino Connection pins 1 GND 2 5V 3 POT Signal 4 36 5 35 6 37 7 22 8 23 9 24 10 25 11 26 12 27 13 28 14 29 15 33 16 34 17 30 18 POT leg 3 19 5V 20 220ohm in series to GND

I've tried to rewire it several time to eliminate any errors in wiring.. Still screen not functioning properly.

Also tried out other programs such as Big Nums from library with the same problem...

Any ideas?? please help!!