Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

not able to get output on LCD

Status
Not open for further replies.

chetan11

Newbie level 5
Joined
Jul 27, 2011
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,353
The below program is compile correctly and hex file is created.
i m using 4-bit lcd in keil Uvisio2.4, but i m not able to set up the LCD set up.
can any one help me to which port of lcd i.e. d4,d5,d6,d7 to which parameter 8051 in LCD set up box in keil.
I will be very greatly helpful.




#include <REGX51.H>

void init();
void msdelay(unsigned int);
void lcdcmd(unsigned char value);
void lcddata(unsigned char value);
void d1();
void d2();

sbit en = P3^0;
sbit rs = P3^1;
sbit s1 = P3^2;
sbit s2 = P3^3;

char str1[7] = "switch1";
char str2[7] = "switch2";
char str3[10] = "pressed!!!";

int i;

void init()
{
lcdcmd(0x38);
msdelay(10);
lcdcmd(0x0e);
msdelay(10);
lcdcmd(0x06);
msdelay(10);
lcdcmd(0x01);
msdelay(10);
}

void main(){
while(1){

if(s1==0)
d1();

if(s2==0)
d2();

}
}

void d1(){
init();
lcdcmd(0x83);
for(i=0;i<7;i++){
lcddata(str1);
msdelay(1);
}
lcdcmd(0xc3);
for(i=0;i<10;i++){
lcddata(str3);
msdelay(1);
}
return;
}

void d2(){
init();
lcdcmd(0x83);
for(i=0;i<7;i++){
lcddata(str2);
msdelay(1);
}
lcdcmd(0xc3);
for(i=0;i<10;i++){
lcddata(str3);
msdelay(1);
}
return;
}

void lcdcmd(unsigned char value){
P2 = value;
rs=0;
en=1;
msdelay(1);
en=0;
return;
}

void lcddata(unsigned char value){
P2 = value;
rs=1;
en=1;
msdelay(1);
en=0;
return;

}

void msdelay(unsigned int itime){
unsigned int i,jich parameter in ;
for(i=0;i<itime;i++)
for(j=0;j<1275;j++);
}
 

your program is written for port 2 in 8 bit mode and you are configuring it as 4 bit as per your words...

---------- Post added at 16:51 ---------- Previous post was at 16:50 ----------

r/w pin must be grounded in hardware... show your hardware circuit also....
 

yes may be...........
now i m not able to get again from site...
actually i downloaded from site only.....
and now i cant getting it back...

can still it can be used to 4 port LCD ????
 

that means i have to write a new program for 4 bit lcd ???
 

then i have to modify....

Actually my keil is trail one and cant use it for 8 bit...

thats y i m specified abt 4 bit.....
 

who told that you cannot write 8 bit lcd program in trial version or evaluation version..... trial version restricts the code size to 2k...

second thing...

this is the last warning to you against using short forms of english words... all your post will be deleted and you will be banned from the forum if you continue to use the sms typing in this forum.....

No one will answer if you use sms typing in forum.....
 

sorry again...
I will not use again...

I am talking about 8 bit mode....LCD
 

when the keil is compiling your 8 bit program without error, there should be no problem. but why you tell since your keil is trial version you aer going for 4 bit lcd.... keil complied the code and gave hex file... put the hex file in the controller and make hardware connections and see the output....
 
Thanks.
But till now i am leaning on keil emulator only and have no hardware.
I will apply when i will learn more and then apply accordingly.
So now i will make changes and try to make it 4 bit lcd code.
 

you use software to simulate and see the output using proteus or ISIS lite software..

there you can rig up the circuit using the library and link your code to it and see the lcd printing the data on it... it will be fun learning and easy for you to learn....
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top