Microcontroller › 8051 › INTERFACING LCD TO 8051 BY Qurat-ul-ain
- This topic has 23 replies, 12 voices, and was last updated 10 years, 5 months ago by Jaymin D.
-
AuthorPosts
-
July 13, 2011 at 7:52 am #1173queryParticipanti am interfacing lcd to 8051. bt my lcd is showing just blocks. the code isperfect n the circuit is correctly patched. wat can be the reason?October 29, 2011 at 1:28 pm #6759nitinParticipant
dude after selection of line try giving initialisation command
or else make initialisation a function and include in the select line function.
try this…..
good luck……..
October 29, 2011 at 3:27 pm #6760QaisarParticipantif u could put ur code here then its easy to find out the problem ..
October 29, 2011 at 3:32 pm #6761QaisarParticipantOctober 31, 2011 at 7:14 pm #6769sachinParticipantsame is proublem with mee… lcd showing only blocks…..i made 8051 based “A” chracter displaying on lcd….. from engg gagare site….plz help me…. i am just a begineer in microcontroller…………..
November 1, 2011 at 4:41 am #6770Rogen LeeParticipantsame problem to our project also. The project were made is an liquid level alarm using the 8051 and the ouput we are using is an 16×2 lcd. We found out that the lcd was only light, it has no display. So, please help me to find the solution of our problem and so we can have a successfull project. Thank you.
November 1, 2011 at 8:32 am #6771QaisarParticipantfollow this code and diagram to display text and numbers on lcd..
#include <AT89X51.H>#include < my.h > // built in delay function#define lcd_data P2sbit en=P0^1;sbit rs=P0^0;unsigned char z;unsigned int i;void lcdcmd(unsigned char value){lcd_data=value;rs=0;en=1;delay(200);en=0;return;}void lcddata(unsigned char value){lcd_data=value;rs=1;en=1;delay(200);en=0;return;}void main(void){lcdcmd(0X38);//5X7 matrixlcdcmd(0X0E);//lcd on ,curor onlcdcmd(0X01); // clear lcd commandlcdcmd(0X80);//move cursor to line1{unsigned char name[]=” TEST PROGRAMME “;for(z=0;z<=16;z++)lcddata(name[z]);lcdcmd(0XC2); // move cursor to line2, position 2for(i=48;i<=57;i++)lcddata(i);while(1);}}November 1, 2011 at 2:35 pm #6774sachinParticipanti try to compile the program using keil uvision4,but these error occurs
.
7.c.c(3): warning C318: can’t open file ‘my.h’
7.c.c(18): warning C206: ‘delay’: missing function-prototype
7.c.c(18): error C267: ‘delay’: requires ANSI-style prototype
Target not createdwhat is its mean????
but my program to show “A” character
is there is any mictake plz tell meee…..
#include<reg51.h>
sfr lcd_data_pin=0xA0;
sbit rs=P3^0; //Register select pin
sbit rw=P3^1; // Read write pin
sbit en=P3^6; //Enable pinvoid delay(unsigned int count) // Function to provide time delay in msec.
{
int i,j;
for(i=0;i<count;i++)
for(j=0;j<1275;j++);
}void lcd_command(unsigned char comm) //Function to send commands 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 to LCD
{
lcd_data_pin=disp;
en=1;
rs=1;
rw=0;
delay(1);
en=0;
}void lcd_ini() //Function to initialize the LCD
{
lcd_command(0x38);
delay(2);
lcd_command(0x0F);
delay(2);
lcd_command(0x82); //Set cursor to blink at line 1 positon 2
delay(2);
}void character()
{
lcd_command(64); //Address where values of the first custom character is stored
lcd_data(0);
lcd_data(10);
lcd_data(21);
lcd_data(17);
lcd_data(10);
lcd_data(4);
lcd_data(0);
lcd_data(0);
lcd_command(0xC0); //Address of the location where the character is to be displayed
lcd_data(0); // Displaying the character created at address 0x64
delay(10);lcd_command(72);
lcd_data(0);
lcd_data(0);
lcd_data(0);
lcd_data(10);
lcd_data(0);
lcd_data(4);
lcd_data(17);
lcd_data(14);
lcd_command(0x80);
lcd_data(1);
delay(10);lcd_command(80);
lcd_data(0);
lcd_data(0);
lcd_data(10);
lcd_data(0);
lcd_data(4);
lcd_data(0);
lcd_data(14);
lcd_data(17);
lcd_command(0x82);
lcd_data(2);
delay(10);
lcd_command(88);
lcd_data(1);
lcd_data(3);
lcd_data(5);
lcd_data(9);
lcd_data(9);
lcd_data(11);
lcd_data(27);
lcd_data(24);
lcd_command(0x84);
lcd_data(3);
delay(10);lcd_command(96);
lcd_data(0);
lcd_data(10);
lcd_data(0);
lcd_data(31);
lcd_data(17);
lcd_data(14);
lcd_data(0);
lcd_data(0);
lcd_command(0x86);
lcd_data(4);
delay(10);lcd_command(104);
lcd_data(10);
lcd_data(0);
lcd_data(4);
lcd_data(0);
lcd_data(14);
lcd_data(17);
lcd_data(17);
lcd_data(14);
lcd_command(0xC2);
lcd_data(5);
delay(10);lcd_command(112);
lcd_data(0);
lcd_data(10);
lcd_data(0);
lcd_data(0);
lcd_data(4);
lcd_data(0);
lcd_data(31);
lcd_data(0);
lcd_command(0xC4);
lcd_data(6);
delay(10);lcd_command(120);
lcd_data(0);
lcd_data(17);
lcd_data(10);
lcd_data(17);
lcd_data(4);
lcd_data(0);
lcd_data(14);
lcd_data(17);
lcd_command(0xC6);
lcd_data(7);
delay(10);
}void main()
{
lcd_ini();
character();
}November 2, 2011 at 9:53 am #6778sourabhParticipanttry this#include<reg52.h>sbit rs = P1^3;sbit rw = P1^4;sbit en = P1^6;int i;void delay(unsigned int);void data1();void cmd(int);void lcdin();void lcd(int);void main(){char *a;a=””; //write your string herelcdin();for(i=0;a!=’