Hello
I am interfacing lcd (JHD 162A) using 8051(AT89c52).The lcd's lamp only lit up and all i can see is boxes in the first line,i have checked all the connections to the lcd and they are fine.I wrote the code on keil uvision4 .I tried with different c codes to check lcd but still i see the same problem ,please help .Thanks in Advance.
Here is the code :
#include<AT89X51.h>
sfr ldata=0x90;
sbit rs=P3^3;
sbit rw=P3^4;
sbit en=P3^5;
void lcd_command(unsigned char);
void lcd_data(unsigned char);
void delay(unsigned int);
void main()
{
P2=0x00;
P1=0xFF;
delay(100);
lcd_command(0x38);
delay(100);
lcd_command(0x0F);
delay(100);
lcd_command(0x01);
delay(100);
lcd_command(0x06);
delay(100);
lcd_command(0x80);
delay(100);
lcd_data('H');
delay(100);
lcd_data('I');
while(1);
}
void lcd_command(unsigned char value)
{
ldata=value;
rs=0;
rw=0;
en=1;
delay(100);
en=0;
}
void lcd_data(unsigned char value)
{
ldata=value;
rs=1;
rw=0;
en=1;
delay(150);
en=0;
}
void delay(unsigned int num)
{
unsigned int k,q;
for(k=0;k<num;k++)
{
for(q=0;q<=1275;q++);
}
}