Author Topic: NHD-0420DZW 8-bit interface  (Read 2459 times)

lasteem1

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
NHD-0420DZW 8-bit interface
« on: February 01, 2015, 04:20:23 PM »
I'm attempting to transition from a LCD to a NH OLED. Starting out I'm trying  to make some sample code given out by an Admin on this forum work. That thread with code can be found here: http://www.newhavendisplay.com/NHD_forum/index.php?topic=61.0

I'm using a Silicon Labs C8051F020 and a NHD-0420DZW. I can't even get the display to come on. I've tried adjusting the timing of various interactions, but no results. Here is my code with some remnants of the changes I've tried.


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

const char text5[] = {"Line 1"};
const char text6[] = {"Line 2"};
const char text7[] = {"Line 3"};
const char text8[] = {"Line 4"};

void command(char c)

  PORTOUT1 &= RSEOFF;// digitalWrite(RS, LOW);
   PORTOUT0 = c;//PORTD = c;
   PORTOUT1 |= EON;//digitalWrite(E, HIGH);
   wait_(10);
   PORTOUT1 &= EOFF;//digitalWrite(E, LOW);
   wait_(100);
}

void dataOled(char d)
{
   PORTOUT1 |= RSON;//digitalWrite(RS, HIGH);
   PORTOUT0 = d;//PORTD = d;
   PORTOUT1 |= EON;//digitalWrite(E, HIGH);
   wait_(10);
   PORTOUT1 &= EOFF;//digitalWrite(E, LOW);
   wait_(100);
}

void disp2()
{
   int i;
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   wait_(5);
   for (i=0;i<6;i++)
   {
      dataOled(text5);
   }
   wait_(250);
   for (i=0;i<14;i++)
   {
      command(0x1C);
      wait_(40);
   }
   command(0x01);  //Display Clear
   wait_(2);
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   command(0xC0);  //Second Line  [Set DDRAM address to Line 2 position 1]
   for (i=0;i<6;i++)
   {
      dataOled(text6);
   }
   wait_(250);
   for (i=0;i<14;i++)
   {
      command(0x1C);
      wait_(40);
   }
   command(0x01);  //Display Clear
   wait_(2);
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   command(0x94);  //Third Line  [Set DDRAM address to Line 3 position 1]
   for (i=0;i<6;i++)
   {
      dataOled(text7);
   }
   wait_(250);
   for (i=0;i<14;i++)
   {
      command(0x1C);
      wait_(40);
   }
   command(0x01);  //Display Clear
   wait_(2);
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
   command(0xD4);  //Fourth Line  [Set DDRAM address to Line 4 position 1]
   for (i=0;i<6;i++)
   {
      dataOled(text8);
   }
   wait_(250);
   for (i=0;i<14;i++)
   {
      command(0x1C);
      wait_(40);
   }
   command(0x01);  //Display Clear
   wait_(2);
   command(0x02);  //Home Command  [Set DDRAM address to Line 1 position 1]
}

void OledSetup()
{
 //  DDRD = 0xFF; //initialized elsewhere
 //  PORTD = 0x00;  //initialized elsewhere
  // pinMode(RS, OUTPUT);//initialized elsewhere
 //  pinMode(RW, OUTPUT);//initialized elsewhere
 //  pinMode(E, OUTPUT);//initialized elsewhere
 //  digitalWrite(RW, LOW); //set to gnd in hw
   PORTOUT1 |= EON;
   command(0x38);  //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 Oledloop()

  disp1();
  wait_(3500);
  command(0x01);  //Display Clear
  disp2();
  wait_(50);
}

  Other than an issue of timing what could I be missing? Any help here would be greatly appreciated!

Paul_B

  • Administrator
  • Sr. Member
  • *****
  • Posts: 248
  • Karma: 16
    • View Profile
Re: NHD-0420DZW 8-bit interface
« Reply #1 on: February 02, 2015, 02:46:16 PM »
Hello,

The example code provided is 100% verified to work. Please double check your wiring and if possible check your control signals with an oscilloscope, see page 11 in the displays datasheet.

http://www.newhavendisplay.com/specs/NHD-0420DZW-AY5.pdf

Can you also please list your full code. e.g. Initialization sequence

Thanks!

« Last Edit: February 02, 2015, 04:03:02 PM by Paul_B »

lasteem1

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
    • View Profile
Re: NHD-0420DZW 8-bit interface
« Reply #2 on: February 02, 2015, 07:03:42 PM »
I figured out my problem. The resistor network on the oled was configured to the 8080 instead of 6800.  :-[    Everything works fine now. Thanks for your help.

Paul_B

  • Administrator
  • Sr. Member
  • *****
  • Posts: 248
  • Karma: 16
    • View Profile
Re: NHD-0420DZW 8-bit interface
« Reply #3 on: February 03, 2015, 07:39:54 AM »
No problem, enjoy your OLED!

 

Questions regarding NHD‐0220DZW‐AY5 & NHD‐0420DZW‐AY5

Started by tseyfarthBoard OLEDs

Replies: 3
Views: 2885
Last post August 20, 2015, 09:51:26 AM
by Saurabh_B
NHD‐0420CW‐AB3 I2C Interface

Started by andersonpdBoard OLEDs

Replies: 1
Views: 2648
Last post January 23, 2015, 10:00:06 AM
by Michael_L
NHD‐3.12‐25664UMB3 3 or 4 wire interface

Started by cliffgBoard OLEDs

Replies: 1
Views: 2495
Last post February 13, 2015, 04:43:21 PM
by Michael_L
NHD‐0420DZW‐AB5 Lines

Started by RickJBoard OLEDs

Replies: 1
Views: 2289
Last post January 09, 2015, 04:18:32 PM
by Michael_L
NHD-0420DZW-AG5 - Display "sometimes" shows only 2 lines

Started by stylonurusBoard OLEDs

Replies: 5
Views: 5599
Last post June 18, 2014, 10:09:49 AM
by Michael_L