at89c52 and lcd interfacing

Status
Not open for further replies.

gnoble29

Member level 1
Joined
Jun 30, 2010
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
india
Activity points
1,528
i have an at89c52 and a 16*2 lcd display. how i connect my lcd to 89c52 to disply the message welcome...


if any one know the source code,plz post...



thanks in advance
 

Code:
#include <reg52.h>
#include <math.h>
void lcdcmd (unsigned char);
void lcddata (unsigned char);
void msdelay (unsigned int);
void LCD_sendstring(unsigned char * );

////////////////////////////////////// 
sfr ldata =0x90;
sbit rs=P3^7;
sbit rw=P3^6;
sbit en=P3^5;
sbit g=P2^7;
/////////////////////////////


void main(void)
{
lcdcmd (0x3;
msdelay (100);
lcdcmd (0x0C);
msdelay (100);
LCD_sendstring("16x2 LCD");
msdelay(1000)



lcdcmd (0x01);
msdelay(5);

}

void lcdcmd (unsigned char value)
{ 
ldata=value;
rs=0;
rw=0;
en=1;
msdelay (10);
en=0;
}

void lcddata (unsigned char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
msdelay (10);
en=0; 
}


void msdelay (unsigned int itime)
{
unsigned int i,j;
for (i=0;i<itime;i++)
for (j=0;j<1275;j++);
}


void LCD_sendstring(unsigned char *value)
{
while(*value) 
lcddata(*value++); 
}
 
when compiling on keil i have got the following error messages..what will i do??
 

when compiling on keil i have got the following error messages..what will i do??


This error is because you copied the code to an asm file( i.e. *.a51). Make a new file with extension *.C then copy the code there. Then it would work perfectly.
 
This error is because you copied the code to an asm file( i.e. *.a51). Make a new file with extension *.C then copy the code there. Then it would work perfectly.

thanks lot:-D

---------- Post added at 16:58 ---------- Previous post was at 16:53 ----------

which model of lcd display should i select in proteus for simulating the above code....i have proteus6 professional...it provides varity of 16*2 lcd display
 

See if your hardware is connected to as in the program to get output....

modify the 1st line after main function lcdcmd (0x3;
as lcdcmd(0x30);
 

to which pin of 8052 should i connect db0.db1........db7 pins of lcd
 

Go for

LM016L 16x2

---------- Post added at 21:35 ---------- Previous post was at 21:34 ----------

to which pin of 8052 should i connect db0.db1........db7 pins of lcd

Connect to any port.

---------- Post added at 21:36 ---------- Previous post was at 21:35 ----------



I have highlighted the LCD in proteus
 
Last edited by a moderator:
thanks a lot...i succeded in lcd display.it is my first proteus simulation..thanks
 



---------- Post added at 17:32 ---------- Previous post was at 17:29 ----------

In this program,the display will blinks after some delay....what modifiacation should made to make the output displas the same thing at everytime..that means no blinks....
 

yes..i need the display premanently still...
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…