Please update your Flash Player to view content.

                  FOLLOW  US





 
 
LCD Interfacing To 8051 in 8 bit mode
Code Library - 8051 Assembly

Liquid Crystal Display also called as LCD is very helpful in providing user interface as well as for debugging purpose. The most common type of LCD controller is HITACHI 44780 which provides a simple interface between the controller & an LCD. These LCD's are very simple to interface with the controller as well as are cost effective.

The LCD requires 3 control lines (RS, R/W & EN) & 8 (or 4) data lines. The number on data lines depends on the mode of operation. If operated in 8-bit mode then 8 data lines plus 3 control lines i.e. total 11 lines are required. Here is a program for interfacing a LCD through 8051 in 8 bit mode.

The three control lines are RS, RW & Enable.

     RS: Register Select. When RS = 0 the command register is selected. When RS=1 the data register is selected.

     RW: Read or Write. When RW=0 write to LCD. When RW=1 read from LCD.

     Enable: Used to Latch data into the LCD. A HIGH TO LOW edge latches the data into the LCD.

 

LCD_Interfacing_to_8051
LCD Interfacing to 8051

 

In this program the controller checks the busy flag & waits till the LCD is busy. 

 

     
LCD_RS BIT P2.5
    LCD_RW BIT P2.6
CD_E BIT P2.7
LCD_pORT EQU P0
          

ORG 0000h

mov a,#38h           

call lcd_command 

mov a,#06h

call lcd_command

mov a,#0ch

call lcd_command

mov a,#01h

call lcd_command

mov a,#86h

         call lcd_command //1st line 6th character
mov a,#'D'

call lcd_datadisplay

mov a,#'N'

call lcd_datadisplay

mov a,#'A'

call lcd_datadisplay

mov a,#0c3h

call lcd_command //2nd Line 3rd character
mov a,#'T'

call lcd_datadisplay

mov a,#'E'

call lcd_datadisplay

mov a,#'C'

call lcd_datadisplay

mov a,#'H'

call lcd_datadisplay

mov a,#'N'

call lcd_datadisplay

mov a,#'O'

call lcd_datadisplay

mov a,#'L'

call lcd_datadisplay

mov a,#'O'

call lcd_datadisplay

mov a,#'G'

call lcd_datadisplay

mov a,#'Y'

call lcd_datadisplay

/*

Sends whatever data is in the Acc to the LCD as a Command

*/

lcd_command:
call lcd_ready //waits till the LCD is ready
mov LCD_PORT,a
clr LCD_RW //we are writing to LCD so RW=0
clr LCD_RS //Data we are sending is a command so RS=0
setb LCD_E
clr LCD_E //LATCH data onto LCD
ret

/*

 Sends whatever data is in the Acc to the LCD to be displayed

*/

lcd_datadisplay:
call lcd_ready //waits till the LCD is ready
mov LCD_PORT,a
clr LCD_RW //we are writing to LCD so RW=0
setb LCD_RS //Data we are sending is a command so RS=0
setb LCD_E
clr LCD_E //LATCH data onto LCD
ret

/*

This subroutine checks the busy flag & waits till LCD is ready to ready for next instruction

*/

lcd_ready:

mov LCD_PORT,#0ffh

clr LCD_RS

setb LCD_RW //we are reading from LCD so RW=1
l1_lcd_ready:

clr LCD_E

setb LCD_E

jb LCD_PORT.7,

clr LCD_E

ret

END

.

 

Add comment


Security code
Refresh

 

Featured Products

Rs1 800.00

Rs800.00
Rs720.00
You Save: 10.00%

 

Random Products

Rs12.00





Rs24.00



Rs150.00



Rs25.00



Latest Video

Random Articles

Search Products

User Login






 
 
.
 TUTORIALS
.
  8051 Tutorial
 
  Power Supply
 
CODE LIBRARY
.

  8051 Assembly
 
  C Code Library

.
 PROJECTS
.
  Project List
 
  Synopsis and Abstract
 
DOWNLOADS
.

  Datasheets
 
  Download

.
 POPULAR
.
  About Us
 
  DNA Shop
 
  Totorial
 
  Code Library
 
  Download
 

.
 CONTACT US
.

Mr. Amol Shah

DNA Technology Nashik,

Maharashtra 422009 India

Phone : 0253-3023939

Mobile : 09225145135

Email : contact@dnatechindia.com