#include<regx51.h>
#define RS P1_7
#define RW P1_6
#define EN P1_5
#define DATA P2
void delay(int n);
void ins(void);
void dat(void);
void latch(void);
void main(void)
{
int k=0;
char x[6]="WALLE";
delay(100000);
ins();
DATA=0X38; //8-bit Databus, Set 2 lines, and Select font size 5x7
latch();
DATA=0X0F;// It will display the characters, will display the cursor and it will blink.
latch();
DATA=0X10; // Set cursor on line 1. Use 0xC0 to write on line 2.
latch();
DATA=0X0; //Before changing to write data select. Make port 2 =0x0 so that LCD receives nothing
dat();
latch();
for(k=0;k<=5;k++)
{
DATA=x[k];
latch();
}
while(1);
}
void delay(int n)
{
int i=0,j=0;
for(i=0;i<=n;i++)
for(j=0;j<=10;j++);
}
void ins(void) //Instruction select routine
{
RS=0;
RW=0;
}
void dat(void) // Data select routine
{
RS=1;
RW=0;
}
void latch(void) // Latch routine
{
EN=1;
delay(1000);
EN=0;
delay(1000);
}