2-wire LCD interface using PIC16CF84

29,527

Circuit Image

Alphanumeric LCD displays are widely used in microcontroller applications due to their versatility and ability to enhance project functionality. They provide text messages that offer user instructions and feedback, contributing to a more professional and user-friendly experience. LCDs are also useful for debugging applications, allowing for the display of variable and I/O conditions, often at a lower cost compared to microcontroller emulators. Surplus LCDs can frequently be acquired for a dollar or less. The Hitachi 44780-based LCD controller chip is the most common interface, known for its ease of use and low power consumption. However, the complexity of interfacing with this chip is a common concern, primarily due to the limited availability of well-translated datasheets and accurate online resources. A significant hurdle in using alphanumeric LCDs is the number of pins required for control; the Hitachi 44780 requires twelve pins in eight-bit mode, which may not be feasible for smaller microcontrollers. This can be reduced to six pins in four-bit mode, which is often acceptable for various applications. A popular alternative is the use of Serial LCD Interfaces, which allow for control with just one pin, though they require properly timed NRZ serial data, which can be challenging in some scenarios. An effective solution involves using synchronous serial data, requiring both a clock and data pin to load a serial-in/parallel-out shift register with the necessary data bits and R/S pin information. The E Strobe Pin is directly controlled by the microcontroller to latch the data from the LCD. The project described here enhances this circuit by combining the shift register's data line with its most significant bit, allowing the E Strobe function to operate without a separate line. A 1 kΩ resistor and diode function as an AND gate in this configuration. The operation of this resistor/diode AND gate may not be immediately clear. When the shift register bit is low, the diode pulls the E pin low. Conversely, when the shift register bit is high, the diode prevents current flow from the E pin to the shift register. The resistor serves as a current limiter; when the shift register bit is low and the data bit is high, the current through the resistor is limited to 5 mA for a 5-volt logic application. Despite the diode pulling the E pin low, the voltage at the data side of the resistor remains high. When both the data line and the shift register bit are high, the E pin will also be high. This AND circuit could alternatively be implemented using a TTL two-input AND gate, such as a 7408, if available. The original circuit design utilized a two-transistor and two-resistor configuration from a previous project involving the 89C2051 emulator. The concept for the AND equivalent circuit was sourced from an old issue of "Electronics Now," demonstrating its effectiveness for this application. To properly load the shift register, it must first be cleared to prevent unintentional strobes to the LCD.

The integration of alphanumeric LCD displays into microcontroller projects not only enhances user interaction but also provides an efficient means for diagnostics and debugging. The Hitachi 44780 controller is pivotal in this regard, offering a straightforward interface despite the challenges posed by pin limitations. The use of a shift register to manage data transmission simplifies the process, allowing for reduced pin usage while maintaining functionality. Implementing a resistor and diode as an AND gate is a clever solution that streamlines the control of the E pin, ensuring that data latching occurs only when appropriate conditions are met. This design facilitates the efficient operation of the LCD while minimizing the complexity typically associated with direct interfacing. The overall architecture of this circuit exemplifies how innovative approaches can overcome common challenges in microcontroller applications, ultimately leading to more robust and user-friendly electronic systems.Alphanumeric LCD displays have become very popular for microcontroller applications because they can add a lot to a project in a variety of different ways. A text message giving the user instructions as well as feedback can make the application seem much more "professional" and easy to use.

I like to use LCD`s to help debug applications, with breakpoints set to display variable and I/O conditions and they are a lot cheaper than using a microcontroller emulator. To top it off, surplus LCD`s can be found for a dollar or less. The most popular LCD interface is the Hitachi 44780 based LCD controller chip which provides a fairly easy to work with interface and low power consumption. The major drawback of the interface is the perceived complexity of working with the interface. This perception has been promoted by the lack of good (i. e. well translated) and accurate datasheets and web site information. Often the biggest stumbling block to using alphanumeric LCD displays is the number of pins required to control them.

For the Hitachi 44780, twelve pins are required from the microcontroller to interface to the display for it to work in eight bit mode. For many smaller microcontrollers, twelve pins are not available or will be better served in the application.

To be fair, this can be reduced to six by using the 44780`s "Four Bit" mode, but this can still be more than acceptable for most applications. A popular solution that only requires one pin from the microcontroller to the LCD is the use of "Serial LCD Interfaces" to the data and signals necessary for the Hitachi 44780 controllers.

Many of these products (such as the SLI-OEM) are excellent and can provide useful product interface and debugging information. The only drawback to them is the need for properly timed NRZ serial data which may be difficult or even impossible to guarantee in some applications.

In this case, different approaches have to be made. The most popular one is to use synchronous serial data (requiring a "clock" and "data") pin to load a serial-in/parallel-out shift register with the data bits and "R/S" pin information. The "E" Strobe Pin is driven directly by the microcontroller to latch in the data from the LCD. This is shown in the diagram below: The project presented in this article is an enhancement of this circuit.

By combining the shift register`s "Data Line" with the most significant bit of the shift register, the "E" Strobe can be implemented without resorting to a separate line for the function. The 1 K resistor and diode act as an "AND" gate. A schematic of the circuit is shown below. The operation of the resistor/diode "AND" gate may not be immediately obvious. When the shift register bit is low, the diode pulls the connection to the "E" pin low. When the shift register bit is high, the diode will not cause any current flow from the connection at the "E" pin to the shift register.

The resistor from "Data" to the "E" pin is a current limiting resistor. When the shift register bit is low and the data bit is high, then the current through the resistor will be limited to 5 mA (for a 5 Volt logic application). At the "Data" side of the resistor, the voltage will still be high, even though the diode is pulling the "E" pin low.

When both the "Data" line and the shift register bit are high, the "E" pin will be high. The "AND" circuit could be a TTL two input AND gate (such as a 7408), if you have an extra one available for your application. When I originally created this circuit, I used the same two transistor and two resistor circuit that I used for the 89C2051 emulator in "Programming and Customizing the 8051 Microcontroller".

I saw this "AND" equivalent circuit in an old copy of "Electronics Now" and found that it worked well in this application. To load the shift register, it first has to be cleared to ensure that the "E" will not be strobed to the LCD inadvertently.

This is done by first shift 🔗 External reference




Warning: include(partials/cookie-banner.php): Failed to open stream: Permission denied in /var/www/html/nextgr/view-circuit.php on line 713

Warning: include(): Failed opening 'partials/cookie-banner.php' for inclusion (include_path='.:/usr/share/php') in /var/www/html/nextgr/view-circuit.php on line 713