Society of Robots - Robot Forum

Software => Software => Topic started by: neo01124 on December 10, 2007, 09:40:06 AM

Title: Serial comm. between 89s52 and computer
Post by: neo01124 on December 10, 2007, 09:40:06 AM
we are using the schematic (http://sameermehta.info/wins/report/wins_files/image093.jpg) to establish comm between 89s52 and serial port. We are using 22uf caps instead of the 1uf caps rest of the circuit is identical and we are providing supply to both the ICs from a seperate adapter thru a 7805. We are using the following c code (http://img134.imageshack.us/img134/7629/tccj7.th.jpg) (http://img134.imageshack.us/my.php?image=tccj7.jpg) to communicate with the uC but no comm. is established.The serial port monitor shows following output(http://img134.imageshack.us/img134/3745/sportmonitorhq1.th.jpg) (http://img134.imageshack.us/my.php?image=sportmonitorhq1.jpg) .Since the serial port monitor shows proper output and no effect is seen on the uC side we feel there is something wrong with its programming here is the program we have loaded into the uC
#include<reg51.h>
void main()
{
unsigned char mybyte;
SCON=0x50;
TMOD=0x20;
TH1=-18;
TR1=1;
while(1)
{
while(RI==0);
mybyte=SBUF;
P1=mybyte;
RI=0;
}
}
The Keil simulator shows a baud rate of 4772 whiole COM1 port baudrate is 4800
Please help us with establishing this protocol!!!!
Title: Re: Serial comm. between 89s52 and computer
Post by: Admin on January 26, 2008, 09:52:54 AM
did you ever get it to work?

your com ports aren't matching baud rates
Title: Re: Serial comm. between 89s52 and computer
Post by: neo01124 on January 27, 2008, 08:34:51 AM
ya v got it working basically there was an error in setting the baudrate in the IDE cos we were using a 11.0592mhz crystal and it was set to 20mhz or something, if i remembered correctly, thats y the simulator was showing a wrong frequency of 4772 bauds
then we corrected this did the tx rx shorting test at a few places and voila serial communication!! 8)