> I'm running a network of instruments using a 4 wire RS-485 scheme, > where there is a single master and multiple slaves. All the slave > receivers connect to the master transmitter, and all the slave > transmitters connect to the master receiver. I have logic that > automatically switches all the slaves into receive mode whenever the > master drives it's transmit signal active. > > All the slaves contain PICs (18fxxxx) and use the UART to implement the > RS-485. > > I Now want to make a different version that operates as a party line, > with all transmitters and receivers connected together. To do so, each > node has to know how to turn off its transmitter as soon as it has > finished a transmission. > > What's the cleanest way, in a PIC, to do this? I think I can't use the > UART Transmit interrupt, because it does not tell you when the last > byte has gone out on the wire. I know I could use a timer but consider > that my solution of last resort. I'm looking for any other ideas that > would let me turn off the transmitter at the earliest possible moment, > as soon as the last transmitted byte is on the wire. You might be able to get away with this: Send an extra byte at the end of your message. As soon as you get the UART transmit interrupt for this byte immediately turn off your transmitter. Depending on your maximum interrupt latency you will end up with a short 'glitch' on the outgoing wire. This may or may not be interpreted as a start bit by other devices. You could possibly get rid of the glitch by adding an RC network between the PIC and the RS485 chip. Yes, I know, this is sick! Bob Ammerman RAm Systems -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist