0% found this document useful (0 votes)
268 views8 pages

Interfacing of LCD With 8051 Microcontroller in Proteus ISIS - The Engineering Projects PDF

Uploaded by

Teo Java
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
268 views8 pages

Interfacing of LCD With 8051 Microcontroller in Proteus ISIS - The Engineering Projects PDF

Uploaded by

Teo Java
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects

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

Search LOGIN SIGNUP

Interfacing of LCD with 8051 Microcontroller in Proteus ISIS


Today's post is about Interfacing of LCD with 8051 Microcontroller. In my previous post, we have seen How to do ...

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

Free Intelligent Writing Tool

Ad Real-time suggestions whenever you write. Try Grammarly today


Ad
Grammarly

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

is about Interfacing of LCD with 8051 Microcontroller. In my previous post, we

have seen How to do Serial Communication with 8051 Microcontroller, which


Join Our Fb Groups !!!
was quite a basic tutorial and doesn't need much hardware attached to it. Now
 ARDUINO  PROTEUS

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

GLCD. So, let's get started with it.

Interfacing of LCD with 8051 Microcontroller in Proteus ISIS

First of all, we are gonna need to design the Proteus Simulation as we always did. Subscribe Now !!!

Learn Free Pro Tricks


After designing the simulation, we are gonna write our embedded code for 8051 Microcontroller.
RSS YT FB TW
I will be designing the code in Keil uvision3 compiler and the 8051 Microcontroller I am gonna use is
Receive Quality Tutorials Straight in your

AT89C51. Inbox by submitting your Email ID below.

enter your email here...


So, let's first get started with Proteus Simulation for interfacing of LCD with 8051 Microcontroller.

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

Free Intelligent Writing Tool


Check Corona Stats from all over the World !!!
USA Confirmed Dead Recovered Cases today Deaths today Tests Critical Active Cases/IM Deaths/IM
Ad Real-time suggestions whenever you write. Try 2,007,449
Grammarly
Update (Live)
today
112,469 2,007,449 1 2 21,291,677 16,923 1,133,272 6067 340

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

RS and enable pins are connected to 0 and 1 pins of Port 1.

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

so let's get started with it.

Before starting the LCD programming, let me clear few basic concepts.

In LCD, there are two types of data, we need to sent.

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

to start writing. So, this type of data is called commands to LCD.

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

the initializing commands to it.

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);

writecmd(0x38); //function set


writecmd(0x0c); //display on,cursor off,blink off
writecmd(0x01); //clear display
writecmd(0x06); //entry mode, set increment
}

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

proteus libraries arduino library for proteus library proteus 8 lengkap

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.

Next function, we have used is writedata() function, which is as follows:

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

lcdinit(); //Initilize LCD

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

ReturnHome(); //Return to 0 position

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

Check Corona Stats from all over the World !!!


while(1)
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
{
} Search LOGIN SIGNUP

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);

writecmd(0x38); //function set


writecmd(0x0c); //display on,cursor off,blink off
writecmd(0x01); //clear display
writecmd(0x06); //entry mode, set increment
}

void ReturnHome(void) //Return to 0 location


{
writecmd(0x02);
delay(1500);
}

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

Search LOGIN SIGNUP

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.

[dt_button size="medium" style="default" animation="none" color_mode="default" icon="" icon_align="left" color=""

link="https://www.theengineeringprojects.com/8051Projects/Interfacing of LCD with 8051 Microcontroller in Proteus

ISIS.rar" target_blank="true"]Download Proteus Simulation & Code[/dt_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.

JLCPCB – Prototype 10 PCBs for $2 (For Any Color)

China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily

How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w

Serial Communication with 8051 Interfacing of Keypad with 8051


Microcontroller in Proteus Microcontroller in Proteus

Previous Next

-Website Author

Syed Zain Nasir


https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 6/8
04/12/2020 Interfacing of LCD with 8051 Microcontroller in Proteus ISIS - The Engineering Projects

@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.

Comments on ‘’Interfacing of LCD with 8051 Microcontroller in Proteus ISIS‘’ ( 2 )


1
Cristopher Tingcang says:
September 13, 2016 at 8:22 am

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

THE ENGINEERING PROJECTS


“A platform for engineers & technical professionals to share their engineering
projects, solutions & experience with TEP Community & support open source.”

Newsletter
Get weekly notification of engineering articles, straight to your inbox ...

Your email address 

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

DC Motor Control using myRIO


Check Corona Stats from all over the World !!!
 Oct 5,2020
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

Interfacing Temperature & Humidity Sensor with Arduino


Search LOGIN SIGNUP
 Oct 5,2020

Brushless DC Motor
 Oct 5,2020

Brushed DC Motor
 Oct 5,2020

Popular Tutorials Series

Arduino

PLC

PIC Microcontroller

8051 Microcontroller

Embedded Systems

C#

LabView

Proteus

555 Timer

MATLAB

SEO Tutorials

Contact Us

 Skype
theengineeringprojects

 Email

[email protected]

[email protected]

[email protected]

 Follow us
Follow us on social media

   

TERMS & CONDITIONS PRIVACY & POLICY DISCLAMIER CONTACT US

Copyright © 2020 TheEngineeringProjects.com. All rights reserved.

https://www.theengineeringprojects.com/2015/12/interfacing-lcd-8051-microcontroller-proteus-isis.html 8/8

You might also like