HD44780 LCD display

Discussion in 'Computing and Networks' started by pujulde, Feb 18, 2014.

  1. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    I bought an HD44780 1602 LCD display and it does not work, how to check, can anybody help?
     
  2. MrChips

    Moderator

    Oct 2, 2009
    12,431
    3,360
    "It does not work" can mean a dozen different things. You really need to elaborate.

    1) What processor are you using?
    2) Show your code.
    3) Show your circuit diagram.
    4) How are you applying power to the system?
    5) Do you have a 0.1μF cap across Vcc and GND?
    6) How is the contrast pin connected?
    7) Are you using 4-bit mode or 8-bit mode?
    8) Do you have appropriate delays or tests for busy?
    9) Do you have black boxes on the LCD?
     
  3. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,515
    2,369
    One way to check it is to hard wire it with a few SPST or DIP switches.
    The set up for this is in an LCD tutorial by Julyan Ilett originally published by a UK Electronics magazine, I believe it is still out there on the web if you Google his name.
    Max.
     
  4. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    I have no experience of working with LCD displays, so it would be my first project. I found the code given below in the net, so tried to use it, but it failed. I use an Arduino Uno board, which used ATmega328
    <b>setup</b></span>()
    {
    h a blank screen</span>
      lcd.setCursor(0,0);           <span style="color: #666666;">// set cursor to column 0, row 0 (the first row)</span>
      lcd.<span style="color: #006699;">print</span>(<span style="color: #7D4793;">"Hello, World"</span>); <span style="color: #666666;">// change this text to whatever you like. keep it clean.</span>
      lcd.setCursor(0,1);           <span style="color: #666666;">// set cursor to column 0, row 1</span>
      lcd.<span style="color: #006699;">print</span>(<span style="color: #7D4793;">"hacktronics.com"</span>);
      
      <span style="color: #666666;">// if you have a 4 row LCD, uncomment these lines to write to the bottom rows</span>
      <span style="color: #666666;">// and change the lcd.begin() statement above.</span>
      <span style="color: #666666;">//lcd.setCursor(0,2); // set cursor to column 0, row 2</span>
      <span style="color: #666666;">//lcd.print("Row 3");</span>
      <span style="color: #666666;">//lcd.setCursor(0,3); // set cursor to column 0, row 3</span>
      <span style="color: #666666;">//lcd.print("Row 4");</span>
    }

    <span style="color: #33997E;">void</span> <span style="color: #006699;">loop</span>()
    {
    }

    </pre></body></html>
     
  5. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Most forums don't let you post HTML. Try posting your code pasted between code tags ( [CODE ] and [/CODE ] - minus the spaces).
     
    pujulde likes this.
  6. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    As regards contrast pin, I connected it via 10k. Used 4 bit mode. Having soldered I was checking wiring by tester, when black boxes appeared once, but that boxes did not appear again.

    #include <LiquidCrystal.h>

    // Connections:
    // rs (LCD pin 4) to Arduino pin 12
    // rw (LCD pin 5) to Arduino pin 11
    // enable (LCD pin 6) to Arduino pin 10
    // LCD pin 15 to Arduino pin 13
    // LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
    LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);

    int backLight = 13; // pin 13 will control the backlight

    void setup()
    {
    pinMode(backLight, OUTPUT);
    digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
    lcd.begin(16,2); // columns, rows. use 16,2 for a 16x2 LCD, etc.
    lcd.clear(); // start with a blank screen
    lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
    lcd.print("Hello, World"); // change this text to whatever you like. keep it clean.
    lcd.setCursor(0,1); // set cursor to column 0, row 1
    lcd.print("hacktronics.com");

    // if you have a 4 row LCD, uncomment these lines to write to the bottom rows
    // and change the lcd.begin() statement above.
    //lcd.setCursor(0,2); // set cursor to column 0, row 2
    //lcd.print("Row 3");
    //lcd.setCursor(0,3); // set cursor to column 0, row 3
    //lcd.print("Row 4");
    }

    void loop()
    {
    }
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,431
    3,360
  8. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    Yes, I followed that website
     
  9. MrChips

    Moderator

    Oct 2, 2009
    12,431
    3,360
    Connect a 1kΩ resistor from pin-3 (contrast) to pin-1 (Vss).
     
  10. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    Thanks , I will try
     
  11. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    But what about pin 15 of LCD which was connected to the pin 13 of Arduino, leave it connected again?
     
  12. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    When I connect it back light was not turned on.
     
  13. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    The backlight does not need to be connected to the mcu. Just connect it to you supply through an appropriate current limiting resistor for now.


    As far as the rest of the problem. Go into debug mode and verify with a scope, logic analyzer, logic probe or DMM that you have everything wired to the LCD correctly. That when you output a databit or control on the mcu, the correct pin is canging at the LCD.
     
  14. pujulde

    Thread Starter Member

    Jul 24, 2013
    95
    1
    I connect as you said and it works, thanks a lot, but could I adjust the contrast using variable resistor?
     
  15. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Yes you can do that. Use a 10K variable resistor. Connect one end to power and the other end to ground(GND). Then connect the wiper to the contrast input pin
     
    pujulde likes this.
  16. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    Often times you need up to a second delay before doing anything with the LCD after powerup.
    It might be a good idea to get into the habit of waiting a second in your code after the pin assignments before sending any data.
     
  17. MrChips

    Moderator

    Oct 2, 2009
    12,431
    3,360
    I have never experienced this behavior.
     
  18. Art

    Distinguished Member

    Sep 10, 2007
    785
    61
    It says wait at least half a second in my programming manual,
    but yes, it can happen even at 20MHz, and if you have spoken to your LCD before it was ready it never responds again for the duration.

     
  19. MaxHeadRoom

    Expert

    Jul 18, 2013
    10,515
    2,369
    Here is a couple of PDF's one is the Hitachi HD44780 sheet for the IC and the one showing wait states.
    Max.
     
    spark8217 likes this.
  20. takao21203

    Distinguished Member

    Apr 28, 2012
    3,577
    463
    You can power it through the microcontroller (digital IO)

    The controller normally has a startup timer, and yes you should use that or program a small delay at startup.

    Mot power supplies only take 50 milliseconds or so.
     
Loading...