Examples:

Interfacing LCD to 8951
Here Data pins D0-D7 are connected to port1.0-port1.7 of 8951 microcontroller. Enable pin, RS are connected to P3.3 and P3.4 of 8951 respectively.
We can write program for LCD in two ways.
1. Program to display “ELECTROFRIENDS” in LCD without checking busy flag.
MOV A,#38H ; initialization LCD 2lines, 5×7 matrix.
ACALL COMMAND ; call command subroutine.
ACALL DELAY ; call delay subroutine.
MOV A,#0EH ; display on, cursor on
ACALL COMMAND
ACALL DELAY
MOV A,#01H ; Clear LCD
ACALL COMMAND
ACALL DELAY
MOV A,#06H ; shift cursor right
ACALL COMMAND
ACALL DELAY
MOV A,#80H ; cursor at beginning of 1st line
ACALL COMMAND
ACALL DELAY
MOV A,#’E' ; display letter E
ACALL DATA
ACALL DELAY
MOV A,#’L' ; display letter L
ACALL DATA
ACALL DELAY
MOV A,#’E' ; display letter E
ACALL DATA
ACALL DELAY
MOV A,#’C' ; display letter C
ACALL DATA
ACALL DELAY
MOV A,#’T' ; display letter T
ACALL DATA
ACALL DELAY
MOV A,#’R' ; display letter R
ACALL DATA
ACALL DELAY
MOV A,#’O' ; display letter O
ACALL DATA
ACALL DELAY
MOV A,#’F' ; display letter F
ACALL DATA
ACALL DELAY
MOV A,#’R' ; display letter R
ACALL DATA
ACALL DELAY
MOV A,#’I' ; display letter I
ACALL DATA
ACALL DELAY
MOV A,#’E' ; display letter E
ACALL DATA
ACALL DELAY
MOV A,#’N' ; display letter N
ACALL DATA
ACALL DELAY
MOV A,#’D' ; display letter D
ACALL DATA
ACALL DELAY
MOV A,#’S' ; display letter S
ACALL DATA
ACALL DELAY
HERE: JMP HERE
COMMAND: MOV P1,A ; Send command to LCD
CLR P3.4 ; RS=0 for command
CLR P3.5 ; R/W=0 for write
SETB P3.3 ; E=1 for high pulse
CLR P3.3 ; E=0 for H-to-L pulse
RET
DATA: MOV P1,A ; Write data to LCD
SETB P3.4 ; RS=1 for data
CLR P3.5 ; R/W=0 for write
SETB P3.3 ; E=1 for high pulse
CLR P3.3 ; E=0 for H-to-L pulse
RET
DELAY: MOV R2,#50
D1: MOV R3,#0FFH
D2: DJNZ R3,D2
DJNZ R2,D1
RET
2. Program to display “ELECTROFRIENDS” in LCD with checking busy flag.
MOV A,#38H ; initialization LCD 2lines, 5×7 matrix.
ACALL COMMAND ; call command subroutine.
MOV A,#0EH ; display on, cursor on
ACALL COMMAND
MOV A,#01H ; Clear LCD
ACALL COMMAND
MOV A,#06H ; shift cursor right
ACALL COMMAND
MOV A,#80H ; cursor at beginning of 1st line
ACALL COMMAND
MOV A,#’E' ; display letter E
ACALL DATA
MOV A,#’L' ; display letter L
ACALL DATA
MOV A,#’E' ; display letter E
ACALL DATA
MOV A,#’C' ; display letter C
ACALL DATA
MOV A,#’T' ; display letter T
ACALL DATA
MOV A,#’R' ; display letter R
ACALL DATA
MOV A,#’O' ; display letter O
ACALL DATA
MOV A,#’F' ; display letter F
ACALL DATA
MOV A,#’R' ; display letter R
ACALL DATA
MOV A,#’I' ; display letter I
ACALL DATA
MOV A,#’E' ; display letter E
ACALL DATA
MOV A,#’N' ; display letter N
ACALL DATA
MOV A,#’D' ; display letter D
ACALL DATA
MOV A,#’S' ; display letter S
ACALL DATA
HERE: JMP HERE
COMMAND: CALL READY ; check whether LCD is ready
MOV P1,A ; Send command to LCD
CLR P3.4 ; RS=0 for command
CLR P3.5 ; R/W=0 for write
SETB P3.3 ; E=1 for high pulse
CLR P3.3 ; E=0 for H-to-L pulse
RET
DATA: CALL READY ; check whether LCD is ready
MOV P1,A ; Write data to LCD
SETB P3.4 ; RS=1 for data
CLR P3.5 ; R/W=0 for write
SETB P3.3 ; E=1 for high pulse
CLR P3.3 ; E=0 for H-to-L pulse
RET
READY: SETB P1.7 ; make P1.7 input port
CLR P3.4 ; RS=0
SETB P3.5 ; R/W=0 for read
UP: SETB P3.3 ; E=1 for high pulse
CLR P3.3 ; E=0 for H-to-L pulse
JB P1.7, UP ; stay until LCD is busy
RET
Pages: 1 2
Description :
This is the one stop educational site for all Electronic and Computer students. If you want to learn something new then we are here to help. We work on Microcontroller projects, Basic Electronics, Digital electronics, Computer projects and also in basic c/c++ programs.
#Home #Sitemap #Submit #Terms of Use
Copyright©2011 electrofriends.com All Rights Reserved
Contact:info@electrofriends.com | Powered by Dhyeya
April 21st, 2009 at 8:50 pm
Can i get more detail about it
July 12th, 2009 at 10:18 pm
good one…. nice!!!!!!!!1
October 11th, 2009 at 10:24 am
This is a tutorial on alphanumeric 16×2 lcd interfacing with AT89C51.The programming algorithm is compatible with HITACHI HD44780U lcd controller .Complete programming code is given with neat circuit diagram.
November 30th, 2009 at 9:53 pm
Hi there, I just found this website whilst searching around the Internet as I am looking for some info on LCD TVs!. It’s an informative blog so I have bookmarked your site and I intend to return tomorrow to enjoy a proper read when I have more time.
February 10th, 2010 at 12:54 am
please send me more details about microcontroller 8951
May 8th, 2010 at 1:57 pm
thx alot im elahe ,student of electronic engineering i use it for my project of 8051
January 30th, 2011 at 3:02 pm
Dear sir,
Thanks for posting the project.
i am running through the last semester. Would you please provide us the complete circuit diagram of this project?
February 2nd, 2011 at 11:19 pm
the complete circuit diagram of this project would be really helpful, thank u
February 11th, 2011 at 6:11 pm
i want the interfacing circuit of lcd and adc 0804 for 89c51 microprocessor
February 14th, 2011 at 2:10 pm
how to produce backlight in 2×16 lcd display
July 8th, 2011 at 6:26 pm
hi i want to know how to deal with 8951
August 25th, 2011 at 7:35 pm
I am in my final year computer engineering, thanks the project has helped me in my final year project
October 4th, 2011 at 4:34 pm
I want the circuit & layout of the lcd interfacing with 89v51 microcontroller.
October 12th, 2011 at 11:45 am
i want some idea of the lcd coding in embedded c….
October 18th, 2011 at 11:41 am
I need more embedded kind of projects….
December 8th, 2011 at 12:13 pm
hai i want 8051 interfacing with lcd source code could u tell me