On Sun, Aug 05, 2001 at 10:27:21AM +1000, Peter May wrote: > Hi all. First off let me say I only tag along on this group as a second > source of info. I use PicBasic to program and cannot understand assembler at > all but still the engineering bits and pieces handy and informative. In no > way am I knocking assembler but am more knocking myself for not taking the > time to learn it. > > Anyway the question. > > > I want to create a network of micro's. So far rs485 seems the go. What my > problem is how to get them all to talk and not have I suppose PACKET > colisions. > > I have a PC that is connected to the world that I use as a Windows server > program. It is connected to the serial port and can send and recieve info > from that port. > > I have several pics on the network. > > I was going to make a hub or a main pic. One part of the hub connects to the > pc and another to the rs485. Bug probably isn't the correct word then, gateway is probably better. > > What is a good way of getting these devices to communicate? I was going to > have each device listen for an incoming ID string but this meant (well in > pic basic anyway) that part of the time it was simply sitting there > waitning. If nothing came in it would go off and do the rest of the program > and then come back and listen again. How would the hub know it was sitting > there listening and simply the sending of the string and the waiting for the > incoming could be out of sequence thus missing each other. Well that's pretty simple to solve. You didn't say which PIC you were using, but if you have a PIC with a hardware USART, they have a 9 bit mode which sends 8 data bits along with a 9th address/data bit. The cool thing about it is that you can program the USART not to interrupt unless the address bit is set. So it works like this: - All listeners setup the USART to interrupt on address only. - Some transmitter sends an address of the target. Note that the listeners can be doing something else because it's an interrupt. - The listers check to see if the address is theirs (or a broadcast presumably). If the address matches, that listener turns on receive all data. All the others return to normal duty. - So the target listener gets the data stream and all of the other nodes on the network ignores the data packet until the next address is transmitted. > > I use a cat 5 cable for the network so I have 8 wires I can use. Another idea is out of band signalling. > > Another idea was I use an additional wire other than what the data goes back > and foward on to send an id on. In picbasic you can use a command to send a > PULSE OUT of a certain length. I can then assign a ID to each unit and along > this cable send a lenght that matches the id. I have set up 2 pics and sent > a series of lengths to the second from 1000 to 5000 in steps of 20 and it > picks it up each time. So if we hang each device via a resistor and we have > the hub send a pulse out for say 500 millisecs and in each unit we have a > detection command in each cycle. This is out of band signalling. I'd argue that the pulse width is pretty long. I've described another way to do this here: http://www.infosite.com/~jkeyzer/piclist/2001/Jul/1317.html Note that the login and password are the name of this list. It involves a real short initial pulse and then a delay to a paricular time slot. The good things about the scheme is that polling is not required and that it's fair if everyone needs to use the network. Hope this helps. > > I think you get the idea. How do you guys do it? I am after a reliable way > to poll each unit. Additioanly if I could......be able to raise an alarm on > the hub if any of the units want to. > > I have the software written to do the internet comms part and can get that > ifo from remote sites to the hub.... > > Ideas???????.......Suggestions???????........ > > Regards, Peter. > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads