Author Topic: NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines  (Read 5400 times)

stylonurus

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
    • View Profile
NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines
« on: June 11, 2014, 07:11:23 PM »
This problem is a bit strange for me and I'm not sure if it's a hardware issue or a software issue. But I have now seen it on both of my test boards.
I am using a Silabs C8051F500 development board with jtag connection for IDE / debuggger.
Silabs board has extender board with OLED display.
Mostly everything works fine.
I have written the driver and a library of routines to write to any line of the display (parallel interface).

The problem.
When I re power the system only lines 1 and 3 are displayed. 2 and 4 are not displayed
But when I connect with the debugger and then disconnect. On the disconnect all the lines including the second and fourth line get displayed. ( might have to connect disconnect 3 or 4 times before 4 lines get displayed)
Once all 4 lines are displayed, they are always displayed.
Is this a timing issue?
A power up voltage issue?
Something else?

Please let me know if you have seen this before.

Thanks

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines
« Reply #1 on: June 12, 2014, 09:39:07 AM »
This issue only happens when power cycling the display and not when being powered on for the first time?  Can you share you initialization code?

stylonurus

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
    • View Profile
Re: NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines
« Reply #2 on: June 12, 2014, 10:23:18 AM »
Michael,

I used a delay timer called spinlock to slow things down. I've tried different delay times as well but the delay does not seem to help or change behavior.
More than not, the two lines occur on a cold power up cycle. After running a while if I quickly re power , the four lines appear most of the time. After waiting 5 seconds between powering up the 2 lines appear most of the time.  I tied delaying 3 seconds after power up and before call initialization routine. It did not improve behavior.
All comments, ideas and suggestions are most welcome.

Thanks

void oledInit(void)
{

   P4 = 0x00;   //initialize PORT 4 to 0x00
   spinLock(1,  ONE_MS_RELOAD);      // Spin 1 ms
   LCD_RW = 0;
   spinLock(1,  ONE_MS_RELOAD);      // Spin 1 ms
   LCD_E = 1;
   spinLock(1,  ONE_MS_RELOAD);      // Spin 1 ms


   writeOledCommand(0x3B);           //     Function Set
   writeOledCommand(0x08);           //     Display Off
   writeOledCommand(0x01);           //     Display Clear
   writeOledCommand(0x06);           //     Entry Mode Set
   writeOledCommand(0x02);           //     Home Command
   writeOledCommand(0x0C);          //      Display On
   spinLock(5,  ONE_MS_RELOAD);   //     Spin 5 ms
}


void writeOledCommand(U8 cmd)
{
   // write command
   LCD_RS = 0;
   spinLock(1,  ONE_MS_RELOAD);
   P4 =  cmd;
   spinLock(1,  ONE_MS_RELOAD);
   LCD_E = 1;
   spinLock(1,  ONE_MS_RELOAD);
   LCD_E = 0;
}

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines
« Reply #3 on: June 13, 2014, 11:53:59 AM »
I'm not sure of the cause of your problem, as I have just tested this with an Arduino using your initialization and have not seen the same results as you have described.
I've powered it on/off several times, and have manually reset the processor as well and in all cases all 4 lines would work.
I have copied my code below if that helps with any other areas of code that you have not shared in your last post:

Code: [Select]
//---------------------------------------------------------
/*
NHD_0420DZW_mega.ino
Program for writing to Newhaven Display 4 x 20 Character OLED (8-bit, 6800 mode)

(c)2014 Mike LaVine - Newhaven Display International, LLC.

        This program is free software; you can redistribute it and/or modify
        it under the terms of the GNU General Public License as published by
        the Free Software Foundation; either version 2 of the License, or
        (at your option) any later version.

        This program is distributed in the hope that it will be useful,
        but WITHOUT ANY WARRANTY; without even the implied warranty of
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        GNU General Public License for more details.
*/
//---------------------------------------------------------

// The 8 bit data bus is connected to PORTA[7..0] of the Arduino Mega2560

