Microcontroller › 8051 › How to interface 4bit mode LCD to 8051 Micro controller
- This topic has 12 replies, 9 voices, and was last updated 11 years, 10 months ago by umar farrok.
-
AuthorPosts
-
July 25, 2011 at 9:41 am #3838Ramu RachakondaParticipant
Please any body help me
July 25, 2011 at 12:59 pm #6517AnonymousGuestits not that difficult if you know how to work in 8-bit mode. You just need to know how 4-bit Mode works for the LCD.
Refer http://www.engineersgarage.com/embedded/avr-microcontroller-projects/interface-lcd-4bit-mode-circuit to understand the 4-bit mode working.
July 26, 2011 at 11:12 am #6520Ramu RachakondaParticipantHi very tanx for ur reply
i tried 4bit mode program but in LCD no display.
Actually my project is interfacing LM35 with C8052f120 Controller, so i interfaced LM35 to ADC of controller i got correct value in output side but that value i am not able to show in LCD so please help me.
with Regards
Ram.R
July 27, 2011 at 5:33 am #6525dagakshayParticipanthi Ramu,
what problem you facing not gettin the number or not getting any display on LCD????…
the link given aforside is a very nice one and properly explain i tried it and its workin well… i ask you to check you connects ones aagin….
July 28, 2011 at 9:26 am #6542Ramu RachakondaParticipantHi guys..
I got LM35 interfacing to controller and 4bit mode LCD display successfully………..
Thanks..
July 28, 2011 at 9:55 am #6543Ramu RachakondaParticipantHi guys..
can anybody tell me keyboard interfacing procedure bcoz of i am new to prgrmng…
Thanks..
August 3, 2011 at 1:14 pm #6568romel emperadoParticipantOctober 20, 2012 at 6:02 pm #8677rajuParticipantsir i want to 4 bit lcd display how to interface and correct coding for 4bit interface with 8051.
October 20, 2012 at 6:06 pm #8678rajuParticipantany one tell me where i mistake in code pleace see my code.
#include<reg51.h>
#include<stdio.h>sbit rs=P3^7;
sbit en=P3^6;
#define port P1void delayms(int delay);
void lcdcmd(unsigned char l);
void lcddata(unsigned char l);
void display(unsigned char *dr);
void delay(unsigned char s);
void lcd();
void enable();
void lcdint();void enable()
{
en=0;
delay(100);
en=1;
}
void lcdcmd(unsigned char l)
{int s;
rs=0;
s=l;
port=((l>>4)&0x0F);
enable();
delay(1000);
enable();
port=(s&0x0F);
enable();
//enable();}
void lcddata(unsigned char l)
{
int s;
rs=1;
s=l;
port=((l>>4)&0x0F);
enable();
delay(1000);
enable();
port=(s&0x0F);
enable();
//enable();}
void display(unsigned char *dr)
{while(*dr)
{
lcddata(*dr++);
}
}void delay(unsigned char s)
{
while(s–);
}
void lcd()
{
port=0xFF;
enable();
delayms(7);
port=0x30;
enable();
delayms(5);
port=0x30;
enable();
delayms(5);
port=0x30;
enable();
delayms(5);
port=0x20;
enable();
delayms(5);}
void lcdint()
{
lcd();
lcdcmd(0x28);
delay(100);
lcdcmd(0x0C);
delay(500);
lcdcmd(0x06);
delay(500);
//lcdcmd(0x01);
delay(500);}
void main()
{while(1)
{lcdint();
lcdcmd(0x80);
lcddata(‘a’);
}
}void delayms(int delay)
{int i ;
for(i = 0 ; i<delay ; i++)
{
TMOD=0x01;
TH0 = 0xFC ;
TL0 = 0x17 ;
TR0 = 1 ;
while(!TF0);
TR0 = 0 ;
TF0 = 0 ;
}
}October 21, 2012 at 8:08 am #8679AJISH ALFREDParticipantHi Raju,
Post your schematic and the trouble you are having with the code
March 5, 2013 at 11:05 pm #9255kunalParticipant#include<reg51.h>#define port P3 //14,13,12,11 pins of lcd and 1.7,1.6,1.5,1.4 of controller#define lcdport P1sbit rs = port^0;sbit rw = port^1;sbit en = port^2;void lcd_ini();void dis_cmd(unsigned char);void dis_data(unsigned char);void lcdcmd(unsigned char);void lcddata(unsigned char);void Delay_ms(unsigned int msec) ;void main(){unsigned char data0[]=”rocks”;unsigned int i=0;lcdport=0;lcd_ini();while(data0!=’