Go Down

Topic: ShiftRegLCD lib (LiquidCrystal 3-wire replacement) (Read 19642 times) previous topic - next topic


Is it the sort of thing I could alter / try out if you pointed me in the right direction?


Aug 13, 2009, 12:47 am Last Edit: Aug 13, 2009, 12:48 am by raron Reason: 1

Ok. In that case I'm not so sure I should change the library yet. I don't have any 4-line displays to play with either.

Have you tried the "srlcd.setCursor(column,row);" method?


Have you tried the "srlcd.setCursor(column,row);" method?

No, but I'll try to look it up tonight when I've got some free time.


Hello Guys!
I have to try that. Thank you for a great job! :)



... The data-sheet is not helpful in giving information about addressing the four lines or the memory map layout of the displayed characters.

I have some information about LCD addressing at http://web.alfredstate.edu/weimandn.  I am working on an update to include 16x4 displays, but the current info should help you understand the addressing.

By the way, the number of 'lines' that you specify in the initialization does NOT refer to the number of visible lines on the display.  It refers to the number of lines of memory used, as interpreted by the LCD controller.   The only valid choices are 1 or 2, and 2 is the correct choice for almost all LCD modules (even many of those with only one line on the display).



I might've bought the wrong chip! I seen that they use the LS164 and the HEF4094.. well I ordered a set of HC164, HC595 and a bunch other for $5 for 10 of each.. a steal! So I couldn't pass it up!!

I'm curious though.. am I able to use the HC164 to do this? Not exactly the LS164.. I looked through the datasheet and couldn't notice much a difference.. (I didn't really know what to look for, lol :))


Just try it :). I did not read the datasheets of both chips, just browsed in farnell to compare the general characteristics and I think LS is a little bit slower (36Mhz) and probably there is something about the maximum ratings of both chips that is different.


Well, somebody mentioned the pins were different, so I tried changing those..
I must've messed up somewhere, but I'm not getting anything.. besides power. LCDs not even initializing or anything, so I'm assuming it's something in my wiring.. I've tried a couple times to mix it up, unplug it.. redo all my wiring..
I'm missing something here! :P
But hey, I'm happy with having my LCD work!

But I'm curious, I was reading up about somebody using a PIC18F(some numbers here) for a 1 wire interface, other than the power and ground obviously, and used serial communication to talk to that chip, which sends the commands out to the LCD.. I'm curious
What kind of uh, "talent" or expertise do I need to implement something like this with one of my arduinos? I have a couple old 168's laying around and was hoping for them to be useful! I think a setup like that would be awesome!
It's somewhat like this, but was more.. homemade and sexy! (can't find the link, but here's the Sparkfun version)


Aug 27, 2009, 10:09 am Last Edit: Aug 27, 2009, 10:09 am by mircho Reason: 1
We can go further. With a dedicated tiny or mega on the back of the LCD we can achieve 0(ZERO) wires LCD communication. :)


Well bah hum bug.. after trying for a couple hours.. pass!

I have a total of 4 different chips with the set I bought.. maybe a different one will work? I tried hooking up the 164 as suggested.. but it's the HC.. I think they may be a totally different chip?

74HC164 165 573 595  are the chips I have.. I've used the 595 without any problems, the rest I'm not really sure what to do with.. other than try a LCD with less wires!! :D

But yeah, that wireless communication over the IR set is AWESOME! I used it just for the sake of having it! :)


Anyone interested in I2C control for parallel HD44780 compat. LCD's using PCF8574?
I'm just finalyzing the library-modifications and would be glad to share.
(Still need a bit of time to clean the code and do some extra tests and find a webspot to store the files for download).

I needed to free up some ports on the Arduino and also wanted to be able to connect more than one LCD to it.
Doing it with I2C, I should in theory be able to connect up to 16 (8 on a PCF8574 and 8 on a 8574A) LCD's.
I'v only tested with one 16 x 2 LCD so far. Tests with 20 x 4 LCD are sheduled next.
For now all functions of the LiquidCrystal lib shipped with IDE 0017 seem to work. In addition I've added backlight control.
Still working on the buisy flag checks so timing is controlled by the LCD instead of the Arduino app.



Since I also got a bunch of the 74HC164 since last time, I decided to give those a go. But it was a no-go on both my displays.

However, in 3-wire mode they worked. So the problem is probably the 74HC not managing the quick'n'dirty diode-resistor AND gate for the enable signal.

But then again, it seems Mouse above here made it work with the 74HC164 in 2-wire mode, so I'm not really sure. Also you got it to work with the HC595.

Could be experimenting more with the series R resistor solves it.  Or, of course, have an actual factual digital AND gate :P But that would increase complexity a bit.

I've tried to look up the capabilities of the 74LS164 and 74HC164, but it's not always easy comparing them when datasheets don't have the same names or tables.

For the 74LS164, datasheet says, under "recommended operating conditions"
HIGH level output current: -0.4 mA (max)
LOW level output current: 8 mA (max)

Whereas the datasheetsfor the 74HC164 says, under "Absolute maximum ratings":
DC output current, per pin: +/- 25 mA

I find that pretty puzzling, seems like the HC family IC's can sink and source more current than the LS family. Maybe my assumption above is wrong about it not being able to work with the diode-resistor AND gate. It would seem it should handle it pretty well (4.3-ish volt / 1k= 4.3-ish mA).


Sounds interesting! I've never worked with I2C yet though, so I'm not sure how exactly that works or how complicated it is to set up. Also I'm wondering about the speed of an I2C bus and how well the bandwith is spent communicating about wating for a busy-flag is. As I understand it, it can be quite a few devices on an I2C bus? (This might not be a problem though, I'm just thinking out loud here).

May I suggest googlecode http://code.google.com/intl/nb-US/projecthosting/ to host your project?



I2C is "simple". I'm a newby and got it working in a sec.
Thanks for the storage suggestion but I already found a spot to store Lib/samples/additional info.
Links on the playground:
http://www.arduino.cc/playground/Code/LCD in the section "Using 4-bit mode with Hitachi LCD controllers."
(both linking to: http://www.xs4all.nl/~hmario/arduino/LiquidCrystal_I2C/ )

I didn't get the Busy flag checking working as quick as I wanted and needed to move forward with my project so I've added that to my "To do" list.
The number of I2C devices on a bus can grow to big numbers when you start using busmultiplexers like the PCA9546.
My experience with I2C speeds is insufficient to give you any advice: Try it, play with is and see where you end up, thats my roadmap ;)


hello all,

ive build the 74ls164 setup with a 16x2 display, and it only wants to display text on the first line. even lcd.setCursor(2,1) did not work. even to setCursor(2,0) it did'nt listen.

if i initialize the lcd with ShiftRegLCD srlcd(9, 10, 8, 2); i get a non functioning lcd. no characters show up.
ShiftRegLCD srlcd(9, 10, 8, 1 ); is working fine.

any ideas?
"We're all in this together..."


I'm sorry I don't know why it doesn't work. What is the name of your display?

I got a 20x2 line LCD that works with "ShiftRegLCD srlcd(12, 13, TWO_WIRE,2);". I use it in 2-wire mode, and have never actually tested 3-wire with this library myself (I use my old lib and old PCB for that).  I don't see any bugs in the library regarding 3-wire mode (no guarantee though).

Could be your "contrast" setting (pot) needs to change to see it?

Go Up