Microcontroller › 8051 › serial data is not receiving by 8051 micro controller
- This topic has 3 replies, 4 voices, and was last updated 11 years, 1 month ago by
SHAH DISHANT H..
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
August 3, 2013 at 4:22 am #4830
V L RAGHURAM
ParticipantHi friends, i am new to this forum, i have encountered a problem, i want to send the serial data from PC to 8051 micro controller through serial port and hyper terminal software, but the data is not receiving by micro controller. I want to display the character on 16 x 2 LCD display. RI is not setting to 1 and the routine what i written to receive and display the character is not executing. I am using Flash magic software to dump the code into micro controller and it is going properly.Since one week i am facing this problem, earlier it worked properly(data displayed on LCD). I attached my code and circuit diagram, so please suggest me what to do.#include <REGX51.H>sbit rs = P3^7;sbit rw = P3^5;sbit en = P3^6;void msdelay(unsigned int value){unsigned int i,j;for(i=0;i<value;i++)for(j=0;j<1275;j++);}void LCD_data(unsigned char x){rs=1;rw=0;P1=x;en=1;msdelay(6);en=0;msdelay(6);}void LCD_cmd(unsigned char x){rs=0;rw=0;P1=x;en=1;msdelay(6);en=0;msdelay(6);}void lcd_str(unsigned char *str){int x;for(x=0;str[x]!=0;x++){LCD_data(str[x]);}}void lcd_ini() //Function to initialize the LCD{LCD_cmd(0x38);msdelay(5);LCD_cmd(0x0F);msdelay(5);LCD_cmd(0x80);msdelay(5);}/* this headder file having the functionsserialinit()tx(hex value)txs(string)rx()*/void serialinit() //serialinitilization{TMOD=0x20;// timer1,mode2SCON=0x50;TH1=-3;TR1=1;}void tx(unsigned char ch) //transmitting a single charecter{SBUF=ch;while(TI==0); //wait until TI=1TI=0;}void txs(unsigned char *chr) //to send a string{unsigned char i=0;for(i=0;chr!=’