RS485 uses 3 or 4 lines for control. In addition to the TX and RX lines you have TXenable and RXEnable. You can normally connect TXenable and RXEnable together because they use opposite logic. To be able to detect collisions, you will have to provide separate lines for TXEnable and RXEnable so you can transmit a bit and receive at the same time to check if the bit you put on the RS485 lines is there or if there is another device trying to transmit a different bit at the same time. With RS485 I don't think you have to bother with waiting for idle time on the bus, just go ahead and transmit, if you detect a collision, just wait a short time then re-try. If two devices transmit at the same time, only one of them will see a collision (I think its the one that tries to send a 0 when the other is trying to send a 1). While both devices are sending the same logic state, no collision will be detectable. The only problem I am having with all this is making sure that all TX are synchronised. I think it should be possible to have one device on the bus send a sync packet, and have all the other devices take timing from that, though I havent tried this yet. Another approach might be to only use master/slave access to the bus. Only allow one master to request information from a slave. A slave can only transmit when it is replying to a command from the master. Kieran sullivan ---------- From: Antonio Almeida[SMTP:deec352@TOM.FE.UP.PT] Sent: 08 April 1997 14:55 To: PICLIST@MITVMA.MIT.EDU Subject: collision detection Hello, I am building a PIC network and i pretend to use RS485 chips. I will use the built in UART to drive them but i need a way to detect collisions and network idle state, what i think i should do it's when i send a byte from the UART, or pretend to send it, i monitor the line with another pin (neither TX or RX) looking for diferent bits. Something link this: --- | ------- Is this ok or am i forgeting something. I Tx|----->| |-- never used RS485 chips before, they go down | | RS485 | when more then one drive the line? Rx|<--+--| |-- | | ------- |<-- | --- Antonio Almeida