You are on page 1of 3

5/19/2016 how to display ASCII characters on 16x2 lcd using 8051 - MIcrocontroller Projects

MIcrocontroller Projects (/) All About Microcontrollers

Search Site For More Atmel,Arduino,8051 and Microchip Pic Series Microcontroller Projects!!!!!

Look more professional with


| custom Gmail from Google
Start free trial
Gmail for Work

Displaying ASCII Characters on 16x2 lcd using 8051(89c51,89c52) Microcontr


Home (/)

Microcontroller
projects Hardware requirements
(/microcontroller- 16x2 lcd
projects.html)
Breadboard to make circuit
Knowledge based one 80s51 or 80c51
(/knowledge-
based.html) A potentiometer to set lcd contrast

Arduino The code is very simple we hope that you are already familiar with c/c++ programming language. First of all the header file re51.h is inclu
(/arduino.html)
to include in our every project which include 8051 microcontroller. Then the lcd rs(register set) rw(read/write) and en(Enable) pins are defin

Lcd Interfacing
(/lcd- Just copy the code and made your circuit burn the code in your micro controller and the ascii characters will appear on your 16x2 lcd scree
interfacing.html) another size of screen but take care you have to change just only one statement lcdcmd(0x38). If you know how to do that then do it If you a
you want some information on it just click the link.
About Me (/about-
me.html) 8x1 , 8x2 , 10x2 , 16x1 , 16x2 , 16x4 , 20x2 , 20x4 , 24x2 , 30x2 , 32x2 , 40x2 LCD working.

Contact Me
(/contact-me.html) Project Code
Download the project code from the links given at the bottom of the Post.
counter
(/counter.html)

Car Battery
Temperature and
Automatic Head
Light On/Off
System with
Arduino (/car-
battery-
temperature-and-
automatic-head-
light-onoff-system-
with-arduino.html)

Stepper motor
controlled with
hc06 Bluetooth
module (/stepper-
motor-controlled-
with-hc06-
bluetooth-
module.html)

http://www.microcontroller-project.com/displaying-ascii-characters-on-16x2-lcd.html 1/3
5/19/2016 how to display ASCII characters on 16x2 lcd using 8051 - MIcrocontroller Projects

#include< reg51.h>
Electrical sbit rs=P3^5; //Register select (RS)
sbit rw=P3^7; //Read write (RW) pin
Calibration sbit en=P3^6; //Enable (EN) pin

char decimal[]={"Decimal ="}; //String displayed on first line of 16x2 lcd


Learn What char ascii[]={"ASCII = "}; //String displayed on second line of 16x2 lcd
Makes void delay(unsigned int time) //Time delay function
{
Electrical unsigned int i,j;
for(i=0;i < time;i++)
Calibration for(j=0;j < 5;j++);
}
Effective. Free void lcdcmd(unsigned char value) //Function for sending values to the command register of LCD
Guide! {
P2=value; //sending commands on port 2 Means to the lcd command register
P3=0x40;
delay(50);
en=0;
delay(50);
return;
}
void display(unsigned char value) //Function for sending values to the data register of LCD
{
P2=value; //sending data on port 2 Means to the lcd data register
P3=0x60;
delay(500);
en=0;
delay(50);
return;
}
void lcdint(void)
{
P2=0x00;
P3=0x00;
delay(15000);
display(0x30);
delay(4500);
display(0x30);
delay(300);
display(0x30);
delay(650);
lcdcmd(0x38);
delay(50);
lcdcmd(0x0F);
delay(50);
lcdcmd(0x01);
delay(50);
lcdcmd(0x06);
delay(50);
lcdcmd(0x80);
delay(50);
}
void main()
{
char c=0x00;
int count=0;digit=0,i;
for( i=0;i<=255;i++)
{
while(count!='\0')
{
display(decimal[count]);
count++;
}
display(digit);
count=0;
lcdcmd(0xC0);
while(count!='\0')
{
display(ascii[count]);
count++;
}
display(c);
delay(40000);
lcdcmd(0x01);
lcdcmd(0x80);
c++;
digit++;
}}

Ads by Google

► ASCII Characters
► LCD 16X2
► LCD Display

http://www.microcontroller-project.com/displaying-ascii-characters-on-16x2-lcd.html 2/3
5/19/2016 how to display ASCII characters on 16x2 lcd using 8051 - MIcrocontroller Projects

OLED manufacturer
Leading Manufacturers for
OLED in China. Here for More
Info!

(/uploads/2/2/1/5/22159166/8051_ascii.rar) Click here to upload file


Download File (/uploads/2/2/1/5/22159166/8

2 Comments Microcontroller

 Recommend ⤤ Share

Join the discussion…

Avatar jay • 2 years ago


i want the c++ program to print ASII valuee on LCD through serial transmission when i write the character on PC in hyperterminal
△ ▽ • Reply • Share ›

Usman Ali Butt > jay • 2 years ago


Ok i will upload it... When ever i got some free time...
△ ▽ • Reply • Share ›

ALSO ON MICROCONTROLLER

displaying images on graphical(jhd12864e) lcd using pic moving text on 16x2 lcd with ardunio
microcontroller 1 comment • 2 years ago
8 comments • a year ago rajive — very nice
Avatar
Usman Ali Butt — Yes you can....

PicKit2 made at home clock and calendar with arduino


3 comments • a year ago 2 comments • 2 years ago
Danish Najeeb — good work
Avatar Usman Ali Butt — Contact me at usa_butt@hotmail.com

✉ Subscribe d Add Disqus to your site Add Disqus Add Privacy

89c51 Microcontroller Projects (projects.html) 89c52 Microc

Arduino(Uno, Mega) Projects (projects.html) Knowledge

About Me (about-me.html) Contact Me (contact-m

Copyright 2012 All Rights Reserved www.microcontroller-project.com

http://www.microcontroller-project.com/displaying-ascii-characters-on-16x2-lcd.html 3/3

You might also like