logo

Loading...
  • Home
  • Categories
  • Manufacturers
  • Products
  • PROJECTS
  • TUTORIAL
  • CODE LIBRARY
  • Blogs
  • Contact us
  1. Home
  2. Blogs
  3. LCD Interfacing To 8051 in 8 bit mode

LCD Interfacing To 8051 in 8 bit mode

17 July 2011
3 min read
11039 views

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

.

Back
newsletter image

Join our mailing list

Get bits and bytes of noise free Information

*No Noise(spam) only Information

Get In Touch

Office

DNA Solutions, Flat no 1, Raja Jeet Recidency, p no 61 Sr no 102, Wadala Shivar Indira nagar, Nashik, 422009, Maharashtra, India

Shop

FH11-12, Thakker Bazar NEW CBS, Nashik, 422002, Maharashtra, India

Got Questions? Call us at

Neha (Rest of India): 7972667515, 8412906903

Prachi (Nashik): 8669102120

site@example.com

Information

  • FAQs
  • About Us
  • Shipping & Delivery
  • Returns & Cancellation
  • Privacy Policy
  • Payment Information
  • Terms & Conditions
  • Contact us
  • Products
  • Blogs
Cities Cover

Shivaji Nagar | Namrup | Thane | Pilani | Ballia | Darbhanga | Kannur | Junagadh | Jaisalmer | Jamshedpur | Itanagar | Amravati | Navi Mumbai | Durgapur | Dahod | Pimpri | Madurai | Agra | Mangalore | Kalyan | Port Blair | Davangere | Kochi | Pondicherry | Mathura | Kalyan | Raigad | Thane | Nagpur | Bhubaneswar

*Note : We provide GST Tax Bill for claiming Tax Input Credit. GST bill will be provided in the name of DNA Solutions (GST No: 27BGPPS9522M1ZF) or DNA Solutions Private Limited (GST No: 27AAFCE7605R1Z).

COPYRIGHT © 2026 DNA Solutions, INDIA . ALL RIGHTS RESERVED.

footer-logos