Interface LCD with ease

Bharat Mehta, Space Applications Center, Ahmedabad, India -- 4/27/2000

Alphanumeric LCDs find use in various embedded systems. In these systems, µCs often lack I/O resources, so you must make optimum use of the available resources. LCDs have a bus-oriented interfacing structure, which consumes 11 I/O lines (eight data lines and three control lines). You cannot always afford to spare this many I/O lines. Most applications need to write the data to the LCD and then read from it. In these situations, you can omit one control pin (of three) for reading data and save one additional I/O-port pin. The circuit in Figure 1 saves I/O pins. It uses an 8051 µC, and only four I/O pins (P1.0 to P1.3) drive the LCD, instead of the 11 pins other displays require. Data transfers in a serial mode through the P1.0 port of the µC. The µC interfaces to Pin 2 of IC1, a 74HCT4094 8-bit shift register. Serial data advances on every clock pulse and transfers to the shift register. The register converts the serial data to parallel data, available on the output pins Q0 to Q7. The P1.1 port of the µC provides the clock.

The data bus, D0 to D7, of the LCD module connects to the shift register's outputs. Software carries out the data transformation and displays the result on the LCD (Listing 1). The same design can drive various types of alphanumeric LCDs-for example, single-line-to-multiline types, with different charcter lengths on each line. You can configure the circuit to send data over a long distance for remote LCD readouts (Figure 2). You can transmit serial data through a differential line-driver IC such as the 26LS31 (IC1). You can feed the output of IC1 to either twisted-pair wires or a parallel pair of wires for transmission to a remote location. At the other end of the remote location, you can retrieve the data through a differential line receiver such as the 26LS32 (IC2). The output of IC2 drives IC3, which drives the LCD as in Figure 1.

Listing 1, written in 8051 assembly code, provides the sample text "Hello, EDN Reader" on a single-line, 16-character LCD. Click here to download Listing 1. (DI #2519)


ADVERTISEMENT

© 2009, Reed Business Information, a division of Reed Elsevier Inc. All Rights Reserved.