Shop OBEX P1 Docs P2 Docs Learn Events
Acheiving Real Time Response — Parallax Forums

Acheiving Real Time Response

JTayJTay Posts: 3
edited 2006-01-25 16:53 in BASIC Stamp
Hi,

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.

Comments

  • Kevin WoodKevin Wood Posts: 1,266
    edited 2006-01-25 09:54
    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 BakerPaul Baker Posts: 6,351
    edited 2006-01-25 16:38
    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.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • Ryan ClarkeRyan Clarke Posts: 738
    edited 2006-01-25 16:53
    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

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ryan Clarke
    Parallax Tech Support

    RClarke@Parallax.com
Sign In or Register to comment.