Seven-segment LCD uses two-wire interface
You can connect seven-segment LCDs using only a two-wire interface (Figure 1). The two-wire interface may be at the field-effect, direct-drive LCD or at a serial interface (such as I2C) that uses an eight-pin microcontroller. The design in Figure 1 uses an Atmel (www.atmel.com) ATtiny12 microcontroller, IC1. VCC can range from 2.7 to 5.5V. Each digit receives drive from an 8-bit 74HC164 shift register, which provides seven outputs for each of the segments and one output for a decimal point or a colon. The data input to the shift register drives the LCD's common terminal. Software for the eight-pin microcontroller generates the required symmetrical ac square wave between the segments and the common terminal (see zip file containing Listing 1). This generation entails shifting the seven-segment data and decimal points to the appropriate outputs and setting the shift-register-input/LCD-common-terminal to low at a less-than 1-msec rate. A delay of 16 msec followed by shifting the same data complemented, as well as the complement of the LCD common terminal with another 16-msec delay, provides the second half of the required ac waveform. Because field-effect LCDs takes tens of milliseconds to respond, the rapid data-shifting and display-common changing does not affect the displayed image. You can use the two 16-msec delays per cycle for application processing.
Directly driving the segments allows the display of not only the numbers zero to nine, but also any combination of segments and decimal points. You can use the eight-pin ATtiny12 with a built-in, 1-MHz clock oscillator to produce the described two-wire signal and to provide a two-wire I2C application interface. The dedicated use of the microcontroller for display control and its I2C interface frees the application hardware and software from timing and resource restrictions. The implemented I2C interface operates at 0 to 40 kbps and is bit-synchronous. One data protocol allows for the input of a two-byte binary integer, which converts to decimal for display. A third byte in the protocol indicates any decimal points or colons. This data format allows the easiest interface from binary measurement or calculation. A second protocol accepts four bytes that directly control the segments and decimal points, allowing the display of a variety of characters and symbols possible on a seven-segment display. Click here to download the source code and hex object file for the ATtiny12. The code provides a two-wire I2C interface for a four-digit Lumex (www.lumex.com) LCD-S401C52TR display.