A single character can be displayed on LCD by properly configuring its data and command registers. A string is nothing but a sequential arrangement of several characters that can be displayed on LCD by using the following algorithm. Here P2 port of the microcontroller is used as output port which sends the data byte to data pins of the LCD. The control pins (pin 4, 5 & 6) are connected to pins 0, 1 & 6, respectively, of P3 port of the microcontroller. Pin 3 is connected to a preset of 10k to adjust the contrast on LCD screen
Fig. 2: LCD Screen
Project Source Code
###
//Program to display String on LCD #include<reg51.h> sfr lcd_data_pin=0xA0; // data port P2 sbit rs=P3^0; // Register select pin sbit rw=P3^1; // Read write pin sbit en=P3^6; // Enable pin void delay(unsigned int msec) //delay function { int i,j; for(i=0;i<msec;i++) for(j=0;j<1275;j++); } void lcd_command(unsigned char comm) // function to send command to LCD { lcd_data_pin=comm; en=1; rs=0; rw=0; delay(1); en=0; } void lcd_data(unsigned char disp) // function to send data on LCD { lcd_data_pin=disp; en=1; rs=1; rw=0; delay(1); en=0; } lcd_dataa(unsigned char *disp) // function to send string to LCD { int x; for(x=0;disp[x]!=0;x++) { lcd_data(disp[x]); } } void lcd_ini() //Function to inisialize the LCD { lcd_command(0x38); delay(5); lcd_command(0x0F); delay(5); lcd_command(0x80); delay(5); } void main() { lcd_ini(); lcd_dataa("ECE Rocks"); }###
Circuit Diagrams
Project Components
Project Video
Filed Under: 8051 Microcontroller
Filed Under: 8051 Microcontroller
Questions related to this article?
👉Ask and discuss on Electro-Tech-Online.com and EDAboard.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.