On Feb 9, 2007, at 2:30 PM, Vitaliy wrote: > The reason handshaking exists, is to protect the buffer of > the receiving device from overflowing. Well, no. "hardware flowcontrol" as commonly used doesn't really exist according to any specification. RTS/CTS is supposed to be more about signaling the modem which direction data will be flowing, so that the modem can do its half-duplex things. "deep fifos" (ie more than one byte) are recent enough that they're not well handled by traditional rs232 protocols. It's very hard to implement "hardware flow control" in software, for instance, because the software is on the wrong side of the FIFO status. UARTS with DMA capability are even worse; they're in serious need of status bits that mean "a DMA is in progress but hasn't hit a termination condition yet" that usually doesn't exist. If you want to transmit a string of data and then cause some other externally visible signal to change AFTER the data has been transmitted, you have to monitor your own software FIFOs, any hardware FIFOs, the transmitter holding register AND the transmit shift register to make sure your data is fully transmitted. This is usually possible on a hardware uart; many have a "transmitter empty" status bit in addition to a "space available in tx fifo" bit. I think it's more difficult to retain the proper timing of RXdata and RXsignals; I don't think I've ever seen the necessary "partial character received" status bit (although I think some UARTs claim to only poll the modem signals "in between" characters; One potential difference between "real" uart status bits and GPIO bits used as such...) To implement a closely timed half-duplex sort of system, it might make sense to handle all your signal changes in the same SW FIFO and ISR as data, so that "rts_off()" ends up queuing a special data sequence (00 01 ?) on the software FIFO, and nothing actually happens until the TX ISR dequeues that command from the FIFO, at which point it would toggle your signal. The receiver ought to be easier. Just because you see a signal that says you can stop receiving doesn't mean you have to fully disable the receiver. You can theoretically poll for the last dribbles of characters a bit later (even after you start transmitting.) BillW -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist