0% found this document useful (0 votes)
4 views2 pages

LCD Interfacing

The document contains C code for interfacing an LCD with a microcontroller using the 8051 architecture. It includes functions for sending commands and data to the LCD, as well as a delay function for timing. The main loop initializes the LCD and displays the characters '0YES' on the screen.

Uploaded by

Manikanda Prabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views2 pages

LCD Interfacing

The document contains C code for interfacing an LCD with a microcontroller using the 8051 architecture. It includes functions for sending commands and data to the LCD, as well as a delay function for timing. The main loop initializes the LCD and displays the characters '0YES' on the screen.

Uploaded by

Manikanda Prabu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

LCD INTERFACING

1 #include<reg51.h>

2 sbit rs=P1^0;

3 sbit rw=P1^1;

4 sbit en=P1^2;

5 void MSDelay(unsigned int);

6 void lcdcmd(unsigned char);

7 void lcddata(unsigned char);

8 void main()

9 {

10 P2=0x00;

11 while(1)

12 {

13 lcdcmd(0x38);

14 MSDelay(10);

15 lcdcmd(0x01);

16 MSDelay(10);

17 lcdcmd(0x10);

18 MSDelay(10);

19 lcdcmd(0x0C);

20 MSDelay(10);

21 lcddata('0');

22 MSDelay(10);

23 lcddata('Y');

24 MSDelay(10);

25 lcddata('E');

26 MSDelay(10);

27 lcddata('S');

28 MSDelay(10);

29 }

30 }

31 void lcdcmd(unsigned char value)


LCD INTERFACING
32 {

33 P2=value;

34 rs=0;

35 rw=0;

36 en=1;

37 MSDelay(250);

38 en=0;

39 }

40 void lcddata(unsigned char value)

41 {

42 P2=value;

43 rs=1;

44 rw=0;

45 en=1;

46 MSDelay(250);

47 en=0;

48 }

49 void MSDelay(unsigned int itime)

50 {

51 unsigned int i,j;

52 for(i=0;i<itime;i++)

53 for(j=0;j<1275;j++);

54 }

55

You might also like