One wire controls LCD module
The ubiquitous LCD (and VFD) modules based on the HD44780 controller IC can require up to 12 lines from the host.
This hardware interface Design Idea reduces the connection to just one wire, allowing a basic microcontroller with limited I/O to drive a large display, either directly, through a standard interface, or even an opto-isolator.
Figure 1 A typical LCD module
The LCD’s eight data-bit inputs are encoded by a sequence of short and long pulses clocking a serial-to-parallel shift register, with control and data signals generated by a pair of dual monostables. The RS signal is controlled by leaving the serial line low or high after the eight data bits are sent. The read function of the display is dispensed with (R/W is tied low), so status can’t be read, meaning the module’s processing delays (up to several milliseconds) must be accommodated by software timing alone.
Figure 2 One-wire LCD interface schematic
Each byte needs to be sent as eight bits, MSb first. The firmware timing needs to match the hardware time constants: The bits should be transmitted two delay units apart. The delay SS (Figure 3) should be several delay units. There needs to be a gap between bytes of several bit times to allow the E pulse to finish before changing RS. A delay unit is defined as the monostable period set by R2 & C2, which can range from around 7µs to 12µs depending on the particular IC family used.
Figure 3 Timing diagram
Download PIC assembly code fragment.
- One I/O line drives shift register with strobe
- One wire brings power & data to LCD module
- RC lowpass filter expands microcomputer’s output port
—Rex Niven has a Masters Degree in Engineering Science from the University of Melbourne and has worked as a design engineer in New Zealand, Britain, France, and Australia. Since 2000 he has managed his own firm, Forty Trout Electronics.