On Mon, 18 May 2009, Vitaliy wrote: > solarwind wrote: > >> :) been explained in some posts. > > > > Yeah, well, I'm confused. People say listen to your own transmission. > > Then they say it wont work. What do I do? > > People who say you can't listen to your own transmission, are trying to > confuse you. :) Yes, it can be a problem, but for now assume that you can > tell a "1" from a "0". > > So, how do you detect a collision*? Like this: > > - Assume that "1" is recessive, and "0" is dominant. When both are > transmitted, "0" always wins. > - Transmit a "1" > - Wait a short time (say, 1/10 of a bit) > - Read the output (the assumption here is that your Rx pin is connected to > your Tx pin). > - If the output is "0", you lost arbitration. Stop transmitting, and wait > until the bus is idle again. > > Vitaliy > > *In this case, there really is no collision, we just say that you "lost > arbitration". A collision implies that the message is destroyed (like it is > in Ethernet, for example). > don't you actually mean "*kind* of like this" and not "*exactly* like this" 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. 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. 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. Regards Sergio Masci -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist