#include<reg51.
h>
#define display_port P2 //Data pins connected to port 2 on microcontroller
Sbit rs P3^2; //RS pin connected to pin 2 of port 3
Sbit rw P3^3;
Void msdelay(unsigned int time)
Unsigned i,j;
For(i=0;i<time;i++) for(j=0;j<1275;j++);
Void lcd_cmd(unsigned char command)
{ display port command;
Rs= 8;
Rw=0;
E=1; msdelay(1);
Void lcd_data(unsigned char disp_data) //Function to send display data to LCD
Display_port = disp_data;
R5= 1;
E=1; msdelay(1);
E=0;
} void lcd_init() //Function to prepare the LCD and get it ready
{
Lcd_cmd(0x38); // for using 2 lines and 5X7 matrix of LCD
Msdelay(10); lcd_cmd(exer); // turn display ON, cursor blinking
Msdelay(10);
Lcd_cmd(exe1); //clear screen
Msdelay(10);
Lcd_cmd(0x81); // bring cursor to position 1 of line 1 msdelay(10);
Void main()
Unsigned char a[100]=”ULAGANATHAN SP”; //string of 14 characters with a
null terminator.
Int 1-0; lcd_init();
While(a[1] != ‘\0’) // searching the null terminator in the sentence
{ lcd_data(a[1]); 1++;
Msdelay(50);