OLED Initialization - NHD-0420DZW-AB5

Comments

5 comments

  • signalflow

    Can the enable signal go HIGH before the data is put onto the 8 data pins and then bring ENABLE signal LOW?

    I am setting EN=1 and RS and R/W to their appropriate value, then putting data on the 8 pins, then bringing Enable low to latch it.  Something is not working right though.

    0
  • Paul_B

    Hi Signalflow,

    I’m sorry to hear about the trouble you are having with NHD-0420DZW-AB5. Let me help you out with your initialization sequence  

    Please try the following:

    On power up, the display is initilaized as:

    1. Display clear

    2. Function set:
    DL="1": 8-bit interface data
    N="0": 1-line display
    F="0": 5 x 8 dot character font

    3. Power turn off
    PWR=”0”

    4. Display on/off control: D="0": Display off C="0": Cursor off B="0": Blinking off

    5. Entry mode set
    I/D="1": Increment by 1
    S="0": No shift

    6. Cursor/Display shift/Mode / Pwr
    S/C=”0”, R/L=”1”: Shifts cursor position to the right
    G/C=”0”: Character mode
    Pwr=”1”: Internal DCDC power on

    // 4-Bit initialization sequence
      write4bits(0x03); // Put back into 8-bit mode
      delayMicroseconds(5000);
      if(_oled_ver == OLED_V2) { 
        write4bits(0x08);
        delayMicroseconds(5000);
      }
      write4bits(0x02); // Put into 4-bit mode
      delayMicroseconds(5000);
      write4bits(0x02);
      delayMicroseconds(5000);
      write4bits(0x08);
      delayMicroseconds(5000);
     
      command(0x08); // Turn Off
      delayMicroseconds(5000);
      command(0x01); // Clear Display
      delayMicroseconds(5000);
      command(0x06); // Set Entry Mode
      delayMicroseconds(5000);
      command(0x02); // Home Cursor
      delayMicroseconds(5000);
      command(0x0C); // Turn On - enable cursor & blink
      delayMicroseconds(5000);
    0
  • signalflow

    OK, I seem to have gotten it to initialize properly.

    The problem I am having still is that I can write strings such as
    LCD_write_string("Test") but if I put spaces in like
    "LCD_write_string("Test String") then it gives me erroneous character for the space.  Also the display (characters) are dimming.  The brightness is oscillating or cycling from the top of each character to the bottom over and over.  Is it supposed to do that or maybe it isn't initialized properly?

    0
  • signalflow

    Nevermind, seems I had a bad connection on Vcc (was low voltage).  Once I gave it a good connection the display quit flickering and the erroneous characters went away for spaces.

    0
  • Paul_B

    Glad to hear you got your display up and running!

    0

Please sign in to leave a comment.