Pages: 1 2 [3]   Go Down
Author Topic: LCD3Wire: a 3-wire driver for HD44780-based LCDs  (Read 4821 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unlike earlier 2-wire implementation show, this one requires no shift registers. Just two IO pins + 4 rc filters (4x110n capacitors, 2x1k resistors, 1x10k resistor and 1x100k resistor). The capacitors are chosen so that parasitics is minimized for real life reliability.

The code is really written around 1 function, lcd_write(). That's where all the timing stuff is implemented.

lcd_init() calls on lcd_write() to bring the lcd out of its power-on state.

As the timing gets expotentially slower for a 2-wire system, this implementation is very slow: about 2 seconds for each line of display. You can literally see the characters showing up one at a time, smiley.

Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

As is, the code is actually written in gcc-avr (the compiler under-neath arduino).

However, it implemented a digital IO subsystem whose calling convention is identical to Arduino's, but much more efficient, much faster, more portable and more flexible - it can be easily ported to any mcu while retaining the arduino calling convention.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Connection:
MOSI pin: from the mcu to shift register's data pin (pin1+2 on HC164 and pin 14 on HC595). LCD's RS pin tied to this line as well.
SCK pin: from the mcu to shift register's serial clock pin (pin 8 on HC164 and pin 11 on HC595)
Enable pin: from the mcu to the lcd.

What about the RCK line (pin 12) on the HC595?  Anything connected to that?  A schematic for your 3wire HC595 interface would be welcome.

Quote
Advantages over other 3-wire solutions:
1) It allows 8-bit as well as 4-bit mode.
2) It uses no parts other than the shift register.
3) It allows HC164 as well as HC595.

Are there any example 3-wire interfaces that drive an LCD in 8-bit interface mode, please?  I designed one that uses 3 pins on a 74HC164 but I was wondering if there were any others?

TIA, Mike
« Last Edit: January 13, 2013, 10:11:07 am by Mike McLaren, K8LH » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What about the RCK line (pin 12) on the HC595?

Connect it to the Enable line: those people who designed HD44780 are incredibly smart and with tons of foresight, smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What about the RCK line (pin 12) on the HC595?

Connect it to the Enable line: those people who designed HD44780 are incredibly smart and with tons of foresight, smiley


Ahhh!  Oooo!  Nice!  Haven't seen that one anywhere before...  So something like the second drawing below.  That's much better than what I came up with a couple days ago which requires an extra clock pulse.

Thank you Sir.  Cheerful regards, Mike


* K8LH 3-Pin 74HC595 LCD 8-Bit Mode Backpack.jpg (57.08 KB, 472x323 - viewed 58 times.)

* 3-Pin 74HC595 LCD 8-Bit Mode Backpack.jpg (55.56 KB, 464x314 - viewed 72 times.)
« Last Edit: January 13, 2013, 10:57:42 am by Mike McLaren, K8LH » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes.

In the code I wrote earlier, I forced a particular connection (Q0 -> D0, Q1 -> D1, etc.) With a little modification, you can remap those pin connections to your own liking, providing additional flexibility for your layout guy.

BTW, what's the capture tool you used there? Pretty refreshing.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The drawings were done using the drawing tools in MS Excel.

Hey, I added an RC integrator and tested a 2-pin 8-bit design but I'm a PIC guy (sorry).  Anyway, if you're interested, I've attached a shot of the board just moments after it came up (first try!) and another couple shots of the board before I added the RC parts.  The host is a PIC18F14K22 (16 MHz) with an assembly language program. The low level LCD driver uses 28 words of program memory and is isochronous.  With delays for the RC tau of 3.3 microseconds, it takes precisely 83.75 microseconds to send each byte to the LCD.

Cheerful regards, Mike


* K8LH 2-Pin 74HC595 8-Bit 1st Try.jpg (56.51 KB, 619x259 - viewed 40 times.)

* K8LH 595 8-Bit Proto Front.JPG (138.22 KB, 640x480 - viewed 29 times.)

* K8LH 595 8-Bit Proto Back.JPG (172.12 KB, 640x480 - viewed 32 times.)

* K8LH 2-Pin 74HC595 8-Bit Mode Concept.jpg (59.92 KB, 465x352 - viewed 41 times.)
« Last Edit: January 14, 2013, 12:16:55 pm by Mike McLaren, K8LH » Logged

Dallas, TX USA
Offline Offline
Faraday Member
**
Karma: 67
Posts: 2710
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Mike,
If you are wanting a 2 pin design, you can get significantly better throughput using an and gate instead of an RC
network to multiplex the pins. The and gate can be created using a resistor and a diode.
When doing that, I was able to get 76us per byte transfer on a 16 mhz AVR.
And that 76 us is the full overhead from an Arduino sketch going through the Print class then down through the library
sending the byte to the display and returning back to the sketch.
The library is also using 4 bit mode which requires sending 2 nibbles and because of the and gate you have
clear the SR before each nibble transfer.
The code I used the SR2W code in this library:
https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home
(I am the author of the SR2W interface code)
You can see a diagram of how the SR is wired up in LiquidCrystal_SR2W.h

Since you are a PIC guys here is a link to a page that is doing essentially the same thing
for PIC:
http://www.rentron.com/Myke1.htm

From an overall design perspective I think the AND gate multiplexor is better
than the RC network multiplexor even though it requires 4 times the number of shifts to the SR
since it is faster and allows backlight control.
It also has not timing critical sections so interrupts won't ever have to be masked
while doing the transfers.
Cost wise, it should be nearly the same resistor & diode vs resistor and cap.
Then for a few additional pennies you can add backlight control.
The backlight control does require some dampening on the transistor input to remove
the flicker because of live output bits on the SR during shifting.

You can see a sample backlight circuit in the SR2W header file.

--- bill
« Last Edit: January 14, 2013, 01:05:23 pm by bperrybap » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 27
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for all the great info', Bill...  I'm not really interested in 2-pin designs, per se, or simply driving an LCD, per se.  I think there may be more possible applications for an 8-bit shift register + latch than just simply duplicating Myke Predko's old 74HC174 2-wire LCD interface (grin).  Anyway, I'm having fun discovering different clever, creative, and elegant design solutions...  
« Last Edit: January 16, 2013, 06:59:23 pm by Mike McLaren, K8LH » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The low level LCD driver uses 28 words of program memory and is isochronous. 

Excellent. The advantage of coding in assembly.

Quote
With delays for the RC tau of 3.3 microseconds, it takes precisely 83.75 microseconds to send each byte to the LCD.

As long as your refresh time for a line is within 5 - 6 ms, you are fine.

A word of caution: the r/c approach is of no use in a noisy environment. As a matter of fact, I would recommend that you perform periodic software reset of the display, in case it goes out of sync.
Logged

Pages: 1 2 [3]   Go Up
Jump to: