Need help please with NHD-0420D3Z-fl-GBW-V3

Comments

3 comments

  • Guest

    I noticed that in your code you used 0x13 to display a "1".  You are reading the chart in the opposite way: The top or column numbers are the high bits and the side or row numbers are the low bits.  So to display a "1", you would send 0x31 .  Also, here's some sample code that might help you out:-

    #include <REG52.H>
    /*****************************************************/
    int a;
    code char text1[]={"Newhaven Display LCD"};
    //code char text2[]={" NHD-0420D3Z-FL-GBW "};
    //code char text3[]={"4 Lines 20 Character"};
    //code char text4[]={" Serial LCD Display "};
    /*****************************************************/
    sbit SDA = P1^0; //Serial data
    sbit SCL = P3^4; //Serial clock
    sbit SS  = P3^7; //Slave select
    /*****************************************************/
    const char Slave = 0x7E;
    const char Comsend = 0x00;
    const char Datasend = 0x40;
    /*****************************************************/
    void delay(unsigned int n)
    {
    unsigned int i,j;
    for (i=0;i<n;i++)
       for (j=0;j<350;j++)
       {;}
    }
    /*****************************************************/
    void SPI_out(unsigned char j)
    {
    int n;
    unsigned char d;
    d=j;
    SS=0;
    for(n=0;n<8;n++){
    if((d&0x80)==0x80)
    SDA=1;
    else
    SDA=0;
    d=(d<<1);
    SCL = 0;
    SCL = 1;
    }
    SCL = 1;
    SS = 1;
    }
    /*****************************************************/
    void disp(unsigned char *text)
    {
    int n;
    for(n=0;n<20;n++)
    {
    SPI_out(*text);
    text++;
    }
    }
    /*****************************************************/
    int main(void)
    {
    P1 = 0;
    P3 = 0;
    delay(50);

    SPI_out(0xFE);
    SPI_out(0x52); //Set contrast
    SPI_out(0x25); //value

    SPI_out(0xFE);
    SPI_out(0x53); //Set backlight
    SPI_out(0x07); //value

    while(1) 
    {
    SPI_out(0xFE);
    SPI_out(0x51); //clear display
    delay(100);
    SPI_out(0xFE);
    SPI_out(0x46); //cursor home
    SPI_out(0xFE);
    SPI_out(0x70); //display firmware
    delay(500);

    SPI_out(0xFE);
    SPI_out(0x54); //load custom character
    SPI_out(0x00); //custom character 1
    SPI_out(0x08);
    SPI_out(0x08);
    SPI_out(0x08);
    SPI_out(0x08);
    SPI_out(0x08);
    SPI_out(0x08);
    SPI_out(0x08);
    SPI_out(0x08);

    SPI_out(0xFE);
    SPI_out(0x54); //load custom character
    SPI_out(0x01); //custom character 2
    SPI_out(0x18);
    SPI_out(0x18);
    SPI_out(0x18);
    SPI_out(0x18);
    SPI_out(0x18);
    SPI_out(0x18);
    SPI_out(0x18);
    SPI_out(0x18);

    SPI_out(0xFE);
    SPI_out(0x54); //load custom character
    SPI_out(0x02); //custom character 3
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0xFF);
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0x00);

    SPI_out(0xFE);
    SPI_out(0x54); //load custom character
    SPI_out(0x03); //custom character 4
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0xFF);
    SPI_out(0xFF);
    SPI_out(0x00);
    SPI_out(0x00);
    SPI_out(0x00);

    SPI_out(0xFE);
    SPI_out(0x51); //clear display
    SPI_out(0xFE);
    SPI_out(0x46); //cursor home
    disp(text1);
    SPI_out(0xFE);
    SPI_out(0x45);     //set cursor
    SPI_out(0x40); //line 2
    SPI_out(0x00); //custom character 1 (one vertical line)
    SPI_out(0x01); //custom character 2 (two vertical lines)
    SPI_out(0x02);     //custom character 3 (one horizontal line)
    SPI_out(0x03); //custom character 4 (two horizontal lines)
    delay(500);

    delay(100);
    }
    }

     

    0
  • Dave

    See prior post for issue. Bottom line, my code worked from the start, the problem was that the SCK pin on PIC processor on the display was not soldered!
    Should have gone with my instinct and checked the display first. Getting old sks

    0
  • Atif_K

    Dave, I'm sorry to hear this was a result of an improper solder joint on the display. We have a set quality control process that is followed for every part so I'm not sure how this one got through, but we will make a note to double-check this type of issue during our QC inspections. I apologize for the inconvenience.

    0

Please sign in to leave a comment.