How do different microcontrollers interact with each other?
Mrincognito
Posts: 9
I look to the arduino which has its own language syntax and then to BS2 to discover that it also has its own language syntax. With two completely different languages, can a person use both in a project or are people limited to using one microcontroller or multiple controllers that utilize the same language? Can these controllers ever interact with one another (if so, how? What would the primary programming language be?).
Comments
Paul
You can communicate almost anything, so long as you can program each in its own language. They communicate via more universal means like logic high/low, UART, light, and RF.
What did you have in mind?
What hardware do you have other than the Stamp and Arduino? Do you have any XBees?
It might be hard to find a serial example using a Basic Stamp and an Arduino there are some considerations with pin voltage and speed. I've made the two share info using XBees, but it sounds like you're looking for a wired connection between them.
A. Hardwire does require that you match appropriate voltage levels and address issues that affect the speed and quality of the signal. I think RS232 is quite adequate if you just find the right speed.
B. Means of communication - This tends to be all about packets. Sure you can do a byte at a time and get by, but at some point you may want to actually design your own package with a header, some content, and an End of File signal. In some cases, you might include a Cyclical Redundancy Check to verify accuracy... so that a corrupted packet is identified, and ignored.
It really isn't that hard to get one microcontroller talking to another as all microcontrollers have some means to reaching out to other devices. You just have to know what you want to do, where you want to do it, and why you want to have the two exchanging data.
With each device having a different programing language, you just create a third common language appropriate for the task you desire to accomplish. That 3rd language can be a rather primitive exchange of ASCII characters, with some Control characters indicating flow of information (Start of Text, End of Text, and so on). That a look at the whole ASCII code scheme and you will see it is quite adequate for a heck of a lot of things.
Its all about defining interfaces. ANY project that has for example a prop talking to for example a sensor over serial at 9600 baud defines the interfaqce: This guys says this and listens to that; the other guy say that and listens to this. When the "goes-intas" match the "comes-outtas" you're in business.
Same with micro controllers. If both talk at say 9600 baud at 3.3volts, and one sends characters A, B, D, or D, and the other know what those mean; and responds with J, K,L, M and the other side know s what these mean, then you are in business.