Skip to main content

HD44780 Character LCD Displays – Part 1

Introduction

LCD character displays can be found in espresso machines, laser printers, children’s toys and maybe even the odd toaster. The Hitachi HD44780 controller has become an industry standard for these types of displays. This tutorial will teach you the basics of interfacing with a HD44780 compatible display using some DIP switches and a few other components.

Pinout

The module that we are using is a 16 character x 2 line display that we stock over here. It uses an ST7065C controller, which is HD44780 compatible. The figure below shows the LCD module and pinout.

LCD Pinout

The last 2 pins (15 & 16) are optional and are only used if the display has a backlight.

The circuit diagram below shows the LCD module with the basic “plumbing” wired up. You will notice that pin 5 (RW) is tied to ground. This pin is use to control whether you are reading or writing to the display. Since reading from the display is very rare, most people just tie this pin to ground.

The potentiometer connected to pin 3 controls the LCD contrast.

Controlling the contrast on an LCD Displays

Sending Data and Commands

Data and commands are sent to the module using the 8 data lines (pins 7-14) and the RS line (pin 4). The RS lines tells the module whether the 8 data bits relate to data or a command. The data/command is read on the falling edge of the enable line (pin 6). This means that when enable transitions from high to low, the values of D0 to D7 and RS are read.

So to send data or a command to the display, you need to

  1. Set Enable to high
  2. Set RS and D0-D7 desired values
  3. Set Enable to low

There are minimum wait times between these operations, but I won’t go into them here. You can look these up in the LCD Module Datasheet. (look at the timing diagrams on page 4)

HD44780 based display modules also have a 4 bit interface mode. Under this mode the data or command is transferred to the module using 2, 4 bit nibbles. This will be discussed in more detail below.

Instructions and Characters

The tables below show the instruction set and character table. Click on a table to get a larger view.

HD44780 Instructions
HD44780 Instructions

Assembling the Circuit

Normally you would drive an LCD display from a microcontroller, computer or similar device. For this exercise we will use just a series of switches. This cuts the interface to the absolute bare essentials.

The circuit being built is shown below.

Circuit Diagram

The photo below shows the circuit, on a breadboard without the LCD module. I’ve also added a small L7805 based power supply on the right hand side of the board. You can get the parts for the power supply here.

The Register Select and data lines are pulled down using a 10K resistor and when the dip switch is closed, those lines go high. The enable line on the other hand is pulled high and when the button is pressed, the line goes to ground. The enable button has a 10nF capacitor to de-bounce it.

Circuit onBreadboard

Before inserting the LCD module into the breadboard, you will need to solder a row of 16 pin single row headers. This is shown in the photo below.

LCD Display with Header

Next we insert the LCD module into the breadboard and power it on. When you insert the module into the breadboard, you need to be gentle and work the pins in slowly because the pins are a bit thicker than you would normally use with a breadboard.

If you don’t see the pattern shown below, you will need to turn the contrast pot till you do. This pattern is the default pattern for an uninitialized LCD display.

Default Pattern on LCD Display

Interfacing via the 8 bit mode

To interface to the display and output text we need to

  1. Initialise the display,
  2. Set entry mode, and
  3. Send a sequence of characters to display

So to output the text “Hello World” we need to power up the device then enter the following sequence of Data/Commands, pressing Enable at the end of each Data/Command block.

RS D7 to D0 Description
0 0 0 1 1 – 1 0 0 0 Function set, 8 bit, 2 lines, 5×7
0 0 0 0 0 – 1 1 1 1 Display ON, Cursor On, Cursor Blinking
0 0 0 0 0 – 0 1 1 0 Entry Mode, Increment cursor position, No display shift
1 0 1 0 0 – 1 0 0 0 H
1 0 1 1 0 – 0 1 0 1 e
1 0 1 1 0 – 1 1 0 0 l
1 0 1 1 0 – 1 1 0 0 l
1 0 1 1 0 – 1 1 1 1 o
1 0 0 1 0 – 0 0 0 0 space
1 0 1 0 1 – 0 1 1 1 w
1 0 1 1 0 – 1 1 1 1 o
1 0 1 1 1 – 0 0 1 0 r
1 0 1 1 0 – 1 1 0 0 l
1 0 1 1 0 – 0 1 0 0 d

Interfacing via the 4 bit mode

The main benefit of the 4 bit mode is that less data lines are required. In this mode D3 to D0 are tied to ground and data/commands are transferred 1, 4 bit nibble at a time.

