You are on page 1of 4

>include <reg51.

h#

;sfr LCD_PORT=0x80

;sbit LCD_EN =P3^7

;sbit LCD_RS=P3^6

;)(void LcdDelay

;)(void LcdInit

;)void LcdCmd(unsigned char c

;)void LcdChar(unsigned char d

;)] [void LcdLine1(char msg

;)] [ void LcdLine2(char msg

;)(void LcdHome

;)void LongDelay(int count

)(void main

;)(LcdInit

;)"LcdLine1("Hello

;)"LcdLine2("World

;)while (1

)(void LcdInit

;LCD_EN=0

;)LongDelay(20
;)LcdCmd(0x38

;)LongDelay(5

;)LcdCmd(0x38

;)LongDelay(5

;)LcdCmd(0x38

;)LongDelay(5

LcdCmd(0x0c);//display on

LcdCmd(0x06);// increment mode

LcdCmd(0x01);//Clear

)void LcdCmd(unsigned char c

;LCD_PORT=c

;LCD_RS=0

;LCD_EN=1

;LCD_EN=0

;)(LcdDelay

)void LcdChar(unsigned char c

;LCD_PORT=c

;LCD_RS=1

;LCD_EN=1

;LCD_EN=0

;)(LcdDelay
}

)] [void LcdLine1(char msg

;char i=0

;)(LcdHome

)'while (msg[i] != '\0

;)]LcdChar(msg [i

;++i

)] [ void LcdLine2(char msg

;char i=0

;)LcdCmd(0xc0

)'while (msg [i] != '\0

;)]LcdChar(msg[i

;++i

)(void LcdHome

{
;)LcdCmd(0x02

;)LongDelay(10

)(void LcdDelay

;int i

;)++for (i=0;i<10;i

)void LongDelay(int count

;int i,j

)++for (j=0;j<count;j

;)++for (i=0;i<100;i