Lcd Interfacing

Only available on StudyMode
  • Topic: Data, Pixel, Display resolution
  • Pages : 8 (1550 words )
  • Download(s) : 56
  • Published : April 25, 2013
Open Document
Text Preview
TABLE OF CONTENTS

* LIST OF FIGURES
* LIST OF FIGURES
* LIST OF TABLES
* WORK PROGRESS REPORT
* EXPLANATION OF PROJECT
* PROGRAMS IN 8051
* SCHEMATICS OF PROJECT
* RESULTS & ANALYSIS
* CONCLUSION

LIST OF TABLES
* all pins of LCD module (JHD162A) along with their description. * commands supported by LCD module
* functions using C.
* Detailed function description

EXPLANATION OF PROJECT

LCD is tongue of embedded system. With help of LCD, embedded system can communicate their status to external world. Two types of LCD modules are available; text and graphical. In this tutorial we will cover text based modules. LCD module JHD162A is used as example here, however same instructions would also apply for controller HD44780 which is one of most commonly used module. This tutorial is divided into following sections: * Interfacing hardware

* Controlling with software
* Source code
1.Interfacing Hardware
Let’s start with connecting the LCD hardware with microcontroller (P89v51). The following table lists all pins of LCD module (JHD162A) along with their description.

Pin No| Name| Description|
1| Vss| Ground|
2| Vdd| +5V|
3| Vee| Contrast Adjustment -2V to -5V|
4| RS| Register Select|
5| RW| 1 -Read , 0- Write|
6| E| Enable Strobe|
7| D0| Data Line|
8| D1| Data Line|
9| D2| Data Line|
10| D3| Data Line|
11| D4| Data Line|
12| D5| Data Line|
13| D6| Data Line|
14| D7| Data Line|
15| LED+| Backlit LED +V  Vdd (Optional signal)|
16| LED-| Backlit LED –V  Vss (Optional signal)|

LCD Pin Description (JHD162A)

1.1 Connecting Supplies:

Vss (Pin 1) is connected to board ground
Vdd (Pin 2) is connected to + 5V supply
Vee (Pin 3) is connected using a variable resistance for adjusting contrast LED- (Pin 16) is connected to GND
LED+ (Pin 15) is connected to Vdd

1.2 Connecting control and data signals:

Control signal RS, RW and E are connected to IO Port pins.  For data lines we can have two configurations 8 bit mode and 4 bit mode. In 8 bit mode all lines D0-D7 are connected to IO port pins of microcontroller. In 4 bit mode only D4-D7 are connected to IO port pins. The example code available in source section(at bottom of this article) uses the 4 bit mode as default, however 8 bit mode is also supported.

Following images show both 8 bit and 4 bit configuration for interfacing LCD with P89v51 microcontroller.

2. Writing software:
The LCD module is an intelligent component. We communicate to LCD module by sending commands from microcontroller. To write data to LCD module separate sequence is followed for 4 bit and 8 bit mode.

Writing command for 8 Bit mode:
* Write 8 bit data on D0-D7
* Generate strobe by taking EN from high to low

Writing command for 4 Bit mode:
* Write 4 bit data (upper nibble) on D4-D7
* Generate strobe by taking EN from high to low
* Write 4 bit data (lower nibble) on D4-D7
* Generate strobe by taking EN from high to low
*

The following table lists commands supported by LCD module:
LCD Commands:
Instruction| RS| RW| D7| D6| D5| D4| D3| D2| D1| D0| Description| NOP| 0| 0| 0| 0| 0| 0| 0| 0| 0| 0| No Operation| Clear Display| 0| 0| 0| 0| 0| 0| 0| 0| 0| 1| Clear Display and Address counter = 0| Cursor Home| 0| 0| 0| 0| 0| 0| 0| 0| 1| x| Address counter = 0| Entry mode set| 0| 0| 0| 0| 0| 0| 0| 1| I/D| S| Set cursor direction(I/D) and auto display shift (S)| Display Control| 0| 0| 0| 0| 0| 0| 1| D| C| B| Turn display (D) and cursor (C) ON/OFF. Set cursor blinking(B)| Cursor/ Display shift| 0| 0| 0| 0| 0| 1| S| R/L| x| x| Shift display/cursor (S), specify direction (R/L)| Function set| 0| 0| 0| 0| 1| DL| N| F| x| x| Set Interface data width (DL), number of display lines (N), character font...
tracking img