8051 UART timing

Does anyone know the exact timing of the internal UART on an 8051 based microprocessor (actually it's a Dallas 80C320)? As I understand it, when transmitting, the TI bit sets a the _beginning_ of the stop bit of the byte. So if you wait for the TI bit to go true, and immediately write another byte to SBUF, does this immediately start transmitting the start bit of the new byte, cutting short the stop bit of the previous byte and potentially leading to a framing error in the receiver? If so, do I have to wait a short 1 bit-time delay after seeing TI before writing the next byte to SBUF?

If this doesn't happen, why not? What feature of the chip prevents this from happening?

If this is the last byte, I want to turn off the RS485 driver so I can wait for the reply. For a similar reason, do I have to wait for 1 bit-time after seeing TI before turning off the driver?

And if I'm the receiver (and let's say there are several devices listening to these messages) I understand that the RI bit sets half way through the stop bit of the character. Does this mean that if I want to reply to the message, I have to wait 1/2 a bit time (maybe 1 bit-time would be safer) after seeing RI before turning my RS485 driver on to avoid corrupting the stop bit, which could lead to receive errors in other listeners?

If they're necessary, what's the best way of implementing these delays for reliable RS485 operation?

Thanks - Rowan

--------------------------------------- Posted through

formatting link

Reply to
Loading thread data ...

You worry too much, just use RI and TI bits without any delays. There are a few internal delays that will take care about your concerns.

Anyway, look here

formatting link
Figure 14. will explain everything.

- while (1);

Reply to


If you are not using 9 bit mode already, then enabling that and sending a HI in TB8, will give the TI at the end of that bit (your stop bit). You have 2 stop bits, which is also a good idea to tolerate timing variations.

Note on TX, time ticks are always /16 , whilst on RX there is a monostable-reset on the start bit; That means you can have a phase shift between TX and RX.

Some 8051 info indicates a TX lead in, of always one whole bit clock (like a start bit preamble), and some other info says Start starts on the first bit tick after write.

Because of these variations, it is a good idea to toggle a pin on TI/ RI and scope the actual effects, and allow a comfortable turn-around time.

Reply to



The 8051's UART is a complete and fully functional system. It works very well even though the software is not good (i mean it is able to receive and transmit any data and to manage its RI and TI flags properly). There is no need of extra delays in the source code. In halfduplex RS485 or RS422 appications is not recomendet to switch on or off the communication converters very often. Many circuits can generate a long time signal(Hi or Low level) on startup, or when they are shutoff. Sometimes this is equal to short-circuit and all data transmited over this period is destroyed. An other thing that can cause a problem is direction manage of the RS485 convertor. Be sure the communication line is free before switch the direction. In fullduplex applications only the arbitration is important.

--------------------------------------- Posted through

formatting link

Reply to

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.