Write a program to display any name on LCD using string function.


#include<8051.h>
void lcd_init();
void display(unsigned char d);
void lcd_cmd(unsigned char d);
void string(unsigned char *p);
void delay(unsigned int i)
{
while(i!=0)
{
i–;
}
}
void lcd_init()
{
lcd_cmd(0x38);
lcd_cmd(0x01);
lcd_cmd(0x0c);
}
void lcd_cmd(unsigned char d)
{
P1=d;
delay(300);
P3_3=0;
P3_4=1;
P3_4=0;
}
void display(unsigned char d)
{
P1=d;
delay(300);
P3_3=1;
P3_4=1;
P3_4=0;
}
unsigned char name[]={“AASHNA $”};
void string(unsigned char *p)
{
while(*p!=’$’)
{
display(*p);
p++;
}
}
void main()
{
lcd_init();
lcd_cmd(0x80);
string(name);
}

Add Comment