Serial comm to multiple stamps
GlennT
Posts: 3
I am interested in communicating·with several stamps using serin/serout, but using addressing rather than polling a series of inputs.· Most of the info that I've seen uses more of a master/slave relationship with the master polling a series of pins with a slave connected to each pin.· I envision using a uart and then·inverting / anding the outputs to act as a chip select, to address each stamp. I'd like to solicit advice from anyone who has done anything similar.
Thanks!
Thanks!
Comments
serin pin, baud, [noparse][[/noparse]WAIT("A"), data
and from the master you send
serout pin, baud, [noparse][[/noparse]"A", data]
Use WAIT("B") for Stamp 2, WAIT("C") for Stamp 3, and so on
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
Do you have a Stamp Tester yet?
http://hometown.aol.com/newzed/index.html
·
The nice thing about a multi-drop RS-232/UART based network is you only have to run a few wires. If you now add chip-selects to that mix, you now have to run more wires.
That's why most implementations DO use a 'master-slave' protocol for this -- a master 'requests' data, and the slaves 'answer'. It takes the least amount of hardware and wire to do it this way.
Oh, wait, reading your post again, it looks like you think you can only connect one 'slave' to each pin of the 'master'? In fact, you can 'party-line' a pin of the 'master' to multiple 'slaves' (using 'Open' baud modes, that's what they're for). And 'party-line' a response line back from multiple 'slaves' to the 'master'.
You can also use a 'token' scheme to allow any BS2 on the 'network' to become the 'master'. In this scheme, one BS2 has the 'token' to be 'master'. All the other BS2's act as slaves. Should the 'master' not talk for a period of time, then one of the 'slaves' becomes the new 'master', and gets the 'token'. There may need to be some negotiation with the other slaves to insure only one decides to become the 'master'.
GlennT
The topic of open baud modes is somewhat unique to the PBASIC Stamp. A discussion about that aspect, and multi-Stamp networking using that technique, can be found in the Parallax PBASIC Stamp Manual.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
The solution to this is the 'open baud mode'. In an 'open baud mode', the BS2 pulls the signal to ground, but a 10 Kohm resistor is tied between the pin and +5, so the pin can 'float' high. Thus the pin is never 'driven' high, and you don't get the destructive fighting.
If two 'senders' try to send at the same time, the data on the line will be garbled, but no destruction will result.
Now, the BS2's have this 'open baud mode', so you can connect multiple senders together. I don't think UART chips do, however.
Your application seems perfect for a native Microchip PIC processor -- or for that matter the SX processor-on-a-card that Parallax sells. That would let you use a programmed SX card for each I/O node, and the open baud modes, probably for less cost than the UART based solution.
If you're doing this just once, buying the BS2's may be the most cost effective solution. If you're doing this more than once, spending the additional infrastructure dollars for a PIC programmer etc. would be a good idea. The SX-based solution would be a middle-of-the-road approach.