LCD to 74HC595 without library

Hi, I'm new here! (also I'm new to programming)

I need to use a LCD display (1602) with the 74HC595 shift register but I can only use the unedited "normal" arduino 1.8.15 libraries.
There is a lot of information on this combination, but everyone seems to be using libraries that I would have to download in addition.

What would I have to add to my code, if I just include LiquidCrystal? Is it too complicated for a beginner?

I looked at some of the modded libraries and tried to guess what the code is supposed to do, but it was just slightly helpful. Copy pasting the code didn't help at all of course.

Thx for the help!

Why do you want to use a 1602 LCD with a 74HC595? :roll_eyes:

It's a sort of cute "party trick" and has been done in the past, but in practice, I²C "backpacks" are pretty much dirt cheap and allow you to interface the display with just the two I²C pins - and share those pins with many other devices.

1 Like

I just have a 74HC595 in the set i bought. No other reason :smiley:
So you are telling me that a I²C adapter will solve my problem easier?
Sounds good, but my initial problem is the same. What would my code have to look like without the LiquidCrystal_I2C library?

We use libraries because someone else has done all the hard work of coding and testing.

While it is rather big, we presently recommend only using the "HD44780" library from the IDE Library Manager.

That's easy! Find a library that does what you want and incorporate those sources into your sketch. The easiest way would be to copy the .h and .cpp files from the library into your sketch folder. They will show up as tabs in your sketch. If you can't use more than one file, put the contents of the .h file at the top of your sketch and the contents of the .cpp files at the bottom of your sketch.

1 Like

Yes, you can bit-bang with a 74HC595.
I am fairly certain that Bill Perry's hd44780 library supports it.

I know that I have written a (non-public) library for 74HC595.

It is considerably more complex than using the 8-bit or 4-bit parallel that Nature intended.

David.

1 Like

As of right now, the released hd44780 library does not have shift register support in it.
I have it in my test versions but I have not released it.

Years ago I worked with several LCD library authors getting shift register support integrated including fm with the newLiquidCrystal library.
But over the years the cost of i2c has plummeted along with the cost of i2c backpacks, so these days I would use an i2c backpack vs a shift register as i2c is just simpler/easier to use.

I do have code for using a shift register with 1 Arduino pin that I'm looking at adding to the library. It is mainly MCUs with fewer pins. But I probably won't release it until the library is refactored to be be smaller as the MCUs with fewer pins also tend to have a smaller amount of flash available.

--- bill

You can't use the LiquidCrystal code that comes with the IDE to control the LCD using a shift register. The LiquidCrystal library is hard coded to talk to the LCD using multiple Arduino pins.

Libraries like newLiquidCrystal and hd44780 are layered with multiple classes that allow writing a small shim i/o class to control the LCD over various i/o interfaces like shift registers, i2c, etc...

To write all the code to control the LCD over a shift register is a pretty big task if you are starting from scratch.
That is why people are saying to use a library that is already working.

--- bill

1 Like

Thank you for clearing that up for me!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.