Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/09/99 04:09
Read: times


 
#202 - RE: AT89C51 to PC interfacing
Serial communication with the 8051 is EXTREMELY reliable. If you are having communication problems, it is probably one of the following:

1. Faulty cable.

2. Bad start/stop bit length. If the PC and 8051 aren't matched, you'll have problems.

3. Bad data length configuration. On the PC, you should send/recv 8 data bits.

4. Parity configuration. On the PC, you should have parity set to NONE.

5. Baud rate divisor that allows for out-of-sped baudrates. The baudrate for RS-232 is supported to be +1%/-2% (or maybe it's reversed). Anyway, make sure the baudrate you choose is fairly close. A lot of 8051 designs use the 11.0592 MHz xtal for that reason.

6. Wrong capacitors on the MAX232. There are a lot of different MAX232 devices (like MAX232, MAX232A, MAX232B and on and on). Make sure that you are using 0.1 uF or 1.0 uF caps or whatever is called for. These determine slew rate and all kinds of analog stuff (and no one knows how that stuff works -- it's like crossing the beams).

7. Sending a byte from the 8051 before the TI bit is set. Make sure you wait for that or you'll overwrite the character you're sending.


As for handshaking...

If you didn't write any for the 8051, there ain't none happening. When you write a character to SBUF, out the port it goes. Since most PCs use the 16550 (with 16-byte FIFOs) you probably don't need handshaking on the PC end. The 8051 would be hard pressed to send characters to a PC TOO fast.

The other way (PC to 8051) is a more likely candidate for handshaking. You can use an output port from P1 or P3 for that. Just run it through the MAX232. Since the 8051 will be DCE, I guess you should use RTS, but that's up to you.

Don't use XON/XOFF. Why? Because I don't like it! :-) XON/XOFF is evil.

Hope this helps. If you're receiving a rough approximation of what you sent, you're pretty close. Keep trying. I always find that an oscilloscope helps out a lot.

Jon Ward
Keil Software


List of 6 messages in thread
TopicAuthorDate
AT89C51 to PC interfacing            01/01/70 00:00      
RE: AT89C51 to PC interfacing            01/01/70 00:00      
   RE: AT89C51 to PC interfacing            01/01/70 00:00      
RE: AT89C51 to PC interfacing            01/01/70 00:00      
   RE: AT89C51 to PC interfacing            01/01/70 00:00      
RE: AT89C51 to PC interfacing            01/01/70 00:00      

Back to Subject List