HOW TO INTERFACE LCD WITH 8051 TAMIL | 8051 TUTORIAL TAMIL | LCD KEIL CO...





code:-

#include<reg51.h>

sbit rs=P3^5;

sbit e= P3^4;

sbit rw=P3^6;

void cmdwrt_lcd(char);

void datas(char);

void delay(unsigned int);

void lcd_init();

void display_lcd(unsigned char *lcdstr);

void main()

{

lcd_init();

display_lcd("HELLO WORLD");

cmdwrt_lcd(0xc0);

display_lcd("Corona break");



while(1);

}

void lcd_init()

{

cmdwrt_lcd(0x38);

cmdwrt_lcd(0x0C);

cmdwrt_lcd(0x01);  

cmdwrt_lcd(0x80);

}





void cmdwrt_lcd( char com)

{

P1=com;

rs=0;

rw=0;

e=1;

delay(5);

e=0;

}

void datas( char dat)

{

P1=dat;

rs=1;

rw=0;

e=1;

delay(5);

e=0;

}

void delay(unsigned int time)

{

unsigned int i,j;

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

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

}

void display_lcd(unsigned char *lcdstr)

{

    while (*lcdstr !='\0')

{

datas(*lcdstr);

lcdstr++;

}

}

Comments