LCD Display and Black Squares

Discussion in 'General Electronics Chat' started by hunterage2000, Oct 4, 2012.

  1. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    I have just bought an Alphanumeric 16x2 LCD and I'm trying to run a hello world program with Arduino. I have run the program and all Im getting is 16 Black squares. Can anyone suggest why this is?
     
  2. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,769
    969
    What are you doing for the contrast?
     
  3. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Black squares are typical then the display is not properly configurated. LCDs are quite sensitive to timing during the setup. Are you using the LCD in 4 or 8 bit mode.
    Also have you connected the Power supply terminal for driving liquid crystal display. By varying the voltage on this pin. The screen contrast can be varied. Se the LCD datasheet for more info. The common way is to connect this pin via 10K pot to the supply voltage
     
  4. hunterage2000

    Thread Starter Active Member

    May 2, 2010
    400
    0
    I have left the contrast as it is. Is the black squares there because there is no connection to the contrast pin?

    I have used this code:

    #include <LiquidCrystal.h>

    // initialize the library with the numbers of the interface pins
    LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

    void setup() {
    // set up the LCD's number of columns and rows:
    lcd.begin(16, 2);
    // Print a message to the LCD.
    lcd.print("hello, world!");
    }

    void loop() {
    // set the cursor to column 0, line 1
    // (note: line 1 is the second row, since counting begins with 0):
    lcd.setCursor(0, 1);
    // print the number of seconds since reset:
    lcd.print(millis()/1000);
    }
     
  5. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    Yes I think so Take a look here http://www.kiranjose.com/blog/2011/...6x2-lcd-contrast-using-10k-variable-resistor/
    EDIT: The way it is done in the link by glueing a pot to the LCD is perhaps not a thing I would have done
     
    Last edited: Oct 4, 2012
  6. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    I believe the black squares show up when you have the device properly powered and a good setting on the contrast control. It indicated the device is NOT initialized.

    I'm not an Arduino guy but such function libraries are common. Make sure it's getting your processor speed so it can set it's delays properly.

    I'd check it for you but the LCD display I currently am using ignores the contrast pin (meaning I can leave that nasty pot out of the circuit and sleep well).
     
Loading...