You are on page 1of 2

#include <REGX51.

H>
#define LCDDATA P2
sbit RS=P1^0;
sbit RW=P1^1;
sbit E=P1^2;
unsigned char data1
;
unsigned char z;
unsigned char name[]="UMAR ASHRAF id-40";
void delay()
{int x,y=0;
for(x=0;x<10;x++)
{for(y=0;y<1000;y++)
{
}}}
static void LCDPULSE(int t)
{
unsigned char i;
E=1;for(i=0;i<t;i++);
E=0;for(i=0;i<t;i++);
}
int lcd_run_command(unsigned char COMMAND)
{
LCDDATA=COMMAND;
RS=0;delay();
RW=0;delay();
LCDPULSE(255);
return 1;
}
int LCD_SHOW(unsigned char CHARACTER)
{
LCDDATA=CHARACTER;
RS=1;delay();
RW=0;delay();
LCDPULSE(255);
return 1;
}
int LCD_INITIALIZE()
{
lcd_run_command(0x38);
lcd_run_command(0x0E);
lcd_run_command(0x01);
lcd_run_command(0x06);
lcd_run_command(0x80);
return 1;
}
void main()
{ while(1) {
delay();
LCD_INITIALIZE();
{
for( z=0;z<16;z++)
{
data1=name[z];
LCD_SHOW(data1);
delay();
if(z==10)

{
lcd_run_command(0xC3);
}
}
}}}

You might also like