HD44780 LCD display

MrChips

Joined Oct 2, 2009
30,706
"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?
 

MaxHeadRoom

Joined Jul 18, 2013
28,617
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.
 

Thread Starter

pujulde

Joined Jul 24, 2013
111
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>
 

Thread Starter

pujulde

Joined Jul 24, 2013
111
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()
{
}
 

spinnaker

Joined Oct 29, 2009
7,830
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.
 

t06afre

Joined May 11, 2009
5,934
I connect as you said and it works, thanks a lot, but could I adjust the contrast using variable resistor?
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
 

Art

Joined Sep 10, 2007
806
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.
 

MrChips

Joined Oct 2, 2009
30,706
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.
I have never experienced this behavior.
 

Art

Joined Sep 10, 2007
806
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.

I have never experienced this behavior.
 

takao21203

Joined Apr 28, 2012
3,702
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.
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.
 
Top