LCD_NHD-0216CW-AB3 - Display not getting ON

Comments

4 comments

  • Engineering Support
    Community moderator

    Hi,

    Please refer to the wiring diagram provided on the display’s specification to confirm the connections on your end. Additionally, we have provided the sample code for the Arduino Mega on our website for your reference.

    Could you please confirm the interface you are using and the supply voltage and current you are providing to the display?

    0
  • Shaik Mohammed Moinuddin

    Hi, the wiring is done as per the datasheet

    0
  • Shaik Mohammed Moinuddin

    Hi, is there any indication or way to know whether this display is working through hardware (There is not even a flickering activity on the display), as the display is not responding to any commands, and also can you provide us a sample code for the same (apart from the arduino codes any other code). 

    0
  • Shaik Mohammed Moinuddin

    This the code which we have written based on your arduino code, but not sure about it...

     

     

    #include "main.h"


    unsigned char text1[] = {"New haven Display----"};
    unsigned char text2[] = {"Slim OLED Display---"};
    unsigned char text3[] = {"16/20 Characters----"};
    unsigned char text4[] = {"!@#$%^&*()_+{}[]<>?~"};




    void setup(void)
    {
       SCL   = 1;
       SDOUT = 1;
       Delay_ms(10);

       arduino_command(0x2A);  //function set (extended command set)

       Delay_ms(30);

       arduino_command(0x71);  //function selection A, disable internal Vdd regulator

       Delay_ms(30);

       arduino_data(0x00);

       Delay_ms(30);

       arduino_command(0x28);  //function set (fundamental command set)

       Delay_ms(30);

       arduino_command(0x08);  //display off, cursor off, blink off

       Delay_ms(30);

       arduino_command(0x2A);  //function set (extended command set)

       Delay_ms(30);

       arduino_command(0x79);  //OLED command set enabled

       Delay_ms(30);

       arduino_command(0xD5);  //set display clock divide ratio/oscillator frequency

       Delay_ms(30);

       arduino_command(0x70);  //set display clock divide ratio/oscillator frequency

       Delay_ms(30);

       arduino_command(0x78);  //OLED command set disabled

       Delay_ms(30);

       arduino_command(0x09);  //extended function set (4-lines)

       Delay_ms(30);

       arduino_command(0x06);  //COM SEG direction

       Delay_ms(30);

       arduino_command(0x72);  //function selection B

       Delay_ms(30);

       arduino_data(0x00);     //ROM CGRAM selection

       Delay_ms(30);

       arduino_command(0x2A);  //function set (extended command set)

       Delay_ms(30);

       arduino_command(0x79);  //OLED command set enabled

       Delay_ms(30);

       arduino_command(0xDA);  //set SEG pins hardware configuration

       Delay_ms(30);

       arduino_command(0x10);  //set SEG pins

       Delay_ms(30);

       arduino_command(0xDC);  //function selection C

       Delay_ms(30);

       arduino_command(0x00);  //function selection C

       Delay_ms(30);

       arduino_command(0x81);  //set contrast control

       Delay_ms(30);

       arduino_command(0x7F);  //set contrast control

       Delay_ms(30);

       arduino_command(0xD9);  //set phase length

       Delay_ms(30);

       arduino_command(0xF1);  //set phase length

       Delay_ms(30);

       arduino_command(0xDB);  //set VCOMH deselect level

       Delay_ms(30);

       arduino_command(0x40);  //set VCOMH deselect level

       Delay_ms(30);

       arduino_command(0x78);  //OLED command set disabled

       Delay_ms(30);

       arduino_command(0x28);  //function set (fundamental command set)

       Delay_ms(30);

       arduino_command(0x01);  //clear display

       Delay_ms(30);

       arduino_command(0x80);  //set DDRAM address to 0x00

       Delay_ms(30);

       arduino_command(0x0C);  //display ON

       Delay_ms(100);

    //   arduino_command(0x38);//function set
    //   Delay_ms(30);
    //   arduino_command(0x06);//entry mode set
    //   Delay_ms(30);
    //   arduino_command(0x02);//return home
    //   Delay_ms(30);
    //   arduino_command(0x01);//clear display
    //   Delay_ms(30);
    //   arduino_command(0x0c);//display on
    //   Delay_ms(30);
    //   arduino_command(0x80);//line 1 character 1
    //   Delay_ms(30);
    }

    void arduino_command(uint8_t c) //SCL //SDOUT
    {
        uint8_t temp = 0xF8, i;
        {
            SCL = 0;
            if((temp & 0x80) >> 7 == 1)
            {
                SDOUT = 1;
            }
            else
            {
                SDOUT = 0;
            }
            temp = temp << 1;
            SCL = 1;
        }

        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            if((c & 0x01)==1)
            {
              SDOUT = 1;
            }
            else
            {
                SDOUT = 0;
            }
            c = c >> 1;
            SCL = 1;
        }
        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            SDOUT = 0;
            SCL = 1;

        }
        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            if((c & 0x01) == 1)
            {
                SDOUT = 1;
            }
            else
            {
                SDOUT = 0;
            }
            c = c >> 1;
            SCL = 1;
        }
        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            SDOUT = 0;
            SCL = 1;
        }
    }


    void arduino_data(uint8_t d)
    {
        uint8_t temp = 0xF8, i;
        temp = 0xFA;
        for(i = 0; i < 8; i++)
        {
            SCL = 0;
            if((temp & 0x80) >> 7 == 1)
            {
                SDOUT = 1;
            }
            else
            {
                SDOUT = 0;
            }
            temp = temp << 1;
            SCL = 1;
        }

        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            if((d & 0x01) == 1)
            {
                SDOUT = 1;
            }
            else
            {
                SDOUT = 0;
            }
            d = d >> 1;
            SCL = 1;
        }

        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            SDOUT = 0;
            SCL = 1;
        }

        for(i = 0; i < 4; i++)
        {
            SCL = 0;
            if((d & 0x01) == 1)
            {
                SDOUT = 1;
            }
            else
            {
                SDOUT = 0;
            }
            d = d >> 1;
            SCL = 1;
        }

        for(i=0; i < 4; i++)
        {
            SCL = 0;
            SDOUT = 0;
            SCL = 1;
        }
        Delay_ms(10);
    }


    void arduino_output()
    {
        int i;

        arduino_command(0x01);

        Delay_ms(2);

        for(i = 0; i < 20; i++)
        {
            arduino_data(text1[i]);
        }

        arduino_command(0xA0);

        for(i = 0; i < 20; i++)
        {
            arduino_data(text2[i]);
        }

        arduino_command(0xC0);

        for(i = 0; i < 20; i++)
        {
            arduino_data(text3[i]);
        }

        arduino_command(0xE0);

        for(i = 0; i < 20; i++)
        {
            arduino_data(text4[i]);
        }
    }

    void main(void)
    {
         PCA0MD    = 0x00;
         OSCICN    = 0x83;
         P0MDOUT   = 0x0D;
         XBR1      = 0x40;
         setup();
         while(1)
         {
             arduino_output();
           while(1);
         }
    }

    0

Please sign in to leave a comment.