LCD MODULE TECHNICAL REFERENCE
Author: Christopher J. Burian
Subject: LCD [technical] FAQ
Version: 40B
Date: September 1996
E-mail: cburian@ll.mit.edu
The LCD MODULE TECHNICAL REFERENCE (FAQ) was compiled and is maintained by Christopher J. Burian. References and other contributors are listed below.
Last change: Version 40 released in May 1996. Various minor changes made in 40a and 40b. Last revision: September 1996.
Errata, comments, and suggestions are most welcome.
My gratitude to correspondents and contributors Chris Abbott, Richard N. Ames, Magnus Andersson, Ronald S. Chong, Scott Dattalo, John Edwards, Doug Girling, Filip Gieszczykiewicz, Frank Hausmann, John Payson, Robert Rolf, Philipp Schaeufele, J. R. Spidell, Frank Vorstenbosch, Steve Walz, and Brian Wing.
Special thanks and my apologies to any correspondents or contributors whom I might have failed to mention.
Copyright 1996 by Christopher J. Burian. All rights reserved. Permission is granted to electronically distribute and reproduce this article in unaltered form provided that it is given free of charge (reasonable connection fees allowed). Written reproduction of this article in whole or in part without the express permission of the author is prohibited (printouts made for personal use excepted).
Trademarks and service marks appearing in this FAQ are the property of their respective owners.
Use this information at your own risk. Contributors cannot be responsible for damage or losses resulting from errors or omissions in this work. Every effort has been made to verify its accuracy.
References used to generate this version:
My favorite references are the Optrex databook for dot matrix modules, available from Digikey for $2, and the Amateur Robotics column in the June '94 issue of Nuts & Volts magazine, 430 Princeland Court, Corona, CA 91719.
The most recent version is always available from:
ftp://ftp.armory.com/pub/user/rstevew/LCD/
lcdfaq.txt -- faq table of contents lcdfaq.zip -- the latest version of the faq contents: lcdfaq40.txt, chset.gif
http://www.repairfaq.org/filipg/LINK/F_LCD_menu.html
This FAQ and many other FAQs and links related to LCDs.
I originally wrote this frustrated by the terse and cryptic datasheets manufacturers supply. I refer to it more often than I write to it. I hope engineers, hobbyists, students and experimenters find it helpful.
_
W == ~W
This makes it easier to format for all browsers and text prints.
LCDs are manufactured by quite a few different companies. Units typically seen in the surplus market come from Densitron, Epson, Hewlett Packard, Optrex, or Sharp. Common configurations are 16, 20, 24, 32, or 40 characters by 1, 2, or 4 lines.
I've been loose with the term LCD here. One can find LCDs at any level of integration from what looks like a glass slide and will need drivers and controller, to a PCB that includes the row and column drivers, to the modules I'm actually talking about which also include an on-board controller (usually a Hitachi HD44780). I'd recommend staying away from modules that do not say they have a controller or otherwise indicate that it's included, such as by describing the character set or noting an ASCII interface. The units to look for are usually called character-type dot matrix LCD modules.
This article applies only to character-based LCD modules with Hitachi 44780 or equivalent controllers. I have a compatible LCD module made by Epson. The chips don't have any identifying marks, but they are probably made by Seiko or SMOS. The protocol and pinout are identical, but the non-ASCII characters (>127) are different.
All of the modules I've seen use the Hitachi controller, or a functional equivalent or near equivalent. Each of these use the same interface and memory map. The character set is almost always the same with a mixture of English and Japanese characters, but models with different character sets turn up in the surplus market, for instance, substituting Latin and German characters for Japanese characters.
Also found are modules with extra segments--fixed numbers or words arranged around the dot matrix display area for extra functions. To the controller, these extra segments look just like an additional 5x7 dot box (each segment (word, digit, etc.) corresponds to one dot) and can be driven by defining custom characters with appropriate bit patterns to energize these special segments as desired.
Experimenters interested in graphical LCD displays can find units with and without onboard controllers. Those without controllers are more common and are often called "serial interface" graphical LCDs. Units without controllers must be refreshed continually, consuming a great deal of processor time if an external controller isn't added. Units with built-in controllers have onboard video RAM, automatic refresh, and character and graphics commands. An introduction to making your own external controller based on an FPGA appears in the form of a class assignment at: http://www.ece.uiuc.edu:80/ece311/mp4.html This article doesn't discuss graphical type modules.
If you're interested in the basic principles behind operation of Liquid Crystal Displays, take a look at Scott M. Bruck's LCD FAQ, which is available from ftp.ee.ualberta.ca as the file /pub/cookbook/faq/LCD2.doc Since his FAQ came first, I've changed the name of this one to the LCD MODULE TECHNICAL REFERENCE (FAQ).
These are the sources in the USA I've seen that are most accessible to the hobbyist. If you know of more, please email me.
In the UK:
In Canada:
These numbers are the same no matter the physical arrangement of the pins, (for instance, a row along the top on Optrex units, or a 2x7 .100" center array on the side of Sharp units) on 14-pin units. A reader has noted modules with only 10 pins--designed to be used with 4-bit wide data only.
Pin# Symbol Level Function ==== ====== ===== ================================================== 1 Vss GND Ground 2 Vcc +5V Module power 3 Vee note1 Liquid crystal drive 4 RS H/L Register select, H=data, L=instruction 5 R/~W H/L Read/Write, H=read (LCD->CPU), L=write (CPU->LCD) 6 E note2 Edge-sensitive Enable 7 DB0 note3 Data bit 0 (least significant bit) 8 DB1 " 9 DB2 " 10 DB3 " 11 DB4 " 12 DB5 " 13 DB6 " 14 DB7 "
Backlight drive: If the module has a back light, it will be driven by a pair of pads separate from the interface pads. Check your datasheet for power requirements.
NOTE1: On standard modules Vee is between GND and 5V; on temperature extended modules it is between GND and -7V. A potentiometer, resistor arrangement, or resistor-diode arrangement is used for contrast adjustment. Wiring examples for using a potentiometer are shown here.
Standard:
+5V ------------*----------- Vcc
|
/
10k to \<---------- Vee
20k pot /
\
|
GND ------------*----------- Vss
Temperature extended model:
+5V ------------------------ Vcc
GND ------------*----------- Vss
|
/
10k to \<---------- Vee
20k pot /
\
|
-7V ------------'
Extended temperature types may also employ temperature correction circuitry to provide automatic contrast adjustment.
For operation over a narrow temperature range (such as always indoors), a pair of resistors can be substituted for the potentiometer. At first, try a 10Kohm resistor between Vcc and Vee, and a 330ohm resistor between Vee and Vss (ground), and adjust from there for optimum contrast. Also, a forward-biased diode is sometimes used between Vee and Vss, instead of the low-ohm resistor.
For testing purposes, Vee can be tied to ground, but the digits will be invisible at the normal perpendicular viewing angle. Tilt the display until your view is almost in the plane and the display will be faintly readable.
NOTE2: Enable latches RS and R/W on the rising edge and clocks data on the trailing edge. According to specs, RS and R/W must be stable before E goes high and must remain stable until E goes low (observing setup and hold times). Data must be stable while E goes low (again, observing setup and hold times).
NOTE3: The data pins DB7-DB0 (or DB7-DB4 when using a 4-bit interface) need to be driven by the CPU for a write, but must be switched to hi-Z (or pulled up with pull-up resistors only) so the module can drive the lines on a read or BUSY FLAG check.
When using a 4-bit wide interface, the most significant nybble is written first (bit7-bit4), then the least significant nybble is written (bit3-bit0) on the next Enable cycle. DB3 to DB0 are left unconnected. The pins have internal pullups, so unused pins can be left unconnected, but I don't know whether the pullups are sufficient to use open collector drivers. The pullup resistors may be too high resistance to overcome line capacitance at high speeds.
Power consumption: Modules use between 10 and 25mW (2 to 5 mA), not counting the backlight, roughly proportional to the product of rows and columns.
Be careful when hooking power to the module. Reversing +5V and GND will destroy the unit. Carefully examine your datasheet to correctly identify Pins 1 and 2. On the 2x7 pin units, pins 1 & 2 (on the bottom) are paired, up through 13 & 14 at the top.