NHD-0220FZ-FSW-GBW-P-33V3

Comments

14 comments

  • Alee_S

    Hi timbro,

    As far as connecting DB0-DB3, you can connect them to ground or leave them disconnected, as either option should work for 4-bit parallel interface.

    Please see the sample code provided below as a reference, which I have tested and verified to work. The code provided is written for an Arduino Uno. 

    /******** INITIAL DEFINITIONS***************/

    #define E_Pin 10
    #define R_W    9
    #define R_S    8

    /************************ CHAR STRING**********/

    char const text1[] = ("NEWHAVEN DISPLAY");
    char const text2[] = ("2x20 LCD DISPLAY");

    /************ Functions************/
    void latch(){                           // command to latch E
      digitalWrite(E_Pin, HIGH);            // Latch
      delay(1);
      digitalWrite(E_Pin, LOW);
      delay(20);
    }
    void command(char i){
      PORTD = i;
      digitalWrite(R_S, LOW);               // Command
      digitalWrite(R_W, LOW);               // Write
      latch();                              // take upper 4 bits
      i = i<<4;                             // shift 4 bits
      PORTD = i;                            // Take lower 4 bits
      latch();
    }
    void data(char i){
      PORTD = i;
      digitalWrite(R_S, HIGH);              // Data
      digitalWrite(R_W, LOW);               // Write
      latch();                              // take upper 4 bits
      i = i<<4;                             // shift 4 bits
      PORTD = i;                            // Take lower 4 bits
      latch();
    }

    /***********INITIALIZE DISPLAY************************/

    void init1(){
    digitalWrite(E_Pin, LOW);                                                     
     delay(100);                            //Wait >15 msec after power is applied
     PORTD=0x30  ;                         // Put 30 on port D           
     delay(30);                             //must wait 5ms, busy flag not available
     latch();                              //command 0x30 = Wake up
     delay(10);                             //must wait 160us, busy flag not available
     latch();                              //command 0x30 = Wake up #2
     delay(10);                             //must wait 160us, busy flag not available
     latch();                              //command 0x30 = Wake up #3
     delay(10);                             //can check busy flag now instead of delay 
     PORTD = 0x20;                          //put 0x20 on the output port (NEEDED TO SET 4-bit INTERFACE)         
     latch();     
     command(0x28);                         //Function set: 4-bit/2-line 
     command(0x28);                       
     command(0x0F);                         //Display ON; Blinking cursor
     command(0x06);                         //Entry Mode sets
    }


    void clear_screen(){                    // clear display
     command(0x01);
    }
    void ret_home(){                        // Return to home position
     command(0x02);
    }
    void disp(){                            // DISPLAY TEXT
      clear_screen();
      ret_home();                                 // Brings back to First Line
      for( int i = 0; i<16; i++){
        data(text1[i]);
      }
      command(0xC0);                              // Second Line
      for (int i = 0; i<16; i++){
        data(text2[i]);
      }
      ret_home();
    }

    void setup() {
     
      DDRD = 0xFF; // First 8 pins of PORT D as output
      DDRB = 0x07; // Port B first 3 pins as output
      init1();
      disp();
    }

    void loop() {
     
      delay(1000);
      while(1);
     
    }

    If the issue persists, can you provide/upload the following:
    -Image of your hardware connections?
    -Measured voltages across Pin 3 (contrast pin) at both limits of the POT? 
    -The P/N of the other displays you can drive with your code?

    0
  • timbro
    Hi Alee_S,
    I have a couple of other brands of 5Vdc 1602 LCD displays laying around which we have tested our code on and we are able to make these work ok but we are not able to find the same success with the Newhaven display.
    We do not do too many PIC projects so initially we thought it may have been something lacking in our understanding using these devices however, we rebuilt the project using an STM8 device and again, we have only had success with other displays - not the Newhaven display.
    I do have 10 of them and have tried two different ones just in the off chance that one was faulty.
    Have you configured your delay function for a specific time period? ...and if so what is that period?
    0
  • Alee_S

    The delay function is set for 1 ms. So a delay(1000) = 1000 ms, or 1 second.

    Did you have a chance to review the code provided vs the code used for other displays for their similarities/differences?

    Once again, may you please upload images of your hardware connections, along with your measured contrast voltage across both limits of the POT? This would help me get closer to determining where the root issue lies.

    Also, if you can provide P/N of some of the other displays you have successfully powered on, I can review their specs to see if there are software/hardware differences between our display and the other displays you have been using.

    0
  • timbro

    Hi Alee_S
    I found a post on this forum related to a display with the same driver that is 4 x 20 and he was saying that he could only get his display to work in 1-line mode. I decided that I would try changing it to 1-line mode and see if it would work and it certainly did.
    So my problem has now advanced to trying to make the display work with both lines. The guy did work out a solution however it is not explained very clearly and I have not been able to work out what the solution actually was. The link to the post is below.

    https://support.newhavendisplay.com/hc/en-us/community/posts/9453196312343-NHD-0420H1Z-FL-GBW-33V3-2-Lines-Mode-Problem

    It would be very helpful if you could decipher this guys final comments and let me know what it actually means.

    Kind regards,

    0
  • Alee_S

    Hi timbro,

    For more information on 'Internal Reset Circuit', please see the link below, Pg. 22 of the ST7066U controller datasheet. Please note those instructions are executed in the initialization section of the code I have provided.

    https://newhavendisplay.com/content/app_notes/ST7066U.pdf

    The LCD working in 1-line mode is a good sign! It seems that under 2-line mode, the LCD is not receiving enough contrast to show the text properly. Try adjusting the contrast voltage on Pin 3, and hopefully that will do the trick.

     

    0
  • timbro

    Hi Alee_S,

    There is no problem with contrast. it can be changed from 0.004 <-> 3.294 Vdc. It is a 10 turn pot and I have tried it across the full range.
    By default the display is in 1-line mode. It has become pretty clear to us that it is not accepting 2-line configuration. Still have no idea why.
    I have another question about your code... what does your PORTD consist of?
    We are using 2 pins on the same port that we also use for DB4<->DB7, so we are setting these, (DB4<->DB7), bitwise - however, there is something quite strange - you apply 0x28 for 2-line mode (0010 1000)  - you don't send each nibble separately, so it would be very helpful to me if you could tell me exactly what you have connected to PORTB - bits 0 through 7, what are they connected to?

    Kind regards   

    0
  • Alee_S

    Hi again,

    PORTD consists of my data lines(DB4-DB7 for 4-bit mode), while PORTB consists of my control lines(Enable, R/W, and R/S). 

    You mentioned you have been using 2 additional pins on the same port as DB4-DB7. I would recommend separating your control lines and data lines and keeping them on separate Ports.

    0
  • timbro

    Hi Alee_S,
    I am using separate ports for control and data now - nothing has changed.

    0
  • timbro

    Hi Alee_S,
    By pushing sharply on the display while in 2-line mode, I can make out the correct characters on the first and second line.
    When in 1-line mode, the contrast to view the characters is best set at practically 0 volts. Anything over a few millivolts and the characters fade out to nothing.
    Very surprising....
    When in 2-line mode, anywhere between 0V and 3.3V - display shows nothing but if i squeeze the display rapidly, i can see my text written correctly.
    Someone come up with a explanation for that please.
    Seems like using these displays are Newhavens best kept secret.
    Happy to discuss this really crappy display.

    0
  • Alee_S

    Hello timbro,

    I'm sorry that you are experiencing these issues with our display for a long duration of time 

    I have tried to replicate your problem at the lab, but to no avail. I verified the display works in 1-line and 2-line mode, and tried pressing on all sides of the display in both modes to see if there was any contrast change, but that did not make a difference in the display appearance.
    If you would like a video reference, please let me know and I can send an e-mail with a video attachment. Unfortunately, the file size would be too big to attach in this post.

    I have verified the contrast voltage range to be from 0.0 V - 1.2V, where 0V showed some visible blocks and intended characters/string, and 1.2V was the max voltage where characters would appear on the screen. Any voltage past 1.2V would be too high for any text to be shown on the display.
    Please note the adjustment of the potentiometer is not linearly connected with the contrast; if using a 10k pot, setting the knob for a 5k resistance will not necessarily equate to half the supply voltage appear on the contrast.


    You mentioned in your earlier e-mails you had a total of 10 of our displays, and I am assuming you are experiencing the same exact issue with all of them, is that correct? If so, can you provide the date codes of all those 10 displays? The date code can be found on the sticky label, located on the back of the display. Please see image below as a reference

    Also, I mentioned in my previous posts to provide an image(s) of your connections to the display, but you have not provided them so far. It is extremely imperative to see how these connections are being made, so we can eliminate a faulty hardware connection being the crux of the problem. Please provide these images, as well as a schematic with your connections, if you have made one.

    Having this information may get us closer to solving your issue!

    0
  • timbro

    Dear Alee_S,
    Your message landed on the first day of my travel and I am due back in the office on Wednesday.
    We are using a ST Discovery board with the display and the diagram I have sent previously. I have attached the datasheet of the discovery board so you can reference the diagram that I will send again now. We have tried various things which have made no difference at all. The last thing we tries was to supply Vdd to both pins - as this latest diagram shows.

    As in my original post, we can use another brand of display and have both lines working in 4-bit data mode perfectly.

    Can you be more specific in terms of what you want me to take images of? I have attached a photo anyway bit I am not sure if it is going to be useful to you.



    Kind regards,
    Tim

    0
  • Alee_S

    Hi timbro,

    Thank you for providing images of your hardware connections + schematics. The images you have provided are sufficient.

    As in my original post, we can use another brand of display and have both lines working in 4-bit data mode perfectly.

    Can you provide those displays P/Ns? We can review those displays datasheets and see where any differences may lie, which may possibly help us locate the issue.
    Can you also try and disconnect the backlight anode and cathode pins, and see if there is any differences in the displays appearance?

    0
  • timbro

    Hi Alee_S,
    The other displays are a generic  2 x 16's that use the Hitachi display controller (HD44780U).
    Keep in mind that these are quite different in set up - not like it is a case of unplugging these and plugging in yours.



    Kind regards, T

    0
  • Alee_S

    This topic was further supported via e-mail.

    0

Please sign in to leave a comment.