Question about LiquidCrystal v1.3.4 (or later versions) with LCD2004 IIC 4-pin

I have succeeded in getting this display working on a MEGA2560 board by studying other's troubles with this display.

However, I have a question that might be very important.

When one initializes the LiquidCrystal library with a:

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

(Which works)

Doesn't that mean that ports 0, 1, 2, 3, 4, 5, 6 and 7 will not be able to be used by other purposes, even though the LCD2004 IIC doesn't even use any of those ports?

.... Here is my working program and details on how I got it working with that difficult display:

"I succeeded in getting the newest LiquidCrystal v1.3.4 to work with an ATMEGA2560 Board:

Be aware that there are many different versions of the LiquidCrystal Library out there, and many of them have routines which no longer work like init() and other commands which worked under earlier versions.

Unfortunately, they also didn't document just how you use these functions with a MEGA and a LCD2004 IIC at all. This makes it exceedingly difficult to get it to work correctly with this display.

However, it's simpler than it looks.

Hitch VCC, GND and the two wires coming from pins 20 (SDA, or the Serial Data Line) and 21 (SCL, the Serial Clock) from the MEGA2570 board (I'm using a cheap, no-name, Chinese version of the MEGA).

Remove all other folders that are LiquidCrystal folders from the libraries folder and save them someplace safe in case you need to replace them again.

Shut down the Arduino program.

Create a folder in the libraries folder (mine was at C:\Program Files (x86)\Arduino\libraries\ called NewliquidCrystal

Download and unpack the (large) zip file called NewliquidCrystal_1.3.4.zip file somewhere (or, possibly, the most recent version they have created; but be careful)

https://bitbucket.org/fmalpartida/new-liquidcrystal/downloads/

Then, copy ONLY the examples folder (not all will work), I2CIO.cpp, I2CIO.h, keywords.txt, LiquidCrystal_12C.cpp and LiquidCrystal_I2C.h to the newly-created folder in the libraries folder that you just made.

Now, you can run the Arduino program again.

Copy-and-paste this code into your Sketch.

If your display has a PCF8574, use 0x27 for the 12C value, if it is PCF8574AT, use 0x3F (Read it off the IC on the back of your display)

// ===================== Begin Code =====================

#include <LiquidCrystal_I2C.h>
#include <LCD.h>
#include <Wire.h>

// Set the LCD I2C address

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

void setup()
{

lcd.begin(40,4); // initialize the lcd

lcd.display();
lcd.clear(); // Clears the Screen
lcd.home (); // Probably Redundant

// Print a message to the LCD.

//lcd.setCursor(Column minus 1, Row minus 1);

lcd.noBlink(); // Turn off blinking cursor

lcd.setCursor(1,0);
lcd.print("Well, Well, Well...");
lcd.setCursor(6,1);
lcd.print("TheWind777");
lcd.setCursor(6,2);
lcd.print("Succeeded");
lcd.setCursor(4,3);
lcd.print("On 4/15/2017");
lcd.display(); // Turns on the Display

}

void loop()
{
// Turn off the display:
lcd.noDisplay();
delay(1000);

// Turn on the display:
lcd.display();
delay(1000);
}

// ====================== End Code ======================

TheWind777:
I have succeeded in getting this display working on a MEGA2560 board by studying other's troubles with this display.

However, I have a question that might be very important.

When one initializes the LiquidCrystal library with a:

LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

(Which works)

Doesn't that mean that ports 0, 1, 2, 3, 4, 5, 6 and 7 will not be able to be used by other purposes, even though the LCD2004 IIC doesn't even use any of those ports?

Getting terminology correct is critical when dealing with technical matters like s/w programming and h/w wiring.
I assume that you don't mean "ports" but rather arduino pin #s instead.
Even so, the numbers in fm's new LiquidCrystal library LiquidCrystal_I2C object are PCF8574 Px numbers of the output port on the PCF8574 i/o expander chip. (look at a PCF8574 datasheet).
They correspond to bit positions within the 8 bit output port of the PCF8574 i/o expander chip and have absolutely nothing to do with Arduino pin #s.
They tell the library how the PCF8574 is wired up to the hd44780 LCD signals.


If you would like to try another i2c backpack LCD library you could try my hd44780 library package.
It can automatically self configure itself.
It can auto detect the i2c address as well as the PCF8574 pin mappings and backlight control signals.
It can be quickly and easily installed using the IDE library manager directly from the Arduino IDE GUI.
You can read more about it here: https://github.com/duinoWitchery/hd44780

The i/o class for i2c backpacks is hd44780_I2Cexp.
The library includes a diagnostic sketch (I2CexpDiag) to verify that that library is working correctly with the LCD.
It will test the i2c signals and also the internal memory of the LCD.

--- bill

Perfect answer. Now I won't have to worry about not using those pins.

I am an absolute and complete nubie with the Ardunio; so don't have the slightest idea what anything is called, yet. I'm sure that I'll call a thousand things by the wrong name before I know what everything is called.

bperrybap:
Getting terminology correct is critical when dealing with technical matters like s/w programming and h/w wiring.
I assume that you don't mean "ports" but rather arduino pin #s instead.
Even so, the numbers in fm's new LiquidCrystal library LiquidCrystal_I2C object are PCF8574 Px numbers of the output port on the PCF8574 i/o expander chip. (look at a PCF8574 datasheet).
They correspond to bit positions within the 8 bit output port of the PCF8574 i/o expander chip and have absolutely nothing to do with Arduino pin #s.
They tell the library how the PCF8574 is wired up to the hd44780 LCD signals.


If you would like to try another i2c backpack LCD library you could try my hd44780 library package.
It can automatically self configure itself.
It can auto detect the i2c address as well as the PCF8574 pin mappings and backlight control signals.
It can be quickly and easily installed using the IDE library manager directly from the Arduino IDE GUI.
You can read more about it here: https://github.com/duinoWitchery/hd44780

The i/o class for i2c backpacks is hd44780_I2Cexp.
The library includes a diagnostic sketch (I2CexpDiag) to verify that that library is working correctly with the LCD.
It will test the i2c signals and also the internal memory of the LCD.

--- bill

Impressive.

I will definitely check it out, if I can figure out just how to use it, that is.

The best thing I have figured-out so far is, when I sent to the display using the println function, it showed two strange characters. I imagine that it is how the display handles the carriage return and line feed that is associated with the CTRL characters the function sends. Not much... but I thought it was interesting.

But, then-again, I only got my Arduino two days ago. Today I got it to display the distance to objects accurate to centimeters. There's a limit to what a person can learn in two days...

TheWind777:
I will definitely check it out, if I can figure out just how to use it, that is.

See the github page for additional information about the API functions and how to install it.
That page shows all the supported API functions which are the API functions from LiquidCrystal and LCD API 1.0
It also comes with several examples for each supported i/o class so you can see how to use it.
All the API functions you are currently will work with hd44780.
The only difference will be the includes that you use and constructor where you declare the LCD object.

The best thing I have figured-out so far is, when I sent to the display using the println function, it showed two strange characters. I imagine that it is how the display handles the carriage return and line feed that is associated with the CTRL characters the function sends. Not much... but I thought it was interesting.

Neither the LCD nor the library supports line ending characters so when you send or characters they get interpreted as the character codes for custom characters. Since you haven't defined any custom characters, the LCD ends up displaying garbage characters since the custom character memory has not been programmed with any custom character data.
If you were to use my library, it would error off the sketch telling you that println() is not supported.

--- bill

I'm confused.

I thought that the LCD2004 was a serial display?

Any lcd.### command works fine with it; but I can never get Serial.### commands (such as Serial.println( to do anything, it seems (and when you run the I2Cexpdiag sketch it does nothing wherever there is a Serial.println( command.

Also, in your I2Cexpdiag documentation, it says, "It is recommended to run the sketch with a serial monitor to be able to see the diagnostic messages, in case there are any issues."

Am I wrong in assuming this display can be used with the Serial.println( function or any Serial. command?

===

Also, in getting things set-up to properly run your I2Cexpdiag sketch, I got a couple errors.

First was one where it said that in LCD.h the "error: 'void LCD::command(uint8_t)' is private

I had to modify the LCD.h file and drop the private: tag below that function.

Then, when I ran it, it said it was protected; so I had to remove the word 'protected:' completely.

I would assume that your class uses the uin8_t function, directly, from the LCD.h file and, therefore, has to use it.

===

It seemed to run well, except without any of the Serial.println( comments working.

It ran a blindingly-fast printout of the whole character set, then prints:

LCD:0 NoPullups
0x3F,P01245673H

Then it delays a long time.

Then it blinked-to-black three times and put:

LCD:0 (0x3F) *P
00:01:19 (and counting upwards)

===

Does the P01245673H imply some internal pin assignment that needs to be modified in your other sketches in order to get them to work properly?

Because, finally, when I run any of your other examples, they do nothing to the display at all. The display just sits there.

For example, when running LCDlibTest...

I changed LCD_COLs and LCD_ROWS, but nothing else:

#ifndef LCD_COLS
#define LCD_COLS 20
#endif

#ifndef LCD_ROWS
#define LCD_ROWS 4
#endif

Then I upload the sketch...

The current display just freezes instead of counting seconds upwards (it was previously running your I2Cexpdiag sketch), no LED blinks, no other thing happening.

The "No LED Blinks" is strange; because you say, "// begin() failed so blink the onboard LED if possible
fatalError(1); // this never returns

So, there was no fatalError(

Yet nothing displays.

Does that mean that I need to change some pin definition when I do the:

const int rs=8, en=9, d4=4, d5=5, d6=6, d7=7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

From the "P01245673H"

Does that mean I have to change those values in some manner?

Is that what the P01245673H is indicating in some way? I take it that the 4567 must be equivalent to the d4=4, d5=5, d6=6, d7=7, somehow.

I assume that P means 'Pin', maybe; but don't have a clue what the 012 or the 3H would stand for.

Also, there are two LCD.h files. One, which was there in the root of the installed library in an LCD folder, I removed and put somewhere else; because there is also an LCD.h file in the LiquidCrystal library (I also removed the LiquidCrystal library that was in the install and replaced it with the NewLiquidCrystal folder) so there would be no contention.

I take it that is what I was supposed to do?

I'm using the newest LiquidCrystal version that GitHub has... but the Arduino install was an older one because the page I chose to instruct me in the installation of Arduino chose that version. It was ARDUINO 1.8.2 2017.03.22

Also, the reminder that I am using a MEGA2560 board and that the LCD2004 IIC unit says YwRobot Arduino LCM1602 IIC v1 on the little serial board with the contrast adjustment potentiometer on it. The board, itself, says 2004A on it.

The chip has AT at the end of it and it definitely uses 0x3F.

Lots of questions here and some confusion over libraries, h/w, and how things work.
First, Arduino uses C++ and nearly all the arduino "libraries" use C++ with class specific objects.
Most libraries require that the sketch declare the specific object but some automatically declare their own.
In the case of the HardwareSerial library (which comes bundled in the Arduino core library) the library declares the object for you. That is where the object name Serial comes from. So when you use the object Serial i.e. Serial.begin(), Serial.print() etc... you are using the predeclared Serial object which is going to use the HardwareSerial library which is going to talk to the UART h/w built into the Arduino processor which uses asynchronous serial.

For these LCD libraries you must declare your own object in your sketch.
While the name of that object could be anything, typically the object name is lcd.

Your device/LCD module, (You haven't provided any information on it), appears to be a LCD device using an I2C backpack that uses a PCF8574 i/o expander.
That is what the LiquidCrystal_I2C libraries expect to be talking to and that is what the hd44780_I2Cexp i/o class in the hd44780 library expects to talk to.

In terms of your LCD being "serial". Not really. Typically when the term "serial" device is used, it means asynchronous serial. This would be the type of serial interface that is used by the internal UART.
While i2c is a form of serial communication, it is not asynchronous serial and so it is typically not called "serial".
Yes you may see many ebay adds that call it a "serial" interface, but really it should be called I2C as calling it "serial" is misleading since "serial" usually means asynchronous serial.

Also, in your I2Cexpdiag documentation, it says, "It is recommended to run the sketch with a serial monitor to be able to see the diagnostic messages, in case there are any issues."

Yes you should start the serial monitor in the IDE at the specified baud rate so you can see the messages from I2CexpDiag.

Am I wrong in assuming this display can be used with the Serial.println( function or any Serial. command?

Yes

Also, in getting things set-up to properly run your I2Cexpdiag sketch, I got a couple errors.

First was one where it said that in LCD.h the "error: 'void LCD::command(uint8_t)' is private

I had to modify the LCD.h file and drop the private: tag below that function.

You have done something really odd/wrong.
The hd44780 library package is a standalone library. It does not use the LCD.h header file. That header part of fm's new LiquidCrystal library.
I2CexpDiag should "just work" out of the box. No modifications should be necessary.
While you can modify the geometry to match your display, you do not need to modify the geometry to run the included examples, including I2CexpDiag.

It seemed to run well, except without any of the Serial.println( comments working.

Not sure what you mean by "comments working".
Serial.println() are not comments they are code.
If you mean you are not see the messages, that means that you have not brought up the serial monitor or are using the incorrect baud rate.

It ran a blindingly-fast printout of the whole character set, then prints:

It isn't the whole character set. It is testing the internal memory of the LCD.
If you had the serial monitor up and running, it should have a message about it.

LCD:0 NoPullups

The "NoPullups" means that your i2c bus is missing the required pullups.
While it may appear to work like this, it can have issues since the i2c bus depends on pullup resistors on the i2c bus signals and they are missing.
The AVR has internal pullups that the Arduino Wire library turns on but they are too weak.
While they can work in some situations, because they are too weak, they can cause issues in other situations.
If you had the serial monitor up and running you would have see a message about the missing pullups.

0x3F,P01245673H

This indicates the auto detected information.
0x3f is the i2c address
P means PCF8574 i2c chip (vs MCP23008 chip)
01234567 are the PCF8574 Px pins for RS,EN,RW,DB4,DB5,DB6,DB7
3H on the end is the backlight circuit. PCF8574 Px pin 3 controls the backlight and it is active HIGH.

Then it delays a long time

To give you time to see the auto configuration information.
If you had the serial monitor up and working you would see additional information which would explain the blinks as well.

Then it blinked-to-black three times and put:

LCD:0 (0x3F) *P
00:01:19 (and counting upwards)

The *P indicates that the i2c signals are missing the required pullups.
If you had the serial monitor up and running you would see additional information.

Most Mega2560 boards now have i2c signal pullups on them. You must have an old board, or are using a clone that does not have them.
Also many i2c PCF8574 LCD backpacks also include external pullups on the i2c signals. Your i2c backpack does not have them.
And since your Mega boards also does not have them, your i2c signals don't have the proper pullups on them.

Because, finally, when I run any of your other examples, they do nothing to the display at all. The display just sits there.

For example, when running LCDlibTest...

I have no idea what you are trying to run.
If you are wanting to run examples that work with an i2c backpack you must run examples for the hd44780_I2Cexp i/o class. If you run examples that are not for that i/o class, there is no telling what will happen since it will be trying to talk to other h/w that may or may not exist.

Does that mean that I need to change some pin definition when I do the:

const int rs=8, en=9, d4=4, d5=5, d6=6, d7=7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

That code has nothing to do with the hd44780_I2Cexp i/o class. That portion of code is for the LiquidCrystal class which is part of the LiquidCrystal library which comes bundled with the IDE.
It sounds like you are trying to directly run an example in hd44780examples.
While it is possible to run those examples directly, they have to be edited for the specific library that you want to use.
The easiest thing to do (which I HIGHLY recommend) is to just run the examples under the appropriate i/o class.
Each i/o class in hd44780 comes with a hd44780examples area that has wrapper sketches to allow running the hd44780 examples without having to edit the actual sketch in hd44780examples.

--- bill

TheWind777:
Also, there are two LCD.h files. One, which was there in the root of the installed library in an LCD folder, I removed and put somewhere else; because there is also an LCD.h file in the LiquidCrystal library (I also removed the LiquidCrystal library that was in the install and replaced it with the NewLiquidCrystal folder) so there would be no contention.

I take it that is what I was supposed to do?

It isn't clear what you have done with respect to this LCD.h header file.
fm's NewLiquidCrystal library has been reposted in many places. On some sites it has been modified.
There are also many different libraries called LiquidCrystal_I2C which is different from fms NewLiquidCrystal.
They install differently and work differently.
The NewLiquidCrystal library as well as several others use header files with the same name.
I'm not sure has happened or if there are multiple libraries installed or if multiple libraries are using a header file named LCD.h.

While I did work on fms NewLiquidCrystal for a while. I don't maintain it nor support it.

I created the hd44780 library package to make things simpler including installation.
hd44780 does not need or use anything from the NewLiquidCrystal library, or any of the other variants like LiquidCrystal or LiquidCrsystal_I2C.
I suggested using hd44780 instead of fm's NewLiquidCrystal library because I think it is easier to install and easier to use for backpacks as hd44780 can auto configure itself for PCF8574 based backpacks.

Also, the reminder that I am using a MEGA2560 board and that the LCD2004 IIC unit says YwRobot Arduino LCM1602 IIC v1 on the little serial board with the contrast adjustment potentiometer on it. The board, itself, says 2004A on it.

The chip has AT at the end of it and it definitely uses 0x3F.

Got it. But it isn't really a serial board. It is a backpack that contains a PCF8574 i2c i/o expander chip.
The PCF8574 i/o port is wired up to the hd44780 signals of the LCD module and backlight circuit.

--- bill

Wow, you can't imagine how much you just helped me in so many ways.

It has to be remembered that I've had the Arduino exactly 2 days. I know tons about programming; but nothing whatsoever about the Arduino.

I had inferred that Serial.print sent information to the Serial device (SCL and SDA). I, not in the slightest way, thought it might mean to open up a window in the Arduino program.

Duh! :-* :-* THERE is the output. :confused:

I'm the type of person that, once you show me something... I deduce a LOT from those small details. Wow, that was so helpful. Sometimes new things are like being thrown into the middle of an ocean.

...

So, the pullup problem sounds like a big one. That should be an easy one to fix. I have a ton of resistors, just have to find the value and the locations they go (research, research).

I know it took you a lot of time to explain all that; but you can't imagine how much help it was.

I don't know why it gave the 'private' and 'protected' errors. One should never have to modify a system header file; but it worked.

I only have one LCD.h file (in the NewLiquidCrystal folder, now renamed just 'LiquidCrystal' in the root of the libraries folder). I placed EVERYTHING that was inside the NewLiquidCrystal folder into the libraries folder. Maybe that was the problem? Am I only supposed to place certain things from that folder into a folder in the libraries folder?

So, I take it that mean that I should remove the NewLiquidCrystal folder, completely, as well as the LCD folder and put them in storage?

I'll have to peruse all that great information and research each thing; thanks so much.

Well, I removed all LiquidCrystal folders from the library... but when I upload the LCDlibTest sketch, it fails because it has a line in it that says #include <LiquidCrystal.h>

As for the value of the pullup resistors on SCL and SDA; someone said, "the internal pullups (~35K) are far larger than the typical values recommended (4.7K for 100kHz, 2.2K for 400kHz). I always include external pullups, one of those two values.

So, I have to determine whether mine is running on a 100kHz or 400kHz bus.

Since mine has a PCF8574AT chip; I guess it's 100kHz? (from this data sheet on DigiKey)

That means I should use a 4.7k resistor between SCL and 5v line and another between SDA and the 5v line?

Let me grab my parts box...

TheWind777:
Wow, you can't imagine how much you just helped me in so many ways.

It has to be remembered that I've had the Arduino exactly 2 days. I know tons about programming; but nothing whatsoever about the Arduino.

You are doing pretty well for just 2 days playing with Arduino.

I had inferred that Serial.print sent information to the Serial device (SCL and SDA). I, not in the slightest way, thought it might mean to open up a window in the Arduino program.

The Serial object is for the internal UART h/w. Not the i2c h/w or as Atmel calls it "two wire".
When you call Serial.print() it will cause the uart tx pin on the AVR chip to wiggle. That pin is also Arduino pin 1.
That pin is also wired up to another chip that will convert the asynchronous signal to a virtual serial connection over USB. The IDE serial monitor (Tools->Serial Monitor) opens the virtual serial device on the host to create virtual serial connection to the USB chip on the Arduino. That USB chip hooks up to the AVR serial pins.
So when code does Serial.print(), the AVR UART wiggles pin 1 which goes to the USB chip, then through a USB virtual connection to the host, then the IDE displays the data in the Serial monitor.
The reverse is also true in that you can type characters in the Serial Monitor that go back to the AVR and wiggle arduino pin 0.
But all of this serial data has nothing to do with I2c/TwoWire.

So, the pullup problem sounds like a big one. That should be an easy one to fix. I have a ton of resistors, just have to find the value and the locations they go (research, research).

Value is not super critical. They can't be smaller than 1k. 4.7k to 10k should work fine.
Google around for i2c pullups. There are 2.
They go between the signal and VCC. Not between the signals. They are pullups so they have to connect between the signal and the voltage as they, well, pullup the signal to high.
i2c is open collector. The highs created by the pullup resistors, and the lows are created by the master or the slave. It has to be this way as it is a bus and by doing it this way, any device or master can yank a signal low and not cause a short.

I don't know why it gave the 'private' and 'protected' errors. One should never have to modify a system header file; but it worked.

The reason for this (I never really noticed it before), is because the API function command() is part of the public interface in the LiquidCrystal and LCD 1.0 API spec. Apparently, fm's NewLiquidCrystal API made it private.
I'm not sure why it was failing as the LCDLibTest sketch doesn't ever call command().
There must have been some kind of issue in the NewLiquidCrystal library or its installation that caused the issue to crop up.

I only have one LCD.h file (in the NewLiquidCrystal folder, now renamed just 'LiquidCrystal' in the root of the libraries folder). I placed EVERYTHING that was inside the NewLiquidCrystal folder into the libraries folder. Maybe that was the problem? Am I only supposed to place certain things from that folder into a folder in the libraries folder?

I don't really want to spend the time to debug NewLiquidCrystal issues.
Feel free to use it if you want, but I prefer to use hd44780.

--- bill

TheWind777:
Well, I removed all LiquidCrystal folders from the library... but when I upload the LCDlibTest sketch, it fails because it has a line in it that says #include <LiquidCrystal.h>

But if you are using the i/o class examples and their wrappers, they specify their own headers and LiquidCrystal.h will not be included.
For that board you should be using the examples for the hd44780_I2Cexp i/o class.

As for the value of the pullup resistors on SCL and SDA; someone said, "the internal pullups (~35K) are far larger than the typical values recommended (4.7K for 100kHz, 2.2K for 400kHz). I always include external pullups, one of those two values.

So, I have to determine whether mine is running on a 100kHz or 400kHz bus.

Its not super critical, particularly with wires that aren't too long and only a few devices.
Just use 4.7k and you will be fine regardless of speed.
--- bill

Yeah, I just soldered-up a two-resistor kluge that goes directly on the LCD2004 pins, one between the VCC line and SDA and a second between VCC and SCL That way, it'll always be used on that MEGA board, anyways. I'm getting a true LCD display from China soon. Just using this as my diving board into Arduino programming and circuitry; got to start somewhere. Best thing I currently have to experiment with, anyways.

And, now, when I run your Diag it says:

Checking for required external I2C pull-up on SDA - YES
Checking for required external I2C pull-up on SCL - YES

Also, finally, soldered-up a four-pin cable for the connector. Been using jumpers. Now doing it the right way.

...

Next comes the old 'LiquidCrystal' library problem.

When I remove both LCD and LiquidCrystal library it definitely doesn't like that.

When I replace the LCD library, it compiles.

However, when I run your LCDlibTest.ino straight from the libraries folder's example folder with no LiquidCrystal folder at all in the libraries folder it gives a ton of errors. That is with just a basic install of Arduino and the LCD folder that came with the install and no LiquidCrystal folder at all.

Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Program Files (x86)\Arduino\libraries\hd44780-master\examples\hd44780examples\LCDlibTest\LCDlibTest.ino:82:27: fatal error: LiquidCrystal.h: No such file or directory

#include <LiquidCrystal.h>

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

So, the LCDlibTest.ino seems to need LiquidCrystal.h to be there or it fails.

So, I figured that I'll make the most minimal LiquidCrystal folder that I can. I created LiquidCrystal in the libraries folder and copied LiquidCrystal.h and .cpp into it.

Now, when I ran it it said:

Arduino: 1.8.2 (Windows 7), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

In file included from C:\Program Files (x86)\Arduino\libraries\hd44780-master\examples\hd44780examples\LCDlibTest\LCDlibTest.ino:82:0:

C:\Program Files (x86)\Arduino\libraries\LiquidCrystal/LiquidCrystal.h:33:20: fatal error: FastIO.h: No such file or directory

#include "FastIO.h"

^

compilation terminated.

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

So, it also needs FastIO.h and .cpp in there.

After there are those four .h and .cpp files in that folder, it runs.

Next, running it with the serial window open. From the serial window, you'd think it was working properly.

It goes:

LCD initialized
Byte timing test
ByteXfer:105uS
cursor
Cursor Blink
setup() done
00:00:28
00:00:29
00:00:30
00:00:31
00:00:32
00:00:33
00:00:34
00:00:35

.
.
.

and keeps going.

However, nothing is happening on the LCD display.

Next, I removed the breakout board to try the signals straight from the MEGA. I cut four nice long gold-plated wirewrap posts, plugged them directly into the SCL, yellow wire to SCL on board. SDA green wire to SDA on board. Black wire from GND to GND. White wire from VCC to 5V.

Upload LCDlibTest from the library's hd44780-master\examples\hd44780examples\LCDlibTest\ folder.

Same result.

Serial window looks fine. Display does nothing at all.

If I load, from the classes example folder, the "Hello World" example and Upload it...

It blinks very fast four times, then displays four-or-five strange random characters strewn across any of the four lines. Definitely doesn't say, "Hello World".

Only difference I know of in the Arduino install folder is the LiquidCrystal folder with those four files in it. I did not put the second LCD.h header file that is in the LiquidCrystal folder in there, so there should be no contention.

Nothing else is different in the Libraries folder.

Only other libraries I've installed since I cold-installed Arduino software are:

Arduino-IRremote-master

I see nothing strange in that folder which might interfere.

Arduino-Temperature-Control-Library-master

I see nothing in that folder that might interfere.

USB_Host_Shield_2.0-master

Haven't even used that one yet because I haven't got the USB Host board yet.

Don't see anything suspicious in there.

And that's it. Freshly installed Arduino folder, version 1.8.2, basically except for those folders.

When I re-load my Remote Control Sketch, return the Breakout board, plug in the LCD2004, replace the NewLiquidCrystal folder. Writes to the LCD perfectly.

Don't have a clue what's happening. But, it fixed a pullup-resistor problem that I didn't know I had.

I'd say that this line is probably the key to the ones I'm trying that aren't working:

"you must run examples for the hd44780_I2Cexp i/o class".

Any way you look at it, I've already learned so much. Thanks a lot.

I now have the proper pull-up resistors and know that, neither the LCD board, nor the MEGA have them properly installed. At least with that LCD2004 board, it's been fixed.

Came a tiny distance, at least.

:slightly_frowning_face:

And, the NewLiquidCrystal library seems to be working well, if not telling me as much important information as your class does. I'll be delving more deeply into it as time goes along. At least I've got some of the problems worked-out.

Like knowledge of the serial window. :smiley:

Each hd44780 i/o class that comes with the hd44780 library package comes with its own set of hd44780examples wrapper sketches that wrap around the raw hd44780examples sketches.
You are trying to run a raw hd44780examples sketch. While this is possible, you will have to edit it for the library and class you intend to use. The raw hd44780examples LCDlibTest sketch defaults to using the IDE bundled LiquidCrystal library.
If you are wanting to use something like LCDlibTest with some other library then you must do the appropriate modifications to the sketch.

Like I said before, I'd recommend sticking to the i/o classes that came with hd44780 and using their wrapper sketches before you go off and try to make an hd44780example sketch run with some other library.
All the i/o classes that come with the hd44780 package come with wrapper sketches for the hd44780examples. For the hd44780_I2Cexp class they all should "just work" with no modifications.
Other i/o es like hd44780_pinIO, hd44780_I2Clcd, etc.. may need modifications to their wrapper sketches to modify the pins used etc..

Also have a close read of the notes on the hd44780 github page and make sure you are not using any of the not recommended IDE release versions. Some of them are really broken and have subtle issues that fall down and break on some of the examples.

I think in future hd44780 releases I'll comment out all the default includes and lcd object definitions in the raw hd44780examples files so that none will compile at all until properly edited. I will also add a directory for other 3rd party libraries that contain wrapper sketches for them.
The intent being use the wrapper sketches unless you have a specific need to do otherwise.

I would recommend picking a library and sticking with it.
If you want to use NewLiquidCrystal, stick with that. If you want to use hd44780 stick with that.
While you can get some of the hd44780 included examples to work with NewLiquidCrystal i/o classes or other libraries, the main intent of the examples in hd44780 was to demonstrate functionality and performance with the hd44780 library.

--- bill

Thanks so much for all your help. Starting to learn a whole new thing is always daunting, and you helped, immensely.

Having nothing to do with your library... There, already, seems to be a contention with the NewLiquidCrystal folder, anyways; as it has an LCD.h and .cpp file and there's already an lcd folder, as well as an older LiquidCrystal folder in the libraries folder in a new install of Arduino 1.8.2

I, already, had trouble in that way and had decided to remove the old LiquidCrystal folder, replace with NewLiquidCrystal folder, then had to decide which lcd.h file to remove... Shouldn't have two.

Now, since yours also needs both libraries, I'd suspect that's where contentions are occurring.

Yours seems to be more powerful than LiquidCrystal's is. Love the Diag. Very helpful.

;

Also, particularly in this crucial beginner's phase of my development, I decided to purchase a "Authentic arduino' mega2560 which will be coming soon. I'll install the crappy clone into the intelligent breadboard system that I'm designing. It'll work perfectly for that purpose.

To not be able to trust what the disreputable clone makers have done that may be different (and incorrect) from original mega2560 is insane to have to, also, deal with during the learning phase.

It had just come with the 40-sensor starter kit... So was experimenting with it.