Shop OBEX P1 Docs P2 Docs Learn Events
How do different microcontrollers interact with each other? — Parallax Forums

How do different microcontrollers interact with each other?

MrincognitoMrincognito Posts: 9
edited 2013-02-14 11:11 in General Discussion
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

  • doggiedocdoggiedoc Posts: 2,243
    edited 2013-02-13 15:55
    It should be as simple as a serial connection between the two. Each is programmed in it's own language to interpret the communication from the other.

    Paul
  • MrincognitoMrincognito Posts: 9
    edited 2013-02-13 16:01
    I see but doesn't it matter what sequence of 0's and 1's gets transferred between the two different controllers? What can be communicated? (Perhaps you can link me to a project/tutorial that demonstrates how serial communicate can work between two controllers?)
  • xanaduxanadu Posts: 3,347
    edited 2013-02-13 16:28
    Welcome to the forums. Great topic too.

    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?
  • xanaduxanadu Posts: 3,347
    edited 2013-02-13 16:53
    Yes it matters, have you seen this PDF? http://www.parallax.com/dl/docs/cols/nv/vol1/col/nv16.pdf It's very good.

    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.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-02-13 21:50
    Consider at least two levels of matching - hardwire, and means of communication.

    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.
  • prof_brainoprof_braino Posts: 4,313
    edited 2013-02-14 09:34
    I see but doesn't it matter what sequence of 0's and 1's gets transferred between the two different controllers? What can be communicated? (Perhaps you can link me to a project/tutorial that demonstrates how serial communicate can work between two controllers?)

    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.
  • HumanoidoHumanoido Posts: 5,770
    edited 2013-02-14 11:11
    Two different processors with two different languages can mix, react, communicate, interact. Just follow the basic rules of the type of interface connections and communication rates. There are projects with Stamps and Propellers mixed. In the past, projects mixed 3 languages. Other projects mix the type of Stamps. You can also mix entire computers. Industrial computers interface and communicate with many different computers.
Sign In or Register to comment.