Dear Russel Farnhill, Russell Farnhill on 2001-05-04 11:40:26 AM > Master pic Tx pin wired to all six slave Rx pins > Master Pic Rx pin wired to all six slave Tx pins > > So now master should be able to send cmd's to any slave and > any slave back to master. Also I thought of using six more pins > on the master as Select lines going to each slave. So slave can > grab attention of master and help on bus collisions. > > I'am a little unsure about all the slave Tx pins connected together > on the master Rx pin, if all Tx's are low and one goes high to send > data, will this cause a short and blow the pin ??, if so could I use > some series resistor or something ? Yes. Since (most ?) PIC pins are rated to drive 25 mA without problems, a 5 V / 25 ma = 200 Ohm series resistor protects it from anything in the 0 to +5V range (I think this is conservative). (You can use much smaller resistors or no resistor at all if you are *sure* the other end of the resistor will never be shorted to ground when you're trying to output a hi, or +5V when trying to output a lo ...). Now if all the slaves are hi (idle state) and 1 tries to communicate (pulling lo), there's no damage done. But the master doesn't get the message. So we need something else ... >Russell Farnhill on 2001-05-04 10:25:50 AM > >So are the diode's there to stop a HIGH slave Tx pin being dragged low by >the other LOW >slave Tx pins ? > >Why do I need a pull-up on Master Rx pin ?, When I bread boarded a test >circuit >I just connected Tx -> Rx > Rx <- Tx >and this seemed to work ok. Your circuit works great with 2 PICs that need to communicate. What if 3 or more PICs need to communicate ? Using diodes and the pull-up is one method to keep the PICs from fighting over a line. But there are other ways. Here's one I've been thinking about: serial ring: .... ->[ Rx PIC4 Tx ]----->[ Rx PIC5 Tx ]----->[ Rx PIC6 Tx ]----->[ Rx PIC7 Tx ]--->.... with the output of the last PIC on the right (you can think of that one as the master) looped back around to the 1st PIC on the left. (Perhaps put a 200 Ohm resistor in each communication link in case of a software bug that accidentally set RX to Output). One transmission protocol idea: If a packet begins with destination ID = 0, then accept the packet and do something with it. Otherwise, decrement the destination ID number and forward the entire packet to the next PIC. (Don't buffer the entire packet). Advantages (compared to diode/pullup master/slave topology): (a) Simpler hardware than any other network I've seen: no diodes or pull-up resistors needed, because each line is being driven by one and only one source; only uses 2 or 3 pins on each PIC. (b) The theoretical bandwidth is much higher, because the bit rate is no longer limited by the RC time constant on the Master's Rx line (R = pull up resistor; C = parasitic capacitance of line). (c) Scalable to any number of PICs, without having to set unique ID numbers. (d) Easy to find out how many PICs are connected. (Think about what the master PIC recieves after it transmits a message that no one claims). Disadvantages (compared to diode/pullup master/slave topology): (a) the software on each slave is more complicated, because each PIC needs forward most messages to the next PIC. Token ring. (b) Latency between the master sending the command and a slave recieving it, and between the slave sending a response and a master recieving it, is worse. (c) Master can't transmit a global ``Now !'' command to get all slaves to do some (prearranged) activity simultaneously. Same for both (diode/pullup master/slave)(serial ring): +(a) Scalable to almost any number of PICs without adding more hardware at the master +(e) Both can be modified to use ``synchronous serial'' (the fastest serial communication on a PIC). Synchronous serial uses 3 pins on each slave PIC: CLK and Rx input pins, Tx ouput pins. (Generate CLK on master PIC ?). -(b) If a slave wants to say something, but it hears that another slave has already started transmitting a message, the slave needs to hold off on its own message, waiting for other slaves to finish talking, before it transmits its message. -(c) if it hears a message while it's transmitting, it needs to buffer that message. -(d) Every wire is essential to communication. (Fabric topologies can route around a few broken wires). Is there a better way ? -- David Cary -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.