This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

help in 8051 coding

Hello..

I am working on a project in which i suppose to show string value(output of matlab reciving serially from pc ) on LCD. I am using 8051 microcontroller and interfaced LCD with it.

I checked 8051 coding and it is not working well, when i am transmiting data to it using matlab and receiving using serial communication it shows symbol lik E for each output like if the output string is ADE 679 it shows some kind of E symbol...please help..here is ma code
#include <reg51f.h>

sbit rs = P3^7;
sbit en = P3^6;

void lcd_init();
void lcd_data(char);
void lcd_com(int);
void delay();
char serial ();

void main()
{ char a;
P0=0x00;
SCON=0x50;
TMOD=0x20;
TH1=0xFD;
TR1=1;

lcd_init();
while(1)
{ a = serial(); lcd_data(a);
} }

void lcd_init()
{ lcd_com(0x38); delay(); lcd_com(0x0E); delay(); lcd_com(0x01); delay();
}

void lcd_com(int x)
{ rs=0; en=1; P0=x; en=0; delay();
}

void lcd_data(char y)
{ rs=1; en=1; P0=y; en=0; delay();
}

char serial()
{

while(RI==0); RI=0; return SBUF;
}

void delay()
{ int i=0; for(i=0;i<1000;i++);
} So where is the problem?
Thank you.

0