include

define LCD1602_DB P0

sbit LCD1602_RS = P2^6;

sbit LCD1602_RW = P2^5;

sbit LCD1602_EN = P2^7;

void delay(unsigned int i)

{

while(i--);

}

void LCD1602_Write_Cmd(unsigned char cmd)

{

LCD1602_RS = 0;

LCD1602_RW = 0;

LCD1602_EN = 1;

LCD1602_DB = cmd;

delay(100);

LCD1602_EN = 0;

}

void LCD1602_Write_Data(unsigned char dat)

{

LCD1602_RS = 1;

LCD1602_RW = 0;

LCD1602_EN = 1;

LCD1602_DB = dat;

delay(100);

LCD1602_EN = 0;

}

void LCD1602_Init()

{

LCD1602_Write_Cmd(0x38);

LCD1602_Write_Cmd(0x0c);

LCD1602_Write_Cmd(0x06);

LCD1602_Write_Cmd(0x01);

}

void main()

{

LCD1602_Init();

LCD1602_Write_Data('H');

LCD1602_Write_Data('e');

LCD1602_Write_Data('l');

LCD1602_Write_Data('l');

LCD1602_Write_Data('o');

LCD1602_Write_Data(',');

LCD1602_Write_Data(' ');

LCD1602_Write_Data('W');

LCD1602_Write_Data('o');

LCD1602_Write_Data('r');

LCD1602_Write_Data('l');

LCD1602_Write_Data('d');

while(1);

}