One Wire Method: Assumptions: One PIC is master and others are slaves Each Slave PIC knows its "address" (either loaded in code or by input pins set appropriately) Speed of serial stream defined so that all slaves know how fast to sample the data from the host and how fast to send data back to host. Operation: At Reset all slaves go to listen mode Master Sends out an ATTENTION code containing a target address and then sets I/O to input to listen for response All slaves see the ATTENTION, but only the one whose address matches responds to the master with an ACKNOWLEDGE and then goes back to listen mode If no ACKNOWLEDGE is received by the master within a defined period of time, it assumes the PIC at that address is dead or busy or otherwise indisposed. Note the ATTENTION can consist of command and/or data for the slave(s) and/or request for data from the addressed slave. Problems: No method for slaves to notify master that they need attention, so the master must regularly check on the slaves to see if they need to be serviced. Slow since the serial stream must be sampled multiple times to establish when bits are valid. Two Wire Method: Many two wire methods are possible, but using an established protocol may reduce time to develop Assumptions: Use I2C (or a derivation) allows multiple devices on a two wire bus. Either do a full up I2C or adapt it for your specific requirements. Advantages: Well defined, existing protocol. Uses a clock so the data transfer is not asynchronous Three or More Wires: Advantages: Can add functionality (e.g. allow slaves to interrupt master), Disadvantages: Requires more pins David W. Gulley Destiny Designs Russell Farnhill wrote: > Hi all, > > I want to be able to control six F84's from a master > F84. I think my options are I2C, SPI or some serial link. > > It would also be nice if the slaves could send data back > to the master as well. > > Looking on the net I find lots of I2C routines, but they > all seem to be for the master and not for the slave. > > Does anyone know where I could get a simple set or routines > in 'C' for slave and master to get me going. > > SPI... Don't really know anything about this so I'll look > at this if I can't get anywhere with I2C or Serial. > > lastly Serial... > > I think this is my best chance of success because I've already > got one pic talking to another and probably just need to expand it. > > Would this serial set-up work ? > > 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 ? > > Any suggestions, help appreciated. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.