View Full Version : Acheiving Real Time Response

01-25-2006, 03:29 PM

I am a new user of basic stamp. I'm on a robotic project that needs me to control a servo motor using the encoder. The motor has to turn in exactly the same amount as the encoder, and the encoder is controlled by the user. I can achieve this using basic stamp but the response is a little slow; the motor started turning just a bit later after the user turns the encoder. Is there a way to obtain real-time response using basic stamp, or something close to real time? i would like to ask wat is the limit on the response speed of basic stamp, say for the latest 2px.

Thank you.

Kevin Wood
01-25-2006, 04:54 PM
I believe that the limitation here is the time it takes for the PBasic code to be interpreted. The faster stamps get more done in the same amount of time, so the response would be faster, but you might want to skip the Stamps, and use an SX. The SX can be clocked to 75 MHz, and can achieve 75 MIPS. You can program it in SX/B (Basic) or assembly.

For the Stamps, there is a spec sheet that you can download that lists the approx. # of instructions per second that the stamps will perform. The BS2 is ~4000, the Px is ~19,000. So you should see an increase of responsiveness. But for comparison, the Px uses an SX48 processor clocked at 32Mhz to give you the ~19,000 IPS. You could run the SX48 at 32MHz, and get 32 Mips. Or run it at 4MHz for 4Mips.

Paul Baker
01-25-2006, 11:38 PM
While there is limitations to the responsiveness of a Stamp as Kevin has pointed out, still execution of commands in the hundreds of microseconds should apear to a human observer to be fairly instantaneous. Can you post the section of code where this is occuring, I think your problem may lie within it. More specifically which commands you use to implement the functionality, there is always more that one way to achieve the same objective, some are better suited than others.


Ryan Clarke
01-25-2006, 11:53 PM
Have you seen the experiment in the What's A Microcontroller? book page 152 (activity #4: controlling a servo with a potentiometer)-

You may consider this approach as well...


Ryan Clarke
Parallax Tech Support

RClarke@Parallax.com (mailto:RClarke@Parallax.com)