David, If you could, turn off the HTML please. > > I am building an RS485 communication network which has several nodes = > connected in multidrop to a common bus. (2 wire + GND ,half duplex). > I am using PIC16F86 and writing code in 'C'. > Does anyone have a reliable and compact protocol I can implement on my = > network to allow nodes to communicate with each other with minimal = > collisions ? Actually the best way to do it is with no collisions at all. Two basic ways of doing it: 1) Polling. Have a primary node give each seconday node an opportunity to use the line. Biggest problem is the latency if only one or two stations want to speak. 2) Arbitration. This is one I've been thinking about but haven't yet implemented. Someone (I think it was Scott) posted a pretty cool protocol that pulsed then released the line during arbitration phase. Then each station who wanted the line would wait. One of two things could happen. First the line remained idle until the node's assigned time slot. In which case the node would assert the line thereby grabbing it. Or at some time before the assigned time, someone else grabbed the line in which case the node waits until the next arbitration cycle. I was concerned about fairness where an earlier node could hog the line. So I proposed adding a set of secondary time slots after the primary slots. Once a node has used the line, they park in their secondary slot until no one uses a primary slot, then all secondary slot holders can move back to their primary slots. So in situations where everyone wants to talk all the time, each node that uses the line would be forced to wait until everyone who hadn't used the line finished. Again I haven't implemented any of this yet. It's on my list of things to do but it may be 6 months before I get to it. Hope the idea helps. For quick and dirty use polling. BAJ