A quick question about microcontrollers
cameron
Posts: 33
I am new to this but I was just wondering how do most micro controllers communicate with each other via serial connection or is the another standard? Or are there lots of standards can anyone give me an idea.
Thanks,
Cameron
Thanks,
Cameron
Comments
Does anyone else have more information.
There are many ways for microcontrollers to communicate between and among each other. I am certainly not an expert in any of them . . . except the one that I created because everything else seemed too slow. Without an interrupt structure, the Stamp is subject to waiting for events to occur. The various POLL commands are attempts to circumvent this issue. I hate to call it a problem, because we are trying to use Stamps to immediately respond to asynchronus events when their primary design purpose is to CONTROL the external world with little regard to handling an unexpected event.
Although I have never been able to find numbers, I believe that affecting the status of an I/O pin executes very, very quickly. Therefore, after a lot of thought--all of which was probably obvious--I got around the serial communications standard problem; it is slow, especially on a Stamp. I decided to use some of those I/O pins on a Stamp to send messages to another Stamp. Actually, I dedicated a low-end Stamp (the BS2) to each major task. For example, I have two BS2s dedicated to simply controlling the motors to which they are attached (via motor controllers). The resulting code is VERY simple and VERY short. This is IDEAL for a microcontroller like the Stamp.
I dedicated two more BS2s to simply watching the optical encoders on the the two gearmotors. All they do is count encoder events and signal the Master microcontroller (explained in a moment) concerning the counts.
The Master microcontroller has 32 I/O pins. I dedicated five to each of the four Slave Stamps (for a total of 20 I/O pins on the Master and five on each Slave, leaving 12 spare I/O pins on the Master and 11 spare I/O pins on each Slave) and devised a method to send commands to the gearmotor Slaves--or receive information from the optical encoder Slaves. I have no comparison numbers and I am a relative Stamp newbie. However, I am not a computer newbie. I am convinced that my method is many, many times faster than any serial communication that might be implemented with Stamps. Additionally, the code is very short and very simple.
However, all of this has a cost; hardware. Instead of one microcontroller running a robot or other device, I have FIVE microcontrollers and expect to add more as I add functionality to the tracked vehicle I have affectionately named Ugly Buster. But, microcontrollers are cheap. And, I am convinced I am using them in the fashion in which they were intended to be used: CONTROL, not responding to unexpected events, especially without an interrupt system.
I had to invent a very simple instruction set for the slaves. Each instruction is five bits in length and only communicates speed(s), direction, and shut down procedures. The problem is that this is not my·long-term traditional way of programming, which is·like yours: Just cut some standard code to do whatever you want. I have to think in terms of this instruction set I created. Of course, I have a tremendous amount of room to expand the instruction set, if necessary. However, I have gone the other way. I have decided that my robot needs only one speed and needs to·ramp up and down to that speed. Plus, it needs forward and reverse and some other simple stuff.
However, you asked about standards. There is nothing standard about what I am doing.·It IS simple. It IS far faster than the Stamp's most-excellent instructions·designed for serial communications.
Think outside the box.
--Bill
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.