Circuit:



Code:



#include<reg51.h>
#define display_port P2 
sbit output=P2^0; 
sbit rs=P3^2;
sbit rw=P3^3;
sbit e=P3^4;
void msdelay(unsigned int time) 
{
   unsigned i,j;
   for(i=0;i<time;i++)
   {
       for(j=0;j<1105;j++)
       {
       }
   }
}
void lcd_cmd(unsigned char command)
{
   display_port=command;
   rs=0;
   rw=0;
   e=1; 
   msdelay(1); 
   e=0;
}
void lcd_data(unsigned char disp_data)
{
   display_port=disp_data; 
   rs=1;
   rw=0;
   e=1; 
   msdelay(1); 
   e=0;
}
void lcd_init() //Function to prepare the LCD and get it ready 
{
   lcd_cmd(0x38); //for 2 lines and 5X7 matrix of LCD
   msdelay(10); 
   lcd_cmd(0x0F); //turn display ON, cursor blinking 
   msdelay(10); 
   lcd_cmd(0x01); //clear screen 
   msdelay(10); 
   lcd_cmd(0x81); //bring cursor to position 1 of line 1 
   msdelay(10); 
}
void main()
{
   unsigned char a[15]="TADPOL REV1"; //string of 14 characters with a null terminator.
   int l=0; 
   lcd_init(); 
   while(a[l] != '\0') // searching the null terminator in the sentence 
   {
       lcd_data(a[l]); 
       l++;
       msdelay(50);
   }
}