sergio masci wrote: > Sorry to be pedantic but if you're going to give examples shouldn't they > either be bullet proof or explain that they are simplifications. It was not my intent to write a complete protocol spec for SW. Sorry if this was not obvious. :) > Vitaliy's example works for one bit but it does not address the problem > that several nodes may be doing exactly the same thing at the same time > and each will think it has won. What you actually need to do is check each > bit of each byte. I thought this was implied? > However just checking the bit 1/10 of the way in is not > going to guarentee that another node has not started transmiting 2/10 of a > bit period after you. Check it 1/2 of the way in, or keep checking it in a loop, until you're done transmitting the bit. :) It really depends on how out of sync the nodes can be. Technically, the other node would not start transmitting if it saw a start of frame (dominant bit), so the situation you describe is impossible (node transmissions cannot be "late"), unless we're talking about really long transmission lines where propagation speed begins to matter, and very high baud rates. Of course, ideally you would want to either use a self-synchronizing protocol like PWM so you can detect idle bus and resyncronize every bit time, or use bit stuffing like CAN does. Otherwise a string of 1s will not look any different from idle bus. This is exactly why I'm saying that an off-the-shelf protocol would be best in this situation. There are too many "what if"s. There are plenty of unknowns in any OTS protocol that SW picks, to make them challenging. Vitaliy -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist