- This topic has 4 replies, 4 voices, and was last updated 11 years, 12 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › 16X2 LCD interface with AT89S52 problem
hello friends,
I have interfaced LCD 16X2 with AT89S52 (11.0592MHz crystal)
The code goes like this,
#include<reg52.h>
#define ldata P3
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
sbit busy=P3^7;
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);
void MSDelay(unsigned int itime);
void lcdready();
void main()
{
lcdcmd(0x38);
MSDelay(250);
lcdcmd(0x0E);
MSDelay(250);
lcdcmd(0x01);
MSDelay(250);
lcdcmd(0x06);
MSDelay(250);
lcdcmd(0x86);
MSDelay(250);
lcddata(‘M’);
lcddata(‘D’);
lcddata(‘E’);
}
void lcdcmd(unsigned char value)
{
void lcdready();
ldata=value;
rs=0;
rw=0;
en=1;
MSDelay(1);
en=0;
return;
}
void lcddata(unsigned char value)
{
void lcdready();
ldata=value;
rs=1;
rw=0;
en=1;
MSDelay(1);
en=0;
return;
}
void lcdready()
{
busy=1;
rs=0;
rw=1;
while(busy==1)
{
en=0;
MSDelay(1);
en=1;
}
return;
}
void MSDelay(unsigned int itime)
{
unsigned int i,j;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
The problem is nothing is being displayed on LCD. Jus the backlight will be on.
I have connected data pins of LCD to port P3 and control pins rs,rw&en to rs=P2^0; rw=P2^1;en=P2^2;….
Pls help……….. Thanks in advance
hai prajwal…
ur code is working….
reduse delay…
Yeah it is working with me too There was some loose connection in hardware now its working fine.
Thanks for your reply and concern
Can you show me the circuit diagram used. I come with a similar problem.
check your circuit conection………..