How to Display Characters from pc to LCD?

Status
Not open for further replies.

jsureshp

Junior Member level 3
Joined
Jul 20, 2010
Messages
26
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Location
Chennai
Activity points
1,492
Hi......

I want to Display, whatever i'm typing in system (in the Keyboard ) through the serial port i want to display the character to the LCD using Microcontroller.

I did the coding.

But While i display into the LCD everything is unknown character or not exact character.

Can anyone Help to me...........
Please.....
 

Here I'm using 8052 Microcontroller.

My code are........





#include<reg51.h>
unsigned char a,z;
sfr ldata =0xA0;
sbit rs=P0_5;
sbit rw=P0_6;
sbit en=P0_7;

void Delay()
{ unsigned char i,j;
for(i=1;i<100;i++)
for(j=1;j<100;j++)
;
}
void initserial(void)
{

TMOD=0x20;
TH1=-3; // 9600 Baud Rate
SCON=0x50;
TR1=1;
}

void Lcd_cmd(unsigned char val)
{
ldata=val;
rs=0;
rw=0;
en=1;
Delay();
en=0;
}

void Lcd_Data1(unsigned char dval)
{
ldata=dval;
rs=1;
rw=0;
en=1;
Delay();
en=0;
}
void Lcd_Str(unsigned char* dval)
{
while(*dval)
{
ldata=*dval++;
rs=1;
rw=0;
en=1;
Delay();
en=0;
}
}

void INITLCD()
{
Lcd_cmd(0x38);
Lcd_cmd(0x0C);
Lcd_cmd(0x01);
}
void SendData()
{
SBUF='O';
while(TI==0);
TI=0;
Delay();
SBUF='K';
while(TI==0);
TI=0;
Delay();
}
void Clear()
{
Lcd_cmd(0x01);
Lcd_cmd(0x80);
}

void main()
{
unsigned char m1,m2=0;
RI=0; TI=0;
initserial();
INITLCD();
Lcd_cmd(0x80);
Lcd_Str("Welcome to CMTES");
Lcd_cmd(0xC0);
Lcd_Str("Please Press Key");
SendData();
TI=0;

/**************************************************************************/

main:
while(RI==0);
Clear();
m2=0;
First:
while(RI==0);
{
m1=SBUF;
m2++;
if(m2==33)
{
Clear();
m2=1;
}
if(m2<17)
{
Lcd_Data1(m1);
RI=0;
goto First;
}
if(m2==17)
{
Lcd_cmd(0xC0);
goto next;
}
next:
if(m2>=17)
{
Lcd_Data1(m1);
RI=0;
goto First;
}
else if(m2>=33) goto main;
}
}

Please help to me..........

---------- Post added at 13:46 ---------- Previous post was at 13:45 ----------

Sorry thats for 8051 Microcontroller.......

---------- Post added at 13:47 ---------- Previous post was at 13:46 ----------

My coding for 8051 Microcontroller only ...
sorry while i typing wrongly entered
sorry..

---------- Post added at 13:48 ---------- Previous post was at 13:47 ----------

But Coding for 8051 only

---------- Post added at 15:06 ---------- Previous post was at 13:48 ----------

Here I attach my Circuit and Lcd Character on the LCD...........

Please send Help to me.........

I'm awaiting for your Reply...........
 

Attachments

  • prot.JPG
    176 KB · Views: 72

Circuit for Pc to LCD .......
 

Attachments

  • prot.JPG
    176 KB · Views: 71

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…