RS D7 to D0 Description
0 0 0 1 0 – 0 0 0 0 Set to 4 bit operation (note: 1 nibble operation)
0 0 0 1 0 – 0 0 0 0 Function set, 8 bit
0 1 0 0 0 – 0 0 0 0 2nd nibble
0 0 0 0 0 – 0 0 0 0 Display ON, Cursor On, Cursor Blinking
0 1 1 1 1 – 0 0 0 0 2nd nibble
0 0 0 0 0 – 0 0 0 0 Entry Mode, Increment cursor position, No display shift
0 0 1 1 0 – 0 0 0 0 2nd nibble
1 0 1 0 0 – 0 0 0 0 H
1 1 0 0 0 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 e
1 0 1 0 1 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 l
1 1 1 0 0 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 l
1 1 1 0 0 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 o
1 1 1 1 1 – 0 0 0 0 2nd nibble
1 0 0 1 0 – 0 0 0 0 space
1 0 0 0 0 – 0 0 0 0 2nd nibble
1 0 1 0 1 – 0 0 0 0 w
1 0 1 1 1 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 o
1 1 1 1 1 – 0 0 0 0 2nd nibble
1 0 1 1 1 – 0 0 0 0 r
1 0 0 1 0 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 l
1 1 1 0 0 – 0 0 0 0 2nd nibble
1 0 1 1 0 – 0 0 0 0 d
1 0 1 0 0 – 0 0 0 0 2nd nibble

That’s about as easy as it gets!

In the next part we will discuss how to hookup the module to a microcontroller and get it to do the hard work for you.

Related News

Board Stacking 101

Board Stacking – 101

Board stacking is simply the process of taking 2 or more prototyping boards and fixing...

AVR Memory Architecture

AVR Memory Architecture

The AVR family of microcontrollers use a modified Harvard Architecture which uses 3 types of...

ATmega168 Pulse Width Modulation - PWM

ATmega168A Pulse Width Modulation – PWM

Dimming an incandescent bulb is easy. Simply adjust the current down using a potentiometer and...

16 Comments

  1. haren

    Hi
    is lcd initialization same for all lcds available on the market?
    because im not using the hitachi one you are talking about im using qp-5515 from jaycar.
    thanks heaps

  2. raine001@tc.umn.edu

    there is a data sheet for the qp-5515 here http://www.jaycar.com.au/products_uploaded/QP-5515.pdf
    it looks like a clone of the hd44780 and initialization is the same.

    The data sheet does not say much about the contrast voltage; there are a few (mostly older, I think) displays that need a negative contrast voltage. the circuit described above would not produce the rectangular blocks shown on those displays.

  3. mujtaba

    i m using ic numbered ec016002
    vybbl1 and i m not getting its data sheet

  4. kiranvarma-npeducations

    Really nice about LCD interfacing! its a very neat and clean explanation. thank you for HD quality images feels good while reading the article.

  5. Rudolf

    This is an excellent explanation of this type LCD’s functionality and first class
    combination of text and images. Thank you for these pages.

  6. Charlie Mo

    Awesome job. Very polished and articulate presentation. Do you have more ? I’d love to see them.

  7. Steve

    Really clear and comprehensive write-up, thanks.

    I recently started with Arduino and had a successful play with a 20×4 LCD. Last night I dismantled an old Lexmark printer scanner and, along with a couple of small stepper motors, found an EC016002 LCD. A web surf for info on the LCD brought me here.

    This is an excellent approach to operate the device with switches first. I’m really looking forward to working through this tonight.

    Thanks again.

  8. Somnath Das

    Sir / Madam

    My thanks and gratitude for such an excellent explanation of how 16 char LCDs work which even I can understand.
    Regards

  9. Ryan O'Connor

    Really helpful thanks! I love the quality of your photos too. I’ll be ordering an lcd and some parts from you soon.

  10. lcd recycle

    Selling
    your cracked, damaged and broken LCD screens is essential to staying
    competitive in the cell phone repair business. Not
    only do we BUY and SELL broken LCDs, we also offer a LCD swapping service. We
    Buy Your Cracked, Damaged and Broken LCD Screens…

  11. William Gallant

    Much easier to understand than most other sites. Very nice job with the overall presentation. Thank You. I’m just starting my first steps in this direction.

  12. Kiet

    This is a lot easier to understand than reading the datasheet, thanks for taking time to write this article.

  13. Vincent van Rooijen

    This is the introductory tutorial I was looking for. Will now try it with a microcontroller.
    Had hard time getting this to work on other sites.
    I had to set VE to ground to see enough contrast and voltage to about 3.3V to see the letters
    Thanks!

  14. Rivadavia

    Excelent! I build the circuit in a very poor way because lack of the dip switch and even so in a step by step way…it works!!! Thank you.

Leave a reply

Shopping Cart