What do you mean "has been stopped"? The UART has no flow control in asynchronous mode. What mode are you using? The transmitter has two registers. One is contains the byte currently being sent, the other contains the next byte to send. You can overwrite the TXREG with whatever you want and it will only be sent when the current byte is fully sent. If you want to reset the contents of both registers turning the transmitter off and then back on should do it. Perhaps you are only turning the receiver off and on, or the UART as a whole, but I suspect you may need to explicitly turn the transmitter off and back on. -Adam Thomas Olsson wrote: >Hi, > >I've been looking at app notes and data sheets, but I haven't found how to >do this. > >Basically I've got a 16F62x which has been transmitting data with the >USART, and has been stopped (due to a bus conflict), and then later it >needs to try again. > >When this happens, it needs to somehow empty TXREG of the data from the >previous aborted transmission. Otherwise the first byte sent will be one of >those that it didn't get to send last time. The internal TSR is apparently >emptied at some point, probably when TXEN is cleared, but I can't find hard >information about this either. In practice, it is always only 1 extra byte >lingering, and it corresponds to whatever was in TXREG when the >transmission was aborted. > >So, does anyone know how discard the contents of TXREG and force it into >the 'empty' state (where TXIF gets set etc.)? > >I've tried many things already, e.g. turning the USART off and on, but that >doesn't do it. > >Thanks, >Thomas. > >-- > 9876543210 Magic tab-o-meter. http://www.armware.dk/ > ^ > >-- >http://www.piclist.com hint: The list server can filter out subtopics >(like ads or off topics) for you. See http://www.piclist.com/#topics > > > > > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics