Hi! I want to Know how to connect and program multiple AT89c51 on a common serial bus so that no one can produce conflict with another client AT89C51, how can i ensure the bus conflict in case of multi master system.What would be the maximum number of clients i can handle on this common bus system.can i find some theory/stuff/material regarding this issure. Regards! Ahmad Kamal.
Ahmad, Multi-master serial systems can be a tricky situation. One possible way (although I'm not sure if this retains the multi-master moniker) would be to implement a token-passing scheme. Use some structured method to pass the token from one node to another, and then when that node owns the token, it is free to act as master. When it's finished, it passes the token to the next. Looking up "token passing" will give you some idea what I mean. This is what the old "token ring" ethernet networks did to try to prevent conflicts. Also, depending on how you define conflict, you might implement a physical layer that provides collision detection. This is what 10Base-X implements for Ethernet. If two things try to send a packet at the same time, they each pick a random wait time and try again. This has its own set of worries associated with it as well though.
how can i ensure the bus conflict in case of multi master system.What would be the maximum number of clients i can handle on this common bus system.can i find some theory/stuff/material regarding this issure. Master-slave is (typically?) collision avoidance, whereas multi-master (typically?) is collision detect. I can not see any way you can have multiple masters with collision acoidance, to avoid cillision, you would need a "masters master" For examples of collision resolution, have a look at the IIC bus or the J1708 standard. I, personally, have avoided multi-master as the plague, except when forced (such as communicating with j1708 devices) you do what you want, I would have a REALLY good look and see if I could do the needed with a master-slave rig. Erik The best (and most) IIC appnotes i: http://www.semiconductors.philips.com/buses/i2c/support/index.html A little true story about collision detection: In the J1708 standard, the rule is that when a collision is detected, the transmitting devices insert a random delay before attempting the transmit again. Two devices, both using the Keil rand() function collided and, had I not stopped them, they would still be fighting today. The Keil rand() insert the same sequence every time it is used.
A bit more info: What would be the maximum number of clients i can handle on this common bus system Using "1/8 unit load" RS485 transcievers, you can have 256 units on the bus. With standard transcievers (75176) you can have 32. An addition to my "Master-slave is (typically?)..." post above: conflict detection buses are (most often?) single ended (noise sensitive). Conflict avoidance buses can be differential (noise resistant). Erik
Master-slave is (typically?) collision avoidance, whereas multi-master (typically?) is collision detect. You're omitting the middle way, as used by CAN bus: arbitration. This allows several simultaneously started messages, forming a collision, but makes sure that by some point in the communication cycle, the situation is resolved, leaving a sole surviving transaction going on unharmed by the collision. One way of looking at this is as a collision avoidance system using a many-level hierarchy of master privileges, defined dynamically on a per-message basis, rather than statically on a per-node basis. Another way of looking at it is as a collision detection system that avoids wasting the bus time already used up by the time the collicision is detected. It does this by allowing one of the colliding messages to continue, as opposed to killing off all of them, which would eat up bandwidth proportional to the collision rate. [...] The Keil rand() insert the same sequence every time it is used. Of course it does --- as does every correctly implemented C library's rand() in the world. It's a requirement for rand() to behave that way, and the reason why srand() exists.
Thanks Every one who anticipated toward my request ,furthermore how can i code a ring buffer Regards. Ahmad Kamal Nasir
Maybe this helps: http://www.keil.com/download/docs/intsio.zip.asp If not, search the programs in: http://www.keil.com/download Reinhard
Language, language from Arabic (I assume) to English to German a ring buffer becomes a circular buffer :) Erik Anyhow, Ahmad, I would avoid the ring buffer concept, it is a nightmare when one node goes down. Erik