Robert, you are wrong... remember that there is a whole byte waiting to be send in the hardware register when TMRT flag is setting. You have to wait a certain time (depending on speed and if parity bit is send) until you can switch from transmitting to receiving. I use USART to control 485 driver with a very small gap between finishing sending and reading the answer. It's (by my meaning) a taugh task when there is a lot of another interrupts not allowing you to switch a line to receive in a proper time. I consider to add one more buffer to USART sender is a mistake or at least it could by configurable. Regards Igor -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU]On Behalf Of Robert Reimiller Sent: Wednesday, April 30, 2003 8:16 PM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [PIC]: TRMT vs TXIF (was "Data transfer from P16F877 to serial PC") On Wed, 30 Apr 2003 11:07:55 -0700, you wrote: >>> The TRMT flag tells you that the whole byte has >>> actually been sent on the wire. >> >>No, it does not. It tells you that the transmit >>shift register is empty. It does not mean the UART >>has finished transmitting it on the wire. > >Interesting. If this is true, then none of the >examples posted are correct uses of checking TRMT=1: > If you look at the timing diagram in the data sheet, the TRMT bit gets set at the beginning of the stop bit. You should wait one bit time extra before disabling any buffers or letting another unit start transmitting. -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body