??? 05/22/08 23:59 Read: times |
#155045 - Thie problem is exactly analogous to,,, Responding to: ???'s previous message |
This problem is exactly analogous to the problem faced with when to safely turn the driver/receiver enables around for use in RS485 protocol. One must retard setting the change of the transmitter direction control until after the stop bit of the last bit is transferred.
One way to do this is to setup a simple timer delay interrupt. Each time you put a byte into the UART port output you reset the timer period to a maximal period of about two UART character shift times (taking your baud rate into account). Then if the timer interrupt ever occurs then you use that time to go out and toggle off the transmit enable. You let the protocol design take care of the times when the receiver is in process. Your code always knows if it is the midst of receiving a packet. In that state you have logic to either decide to abort in-process receive commands/data or let them complete before clamping off the serial port. In cases where receive stuff is not yet in process you simply clamp off while not worrying about the possiblity of something coming. It does however behoove you to make sure that the sending logic at the other end implements proper transmit timeout logic. Michael Karas |
Topic | Author | Date |
Asynchronous Serial Port handshake? | 01/01/70 00:00 | |
Question isn\'t quite clear | 01/01/70 00:00 | |
Thie problem is exactly analogous to,,, | 01/01/70 00:00 | |
Protocol? "We don't need no %$#@! protocol!" | 01/01/70 00:00 | |
Good Luck | 01/01/70 00:00 | |
Sorry to step on your toes ... | 01/01/70 00:00 | |
'right now' | 01/01/70 00:00 | |
sounds to be a case for an external UART... | 01/01/70 00:00 | |
RE sounds to be a case for an external UART... | 01/01/70 00:00 | |
double post, ignore | 01/01/70 00:00 | |
It could be none at all ... | 01/01/70 00:00 | |
Switch | 01/01/70 00:00 | |
The goal is to minimize the data loss | 01/01/70 00:00 |