You are correct! The TXIF is set when TXREG is empty, but not when the transmit shift register is empty. There is a TRMT bit you can poll, but it will not generate an interrupt. What I've done in similar situations is to have a timer interrupt that's a little longer than one character time. In that interrupt, I check TRMT and decide what to do. Further, since I'm putting data in TXREG based on TRMT instead of TXIF, I know the character will be done transmitting in about one character time, since there is nothing in the "FIFO." What gets put in TXREG is immediately transmitted if you don't put anything into TXREG until TRMT is true. Good luck! Harold > Hi, all > > Although this subject has being around for a lot of time, I was not able > to find how can I switch the RS485 driver (AD485) from transmiting to > receiving just after the last bit transfered using the embedded USART of > the PIC17C756A. AFAIK, we have two buffers, one acessible to the user > (programmer) and the other not, the first is the logical buffer that > will transfer its contents to the second buffer, that will be used to > shift out the bits to the RS485 line through the inverter. As far as I > know, the USART sets an interrupt after the logical buffer gets "empty", > so I don't know exactly when the transmission ends so I could enable to > recieve information just after the last bit is sent. > > Any hint, link, flame ;-) ? > > Thanks > Francisco > > -- > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > -- FCC Rules Online at http://www.hallikainen.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body