The way we handle end of transmission flags is that we preset an interrupt timer, or one serviced periodically, with a value that times out after the last character has sent its stop bits, PLUS a stop bit. We then turnaround the RS485 channel to receive when that timer downcounts to 0. It is only necessary to set the timer for the LAST character of the message. --Bob EDTec LLC ----- Original Message ----- From: "Geo" To: Sent: Friday, November 22, 2002 8:44 AM Subject: Re: [EE]: Rs232 - RS485 converter circuit > On 22 Nov 2002, at 6:25, Dave Tweed wrote: > > > On an 8051 system with RS-485 that I built, I had a set of software timers > > that were driven by an interrupt from the same hardware timer that > > generated the UART bit rate. When I put the last byte into the UART > > transmit buffer, I just started a software timer for 20 bit times, and when > > that timer expired, I turned off the transmitter. 20 bit times allows > > enough time for the last byte to go out, plus one full byte time of > > enforced idle time between packets. > > Hmm - well with the AVR 2313 etc there is also a UART Transmit Complete > interrupt "when the entire character (including the stop bit) in the Transmit > Shift register has been shifted out and no new data has been written to the > UDR. This flag is especially useful in half-duplex communications interfaces, > where a transmitting application must enter receive mode and free the > communications bus immediately after completing the transmission". > > I used this for a 485 controlled remote device. Is it true that the PICs don't > have this facilty? (I've only used 16f84s). > > George Smith > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > > -- http://www.piclist.com hint: To leave the PICList mailto:piclist-unsubscribe-request@mitvma.mit.edu