Grumpy_Mike:
Again, I am going to disagree here.
I have real world experience and math that I believe proves otherwise.
And so have I and I believe you are wrong.
I don't buy into what you wrote, you are misunderstanding things.
Anyway it is all a bit academic, you go with your solution and I will continue to build stuff with mine.
Maybe this was misinterpreted:
No other low wire count interface is this easy to make for a DIY project.
What I meant was:
No other low wire count interface is this easy to use for building a DIY lcd backpack.
Perhaps that threw things in the ditch.
If so, Ignore the rest of this post.
If not......
--- bill
Remember my original comment was that building a DIY 2 wire SR register lcd backpack implementation
is cheaper, simpler, and depending the library, can be faster updating the display
than 115200 baud async serial or i2c in 400k/sec mode when using a LiquidCrystal compatible API.
So here are some facts:
-
A 74hc595 Serial chip can be purchased for 20 cents QTY 1 (how much is an i2c i/o expander chip QTY 1?)
-
A working 2wire SR lcd backpack can be built for under $1 with QTY 1 prices from tayda including 70 cents for a strip board.
(as low as 42 cents each if you build 4 backpacks from the single 70 cent strip board)
-
The time it takes the LCD to process a data write or a simple command is not more than 37us.
-
All apl calls but home() and clear() in the LiquidCrystal API use simple/fast commands (< 37 us)
-
The LCD cannot start processing data/cmd until it receives the data/cmd on the hd44780 interface.
-
The LCD cannot be updated faster than it can receive data/cmd(s) on the hd44780 interface.
-
The total time to update the display can not be shorter than either the transfer time or LCD processing time.
-
If the transfer time is longer than the LCD processing time, then LCD updates cannot occur faster than the transfer time.
-
Transfer time can be "hidden" under the LCD processing time when it is shorter than the processing time.
(This only applies to back to back data/cmd(s))
-It takes 87uS just to transmit a byte at 115200 baud, so the LCD cannot be updated faster than
87uS with asynchronous serial as the interface no matter what is handling the serial to hd44780 conversion
even if all the other overhead is zero, which it isn't.
-
When using 4 bit mode, the hd44780 interface cannot be strobed for the next first nibble for a new data/cmd
until the previous data/command has been fully processed.
-
A 2 wire SR interface can send a nibble to the hd44780 interface in 24uS.
-
The above 24uS can potentially "hide" under the 37uS processing time of a previous data/cmd.
-
a 3wire SR interface can transfer data faster to the hd44780 interface than a 2 wire SR interface.
-
a 3wire interface could transfer a full byte to the hd44780 interface in about 15us.
(when running the hd44780 interface in 8 bit mode vs 4 bit mode)
-
The above 15uS can potentially "hide" under the 37uS processing time of a previous data/cmd
I'll further and present a few actual logic analyzer traces in support of the timing numbers.
In the first picture, you can see the time it takes to transmit a byte using asynchronous serial at 115200.
It shows up as 85uS which is within 2% of the calculated 87us theoretical data bit rate.
The rest of the captures are based on capturing 2 back to back data writes
using a HC595 run with two wires with the hd44780 interface in 4bit mode.85
When using two wires on a shift register, it has to be zeroed first then the nibble with
control data can be sent.
You can see the 4 enable strobes (2 enables for each nibble) of the two bytes.
You can also see two clock bursts for each nibble strobe. The first burst is the
zero, followed by the nibble data and control bits.
Here is a brief desription of each capture: (see time between T1 and T2)
- 85.0 uS - Time for a single byte transfer using async serial at 115200 baud
- 24.5 uS - Time for first nibble transfer to hd44780
- 54.0 uS Time for a byte transfer to hd44780
- 125.8 Us Time for 2 back to back data writes
(first write completed and 2nd write was sent to hd44780 interface)
Based on those numbers you can see that back to back data writes could be as fast as
125.8uS/2 or 62.9uS.
The measured 76uS data write xfer time I mentioned before is the measured time
of a single lcd.write() through all the software
(which is why it is higher than the 62.9uS low level SR/hd44780 timing)
It sends the data to the hd44780 interface but the low level code
does not wait for the write to finish as it only needs to wait long enough to ensure
that another immediate data/write will not violate the 37us data/cmd timing.
However, since the small blind wait is enough to ensure that that the transfer time +
the blind wait is 37us, then each lcd.write() will always be the same amount of time.
The reason that the lcd.write() time is not 37uS is that while it
is possible to hide some of overhead like the transfer time it is not possible to hide all
the overhead underneath the data/command processing time, with my current
library.
Note: I'm working on an implementation, where all the overhead not just
the transfer time can potentially be hidden under the 37uS timing so the
back to back time will be 37 uS or the total overhead (transfer + s/w)
whichever is longer.
Grumpy Mike,
If you have a source for less than 20 cent i2c i/o expanders I'd love to get some.
Also, if you have analyzer shots of the hd44780 interface driven by an i2c i/o expander, I'd
love to see the timing to see how an i2c implementation compares to a 2 wire SR
implementation.
If you want, I can even PM you a sketch that will report the byte transfer time in uS on the LCD display
using the lcd.write() api call of the LiquidCrystal API.
(It can run on any LCD interface that uses the LiquidCrystal API)
That timing in itself is quite useful as it indicates the true end to end
data transfer time as seen to the sketch, which is all that really matters when it comes
to updating the LCD display.
--- bill