This is not new Idea of interfacing LCD using two wires, but it can help in many situations when there is not enough of microcontroller pins. This example is based on Hitachi 44780 Alphanumerical LCD.
This circuit I provide is only to represent an idea but I think it should work also if soldered. We know, that to make LCD working you need at least 6 (in 4 bit mode) wires to control. But what if you need as many pins as possible from your avr and still want to see results on LCD. Then you need to use serial LCD or make one.
In this example you just need to convert serial data coming to LCD using shift register. I suggest using 74HC164. You need only two wires to push data to shift register and then give them to LCD using â€œEâ€ strobe signal.
So how this operates?
Atmegaâ€™s PC1 pin clocks shift register and PC0 is data line. Before you write to shift register clean it by sending â€œ0â€ in eight clock cycles. You can erase register with additional wire controlling register reset, but there would be 3 lines used.
After register is cleared, send eight bits to register. First bit sent is always 1, as it is used to strobe LCD, second bit is Register Select, and then one bit is not used and then follows 4 bits as data and las bit is always 0 in order to make strobe E work correctly. You should see that in eight clock cycle last bit in shift register enables LCD with â€œ1â€ value in last bit. Then by sending “1” to data line you enable LCD E pin. Resistor and Diode acts there as AND element. If only register Q7 signal is active, but data low, then LCD E pin is low. If data line is high but 74HC164 register Q7 pin is low, then diode pulls low this signal and LCD pin will be low. Only when both PC0 and shift register Q7 are high, ten LCD pin E is strobed.
Added some Test routine Programmed with WinAVR. I tested and it is working.