Dave Horner's Website - Yet another perspective on things...
Home Tech Talk Programming Interfacing an LCD to an 8051.
82 guests
Rough Hits : 2954419
moon and stars
how did u find my site?

onomastics (seen in code)

"Mediocrity knows nothing higher than itself; but talent instantly recognizes genius.”
- Sir Arthur Conan Doyle

Interfacing an LCD to an 8051.

Tuesday, 03 January 2006 00:24
LCDs are high up on the list of things to interface to because they provide a great way to debug your program and to display results to the outside world.  Interfacing an LCD to a microcontroller can be a bit confusing if you haven't done it before.  However, with a little work and determination you'll have your microcontroller yelling "Hello World" in no time.

For this paper, I'll be interfacing directly to a HD44780 LCD controller.  These LCDs are the most popular and easiest to procure.  In fact, most text based LCDs are based on this chip.  The HD44780 takes care of all the low level details when it comes to driving the LCD, you simply speak to the HD44780 and it takes care of the rest.  There are many manufacterers but the main players are Hitachi, Sharp, and Optrex.  If you are looking for a source for these LCDs goto ebay and search for "hd44780 lcd" or look in any electronic component supplier's catalogs.

Specifically, I'll be using a Sharp LM40X21A LCD.  This is a Hitachi HD44780 (wikipedia) based LCD with 2x20 characters (meaning two lines with twenty characters in each).  First thing you'll want to do when you get your LCD board is look up the pin outs so that you understand where each of the singaling pins reside.  I've saved a copy of the LM40X21A datasheets here.

LCDs are typically very slow when compared to modern day microcontrollers so you'll need to make sure that you have your timing right.  Otherwise, nothing will work. (again, if you have trouble, think timing)

The HD44780A supports both an 8 bit and 4 bit interface.  The 4 bit mode is essentially the same as the 8 bit mode but data transfers between the mcu and LCD controller are done in two cycles, a nibble (4 bits ) at a time.  In the 4 bit mode data is transferred using lines BD7-DB4 lines DB3-DB0 are not used. The high order bit contents are transferred first (DB7-DB4) and then the low order (BD3-DB0).  The 4-bit mode is useful when you are "low" on I/O lines, but I'm not "low" on I/O lines so I'll be controlling the LCD in the 8 bit mode.

Application Note 161: Interface and Simulation of an LCD Text Display - Keil app note
Embedded Microcontroller Programming: LCD interfacing - SDCC
Serial LCD Interface  - some information
Yet another 8051 to LCD program - C code for the Keil compiler
8051 LCD Keil
SDCC LCD Project
Driving an HD44780 based display - Silicon Labs C8051F005 includes custom characters - 3 frame pacman and smile face.
8051 Development System Circuit Board
HD44780 Controlled LCD - joshuagalloway's page on hd44780
The Life of Kenneth: HD44780 Command Codes
The Life of Kenneth: No Name LCD - just so happens to be the no name lcd I'm working with! U can find these very cheap on ebay.
The Life of Kenneth: Conway's Game of Life on an Arduino
3-Wire Serial LCD using a Shift Register

Microcontroller Projects: 16x2 Char LCD with TI MSP430 Launch Pad
Microcontroller Projects: Custom Character Generations on 16x2 char lcd
Microcontroller Projects: HD44780 16x2 Char LCD Interfacing with microcontroller

Nokia 5110 LCD

PCD8544 controller - 48 ´ 84 pixels monochrome matrix LCD 2.7 to 3.3 V
contrast is digitally controlled and 4 white LEDs behind the LCD provide a backlight.
NU32v2: Nokia 5110 LCD - Northwestern Mechatronics Wiki
Nokia 5110 display - Projects - 43oh - RobG's LCD library.
bad apple - simpleavr
LCD_5110_LM4F120 sample "Sketch" (Stellarpad Energia branch) - Energia - Stellaris Arm Community Forums
adafruit learning nokia 5110/3310 Tutorial PDF

< Prev  Next >
Last Updated on Thursday, 16 May 2013 17:37