int RS =  30;    // RS signal connected to digital pin 30 of Arduino Mega2560
int RW =  31;    // R/W signal connected to digital pin 31 of Arduino Mega2560
int  E =  32;    // E signal connected to digital pin 32 of Arduino Mega2560

const char text1[] = {"  Newhaven Display  "};
const char text2[] = {"   Character OLED   "};
const char text3[] = {"  4 Line x 20 Char  "};
const char text4[] = {"0123456789!@#$%^&*()"};

void toggle()
{
   digitalWrite(E, HIGH);
   delay(1);
   digitalWrite(E, LOW);
}

void command(char c)

   PORTA = c;
   digitalWrite(RS, LOW);
   toggle();
}

void data(char d)
{
   PORTA = d;
   digitalWrite(RS, HIGH);
   toggle();
}

void disp()
{
   int i;
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   delay(5);
   for (i=0;i<20;i++)
   {
      data(text1[i]);
   }
   command(0xC0);  //Second Line  [Set DDRAM address to Line 2 position 1]
   for (i=0;i<20;i++)
   {
      data(text2[i]);
   }
   command(0x94);  //Third Line  [Set DDRAM address to Line 3 position 1]
   for (i=0;i<20;i++)
   {
      data(text3[i]);
   }
   command(0xD4);  //Fourth Line  [Set DDRAM address to Line 4 position 1]
   for (i=0;i<20;i++)
   {
      data(text4[i]);
   }
}

void setup()

   DDRA = 0xFF;    //set PORTA (dat bus) as output
   PORTA = 0x00;   //initialize PORTA to 0x00
   DDRC = 0xFF;    //set PORTC (control lines) as output
   PORTC = 0x00;   //initialize PORTC to 0x00

   command(0x3B);  //Function Set  [8-bit mode, Font Table: English/Japanese (FT[1:0] = 00)]
   command(0x08);  //Display OFF
   command(0x01);  //Display Clear
   command(0x06);  //Entry Mode Set  [Auto increment address when a character is written]
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   command(0x0C);  //Display ON
}

void loop()

  disp();
  delay(3000);
}

stylonurus

  • Newbie
  • *
  • Posts: 5
  • Karma: 1
    • View Profile
Re: NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines
« Reply #4 on: June 17, 2014, 06:08:50 PM »
Mike,
Thanks for checking this out.

As it stands, I got this to work by writing the function set command twice in the initialization routine.
   writeOledCommand(0x3B); //     Function Set
   writeOledCommand(0x3B); //     Function Set

Looks like some voltage or wiring issue on the extender board. That' all I can think of.

Thanks again,

Michael_L

  • Administrator
  • Hero Member
  • *****
  • Posts: 356
  • Karma: 33
    • View Profile
Re: NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines
« Reply #5 on: June 18, 2014, 10:09:49 AM »
Glad you got it working, thank you for sharing!

 

Blank Display on NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM

Started by SteveCBoard Character LCDs

Replies: 3
Views: 4370
Last post May 13, 2014, 12:04:36 AM
by SteveC
NHD‐C12864A1Z‐FSW‐FBW‐HTT display clears after draw

Started by EdAverillBoard Graphic LCDs

Replies: 6
Views: 5427
Last post November 07, 2014, 08:25:20 AM
by Michael_L
NHD‐4.3‐480272EF‐ATXL#‐CTP | FAN5333 | BBB | Nothing on the Display

Started by Alias_AliasBoard TFTs

Replies: 1
Views: 3206
Last post September 25, 2015, 03:09:24 PM
by Paul_B
Arduino LCD library not working with newhaven display NHD‐0420H1Z‐FL‐GWB-3V3

Started by c2hollowBoard Character LCDs

Replies: 9
Views: 8274
Last post July 10, 2014, 08:46:06 AM
by Michael_L
Optical bonding Display to cover glass (dry film bonding)

Started by fourtraxBoard TFTs

Replies: 1
Views: 974
Last post September 29, 2016, 08:35:00 AM
by Saurabh_B