I2C Network of p240s?
Bill Chennault
Posts: 1,198
All--
I am not an electronics genius. I am more of an electronics moron. However, I need single bit sensors and a way to control relays. I need lots of both. Therefore, with its I2C bus and 32 I/O lines, I was wondering if there is a simple way to place multiple (more than two) Stamp p240 devices in an "I2C" network? IF I could do this, then I would have access to a lot of I/O, which I could process on-board via tablet PC and off-load wirelessly for a PC or a network of PCs to consider.
But, is it possible to create an I2C network of Stamp p240s?
Thanks.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
I am not an electronics genius. I am more of an electronics moron. However, I need single bit sensors and a way to control relays. I need lots of both. Therefore, with its I2C bus and 32 I/O lines, I was wondering if there is a simple way to place multiple (more than two) Stamp p240 devices in an "I2C" network? IF I could do this, then I would have access to a lot of I/O, which I could process on-board via tablet PC and off-load wirelessly for a PC or a network of PCs to consider.
But, is it possible to create an I2C network of Stamp p240s?
Thanks.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Comments
You could use a single Stamp with I/O expansion devices. The 74HC595 provides 8 latched output pins with only 3 or 4 I/O pins and the devices can be cascaded to whatever length you want. The 74HC165 provides 8 inputs with only 3 I/O pins and can also be cascaded.
You can also create a serial network using several Stamps (and the tablet PC). There's information in the Stamp Manual about how to do it (in the section on the SERIN and SEROUT commands).
You could even do what you're suggesting more cheaply by having a single BS2 be the 'gateway' for your PC, and have it control (using SHIFTOUT/SHIFTIN) multiple 'slave' '595's for outputs, and '164's for inputs.
At lunch, I had already figured out I had dumbed off. Since I know very little about electronics, I am wondering about the concept of simply using a BS2p40 at the top of a hierarchy of BS2-IC stamps? (Remember, I am a novice to microcontrollers.) Why couldn't I simply tie a BS2p40 output·directly to the input of of BS2-IC? This would theoretically give me control of 32 BS2-IC Stamps via the BS2p40. Therefore (again, theoretically), I would have 32 x 16 = 512 I/O ports.
Then, I would let the BS2p40 talk to the tablet PC via USB and the whole "Stamp I/O Machine" would like one MSComm port in VB. (I would build the conglomerated Stamp output syntax·either in the BS2p40 or in the tablet PC and parse it back out in the tablet PC. And, I would do the same thing in the tablet PC in the other direction.)
Tell me where I err in an idea like this.
Thanks!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
I looked up some data sheets on the 74HC164s. If I could even SPELL electronics, this is doubtless the way to go. Alas, I can't. I wonder if someone makes something that I could BUY and HOOK UP? (I do like my cascading Stamp idea, but I can see how inefficient it is. However, it does provide some level of processing power at every level.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
I just bought Whats a Microcontroller? Parts Kit and Text (v2-2) and Process Control Parts and Text. This should get me started.
Back in the old days, we built networks--prior to the invention of the term "LAN"--using Datapoint's ARCNet. (Before THAT, we built them using serial ports and then eventually UPGRADED to parallel ports.) In any case, ARCNet was a token passing protocol. Although it was physically a star, or string of stars, each node had a physical address and each node maintained a table of addresses, sorted numerically. The "token"--just some specific bytes--circulated among all the nodes according to this table, thus, although it was a physical star, ARCNet was a logical ring. Each time a node had the token, that node had access to the network. Thus, unlike ethernet, ARCNet was a deterministic network.
Well, I was thinking that a BS2p40 could easily use a single output·line to which all other Stamps were connected by a single one of their input lines. Each Stamp would be assigned an identifier. When the "master" (the BS2p40) formed a command for a particular stamp, it would simply preface it with the desired Stamp's identifier and send the whole thing to every stamp at the same time via the single output line dedicated to that purpose. Each Stamp would then check to see if the identifier was its identifier. If it was not, then that Stamp would simply ignore the command. However, if it was, then that Stamp would execute the command.
Multi-Stamp commands could easily be constructed by the BS2p40 by using the unique identifiers to which multiple Stamps were programmed to·"listen" for. That way, you could execute an entire series of commands at the low-level Stamp that would do a certain fundamental task. (Like cause four leg motors to move.)
What am I missing or erroneously assuming? (I see no reason to quit learning just because I have bought some stuff!)
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
The reason people use the '595 and '164 is cost, usually. If each BS2 costs $50, 16 of them is $800. A '595 is around $1.00. So if all you want is 256 outputs (16 x 16) then 32 '595s will get that for you for $32. If a BS2 cost $1.00, then why mess around with the '595?
Another reason is speed. The SHIFTIN/SHIFTOUT clocking runs at about 56 KBits/Sec. The SERIN/SEROUT runs at 9600 or 19200 baud, AND has syncronization delays while the 'slave' BS2's 'listen' (there's NO serial buffering, they MUST be 'pended' in a SERIN or they'll miss data). There's ways of working with this, but it is an issue.
Bottom line: The BS2p40 lets you decide how many I/O pins you need, and how much 'local intelligence' you need.· If 'raw I/O', with no intelligence is needed, then a BS2 with some '595s may do it.· If LOTS of 'local intelligence' is needed, then more than two BS2p40's may give you that.
Were I you, I'd probably prototype a system with a BS2 'master', two BS2p40 'slaves', a subset of the desired I/O, and try it out.· Sounds like you're on your way down that path, actually.
Post Edited (allanlane5) : 9/26/2006 3:24:21 PM GMT
I worked for Datapoint's research department when ARCnet was developed. It actually was a successor to a simple open-collector party line bus used for file transfers and printer servers. You could certainly implement a similar master-less token passing system if you want.
Mike
You worked for Datapoint! WOW! You are my hero! Datapoint (ARCNet, actually) made my entire career! I bet you have a lot of stories.
--Bill
ps I am still waiting for the 20MB/s version!!! [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Re: "The reason people use the '595 and '164 is cost, usually. If each BS2 costs $50, 16 of them is $800. A '595 is around $1.00. So if all you want is 256 outputs (16 x 16) then 32 '595s will get that for you for $32. If a BS2 cost $1.00, then why mess around with the '595?"
I know you are correct about using the Stamp and some chips to do I/O. I am simply not an electronics-type person, much to my chagrin. (However, if I can find some good hints, I can do a lot of research and maybe gin something up that doesn't smoke very much.)
The bottom line is that I need only a little intelligence and LOTS of I/O. A BS2p40 and your recommended method is doubtless what I REALLY need. Where can I find a schematic? One that will make it clear how to add bits, as necessary?
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.
Thank you for your forbearance.
Successfully downloaded and saved . . . now!
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.