I have used USB to RS232 converter to transfer my USB port on PC to RS232 port which performs communication with 8051. The problem is why my PC only can receive unexpected garbage code. My 8051 and PC can realize serial communication with 8051 and PC respectively. But when combine them together the problem will happen. Would you help me to give me some suggestions?
Yes, my converter is this a commercial product with driver. For verifying it can work properly, I have shortened Pin 2 and Pin 3 of this converter for PC can receive the data it just sent out. The result is that the PC can receive the data correctly. I also did the same thing to 8051 with the same correct result. But when combine PC and 8051 (11.0592 MHZ)together (both of them are set to 2400, n 8, 1), PC or 8051 only can receive garbage data. I am really confused about that….. Any help from you? Thank you in advance…
"I have shortened Pin 2 and Pin 3 of this converter for PC can receive the data it just sent out. The result is that the PC can receive the data correctly." This shows that the PC and converter hardware are working, and that the PC transmit settings match the PC receive settings. "I also did the same thing to 8051 with the same correct result." Similarly, this shows that the 8051 & associated hardware are working, and that the 8051 transmit settings match the 8051 receive settings. "But when combine PC and 8051 ... only can receive garbage data." What you haven't demonstrated yet is that the PC transmit settings match the 8051 receive settings, and vice-versa. The fact that you receive something (albeit garbage) suggests that the cable connections are correct. This just leaves a mismatch between PC and 8051 settings. Have you checked with the Keil calculator that you have your baudrate exactly correct? http://www.keil.com/c51/baudrate.asp Are you sure the parity & data bits settings is correct? (the 8051 supports 8 bits only, and doesn't do parity) Have you tried the "Hello, World" example? This should give you a known set of serial port options.
Andrew Neil, Thank you for your suggestion. I will try this program.
...and check the ground line of the cable!
Thank you, I will do it. Happy new year.