Interfacing of LCD With 8051 Microcontroller in Proteus ISIS - The Engineering Projects PDF
Interfacing of LCD With 8051 Microcontroller in Proteus ISIS - The Engineering Projects PDF
Home / Blog / 8051 Microcontroller Projects / Interfacing of LCD with 8051 Microcontroller in Proteus ISIS
Posted at: Wednesday December 9, 2015 Category: 8051 Microcontroller Projects Author: Syed Zain Nasir 2 Comments
Download
Library Proteus 8 Proteus Libraries Schematic Diagram Proteus Software Proteus Programme
Hello friends, hope you all are fine and having fun with your lives. Today's post
today we are gonna have a look at Interfacing of LCD with 8051 Microcontroller. LCD is always the basic step 2K+ 3K+
towards learning embedded as it serves as a great debugging tool for engineering projects.
LCD is also used almost in every Engineering Project for displaying different values. For example, if you have used
the ATM machine, which you must have, then you have seen an LCD there displaying the options to select. Obviously
that's quite a big LCD but still LCD. Similarly, all mobile phones are also equipped with LCDs. The LCD we are gonna
use in this project is quite small and basic. It is normally known as the 16x2 LCD as it has rows and 2 columns for
writing purposes. So, we are gonna interface that LCD with 8051 Microcontroller. The proteus Simulation along with
hex file and the programming code in keil uvision 3 is given at the end of this post for download. If you are working
with Arduino, then you should have a look at Interfacing of LCD with Arduino. The next level from LCD is Graphical
LCD also known as GLCD, so if you wanna know more about that then you should read Interfacing of Arduino with
First of all, we are gonna need to design the Proteus Simulation as we always did. Subscribe Now !!!
SUBMIT
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 1/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects
Ad
Grammarly Search LOGIN SIGNUP
Download
Proteus Simulation
First of all, get the below components from the Proteus components Library and place them in your
workspace.
Now design a circuit in Proteus using these above components as shown in below figure:
If you have read the previous tutorial, you have noticed a small change, which is the RESET button.
Its a good thing to have a RESET button in your project. When you press this button, your 8051
Microcontroller will get reset and will start again.
Moreover, we have added a 20x4 LCD. The data pins of this LCD are attached with Port 2, while the
So, now let's design the programming code for interfacing of LCD with 8051 Microcontroller.
Programming Code
For programming code I have used Keil uvision 3 software. I am gonna first explain the code in bits
Before starting the LCD programming, let me clear few basic concepts.
The first type is the command like we need to tell the LCD either to start from first column
or second column so we need to place the LCD cursor at some point from where we need
The second type of data is the actual data we need to print on the LCD.
So first of all we send commands to the LCD like the cursor should go to second line and
then we send the actual data which will start printing at that point.
The first function, I have used is named as lcdinit() , this function will initialize the LCD and will give
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 2/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects
void lcdinit(void)
Check Corona Stats from all over the World !!!
{
Update (Live)
USA Confirmed Dead Recovered Cases today Deaths today Tests Critical Active Cases/IM Deaths/IM
2,007,449 112,469 2,007,449 1 2 21,291,677 16,923 1,133,272 6067 340
delay(15000);
writecmd(0x30); Search LOGIN SIGNUP
delay(4500);
writecmd(0x30);
delay(300);
writecmd(0x30);
delay(650);
Now in this function I have used another function which is writcmd, which is as follows:
void writecmd(int z)
{
RS = 0; // => RS = 0
P2 = z; //Data transfer
E = 1; // => E = 1
delay(150);
E = 0; // => E = 0
delay(150);
}
SPONSORED SEARCHES
8051 lcd interfacing proteus isis proteus for 8051 microcontroller schematic diagram
In order to send the commands to LCD with 8051 Microcontroller, we have to make the RS pin LOW
and then we send the data and make the Enable pin HIGH to LOW which I have done in the above
writecmd() function.
void writedata(char t)
{
RS = 1; // => RS = 1
P2 = t; //Data transfer
E = 1; // => E = 1
delay(150);
E = 0; // => E = 0
delay(150);
}
So, if you check above two functions then its quite clear that when we send command to the LCD
then we have to make RS pin 0 but when we need to send data to be printed on LCD then we need
to make RS pin 1. That's the only thing worth understanding in interfacing of LCD with 8051
Microcontroller.
Now below is the complete code for interfacing of LCD with 8051 Microcontroller and I think now you
can get it quite easily.
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 3/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects
#include<reg51.h>
Check Corona Stats from all over the World !!!
Update (Live)
USA Confirmed Dead Recovered Cases today Deaths today Tests Critical Active Cases/IM Deaths/IM
2,007,449 112,469 2,007,449 1 2 21,291,677 16,923 1,133,272 6067 340
//Function declarations
void cct_init(void); Search LOGIN SIGNUP
void delay(int);
void lcdinit(void);
void writecmd(int);
void writedata(char);
void ReturnHome(void);
//*******************
//Pin description
/*
P2 is data bus
P1.0 is RS
P1.1 is E
*/
//********************
// Defines Pins
sbit RS = P1^0;
sbit E = P1^1;
// ***********************************************************
// Main program
//
void main(void)
{
cct_init(); //Make all ports zero
writecmd(0x81);
writedata('w'); //write
writedata('w'); //write
writedata('w'); //write
writedata('.'); //write
writedata('T'); //write
writedata('h'); //write
writedata('e'); //write
writedata('E'); //write
writedata('n'); //write
writedata('g'); //write
writedata('i'); //write
writedata('n'); //write
writedata('e'); //write
writedata('e'); //write
writedata('r'); //write
writedata('i'); //write
writedata('n'); //write
writedata('g'); //write
writecmd(0xc4);
writedata('P'); //write
writedata('r'); //write
writedata('o'); //write
writedata('j'); //write
writedata('e'); //write
writedata('c'); //write
writedata('t'); //write
writedata('s'); //write
writedata('.'); //write
writedata('c'); //write
writedata('o'); //write
writedata('m'); //write
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 4/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects
void cct_init(void)
{
P0 = 0x00; //not used
P1 = 0x00; //not used
P2 = 0x00; //used as data port
P3 = 0x00; //used for generating E and RS
}
void delay(int a)
{
int i;
for(i=0;i<a;i++); //null statement
}
void writedata(char t)
{
RS = 1; // => RS = 1
P2 = t; //Data transfer
E = 1; // => E = 1
delay(150);
E = 0; // => E = 0
delay(150);
}
void writecmd(int z)
{
RS = 0; // => RS = 0
P2 = z; //Data transfer
E = 1; // => E = 1
delay(150);
E = 0; // => E = 0
delay(150);
}
void lcdinit(void)
{
delay(15000);
writecmd(0x30);
delay(4500);
writecmd(0x30);
delay(300);
writecmd(0x30);
delay(650);
So, place this code in your keil software and get the hex file.
Upload this hex file in your Proteus software and Run it.
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 5/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects
If everything goes fine then you will get something as shown in below figure:
Check Corona Stats from all over the World !!!
Update (Live)
USA Confirmed Dead Recovered Cases today Deaths today Tests Critical Active Cases/IM Deaths/IM
2,007,449 112,469 2,007,449 1 2 21,291,677 16,923 1,133,272 6067 340
Now, you can see we have printed our website address on the LCD with 8051 Microcontroller.
You can print anything you wanna print on this LCD instead of our address.
You can download the Proteus Simulation along with hex file and the programming code in keil
uvision 3 by clicking on below button.
That's all for today, in the next post I am gonna share how to display custom characters on LCD with 8051
Microcontroller, because till now you can just display the simple characters like alphabets and numbers on it but can't
display the custom characters like arrowhead etc. You should have a look at LCD Interfacing with Microcontrollers,
where I have combined all tutorials related to LCD. So stay tuned and have fun.
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
Previous Next
-Website Author
@syedzainnasir
Check Corona Stats from all over the World !!!
I am Syed Zain Nasir, the founder of The Engineering Projects (TEP). I am a Update (Live)
USA Confirmed Dead Recovered Cases today Deaths today Tests Critical Active Cases/IM Deaths/IM
2,007,449 112,469 2,007,449 1 2 21,291,677 16,923 1,133,272 6067 340
programmer since 2009 before that I just search things, make small projects
and now I am sharing my knowledge through this platform. I also work as a
Search LOGIN SIGNUP
freelancer and did many projects related to programming and electrical
circuitry. My Google Profile+
Follow
Get Connected
Leave a Reply
You must be logged in to post a comment.
Hi Sir,
Thank you for the very easy and understandable explanation. In the above code,
the display is static. If I want my display to scroll towards the left direction, does it
mean that I just need to manipulate the writecmd(int t) function so that the column
will change? What if the LCD is composed 4 rows, what will now be the value for
writecmd(int t)?
Thanks,
Cris
Log in to Reply
2
DNIHARIKA says:
July 13, 2020 at 2:35 pm
Excellent blog and thanku for the time and such valuable things that you shared
with us and expect to grow higher and higher in the coming years. only one small
doubt i..e..you have given command(0x81) what does it imply???
Log in to Reply
Newsletter
Get weekly notification of engineering articles, straight to your inbox ...
Recent Post
Interfacing Flame Sensor with Arduino
Oct 5,2020
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 7/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects
Brushless DC Motor
Oct 5,2020
Brushed DC Motor
Oct 5,2020
Arduino
PLC
PIC Microcontroller
8051 Microcontroller
Embedded Systems
C#
LabView
Proteus
555 Timer
MATLAB
SEO Tutorials
Contact Us
Skype
theengineeringprojects
Follow us
Follow us on social media
https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 8/8