LCD is on but no words are displayed. This is the code I am using:
// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
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!");
delay(1000);
}
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);
}
In principle, this loop executes tens to hundreds of thousands of times every second.
How fast do you think the LCD can print? Put in a delay(500) so you don't overwhelm the display.
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);
}
Your photo angle isn't very helpful. There should be twelve wires connected to your LCD module but it looks like there are only ten in your photo.
The constructor lists six of them ( rs en d4 d5 d6 d7). There's also two to power the LCD, two to power the backlight, the contrast pin, and the r/w pin (which should be connected to ground).
Actually, writing to an LCD using LiquidCrystal isn't as fast as you might think.
LiquidCrystal using a recent IDE can push an instruction to the LCD in about 284us.
It takes one instruction to set the cursor position, and/or 1 instruction to print 1 character.
Assuming that loop is printing a 2 digit number, then 3 instructions will need to be pushed to the LCD. [ setcursor(), write(), write() ]
That is roughly 850us just for the LCD instruction overhead.
In a tight loop assuming all other overhead was zero, then maximum times per second the loop could spin around is around is roughly 1176 times / second.
While still fast relative to a human it isn't anywhere near
tens to hundreds of thousands of times every second.
Also, rapidly writing to an LCD won't overwhelm it.
Worst case if the characters being written are rapidly changing, it can cause the display to look strange as if it is dim or flickering.
But in this case, the characters being written are only changing once per second.
So while the display may be being updated 1000 times/second.
It will not cause any flickering.
Could the code be written to push the characters to the display less often?
Yes, but in this case, given the numbers/characters pushing the characters rapidly will
cause no harm or visible issues.
Maybe our definitions of "LCD being overwhelmed" is different?
My definition of overwhelmed is that the LCD can't keep up so instructions/data/characters are lost.
As long as the host does not violate the hd44780 interface timing, which includes both low level h/w signal timing and instruction timing, it can send instructions as fast as the timing allows and the LCD will keep up processing the instructions.
But like I said before, depending on what you writing to the display it my not look very good if the characters are rapidly changing.
The LiquidCrystal library given its design and usage of the Arduino core digital i/o library functions to control the LCD signals and its instruction timing, it will not be able to push the hd44780 interface anywhere near its maximum.
In the case of this LCD issue,
I see the LCD has a top row of blocks. Which means it has not yet been initialized by the host.
I also see what looks likes a few wiring issues.
I don't see a wire for the cathode on the backlight
And it looks like a few of the LCD signal connections may be incorrectly connected.
Another thing we can't see is if the LCD has a soldered header or if the wires
are just pushed through the LCD solder holes.