Shop OBEX P1 Docs P2 Docs Learn Events
Can you pulsout more than one pin in the same command? — Parallax Forums

Can you pulsout more than one pin in the same command?

Robot JayRobot Jay Posts: 12
edited 2006-05-08 13:10 in BASIC Stamp
Is it possible to pulsout more than one pin with only 1 line of code?· I need·servos to act as simultaneous·as possible and I was curious if the BS can do this.· Thanks for your help.

Comments

  • BullwinkleBullwinkle Posts: 101
    edited 2006-05-08 01:35
    Could you connect the servos in parallel? Or do you need them to act independently as well? Even then, maybe you could have dedicated I/O pins for each servo one I/O pin that is connected to both.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-05-08 01:58
    The reaction time of the servos makes it such that as long as you're pulsing out no more than 4 or 5 then it will appear to be at the same time.· But no, you cannot affect more than one pin using that particular command.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Robot JayRobot Jay Posts: 12
    edited 2006-05-08 06:56
    I am asking this question because I am building a bi-pedal robot, so the·servos need to move idependently, and as close to simltaneously as spossible.· Do any of you think the BASIC Stamp 2p40 module can run about·8 servos without too much latency in the start of their movements?· I guess ultimately I will just have to try it and see what happens.
  • GadgetmanGadgetman Posts: 2,436
    edited 2006-05-08 09:53
    There IS one way to do it, but you may end up using more pins...

    Use one pin (P2 in this case) as the PULSOUT pin, and two other pins (P0 and P1) as 'control' pins.

    Use an OR chip (usually 4 OR gates in each package) and connect P0 and P2 to the inputs of one gate, and P1 and P2 to the inputs of the other gate.
    The Servo inputs are connected to the OR gate outputs.

    Now, as long at both P0 and P1 is high, no amount of pulsing on P2 will result in anything happening.
    (The outputs stays high)

    To control just one of the servos, pull either P0 or P1 low, then PULSOUT on P2.

    To control BOTH servos, pull both P0 and P1 low, then PULSOUT on P2.

    Want to use more servos simultaneously?
    Thee's still two OR gates left in the IC...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don't visit my new website...
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-05-08 13:10
    The Servo comparator electronics inside the Servo case have SOME time delay associated with them. The BS2 can output at 2000 instructions per second, and the Pulse will be 1 to 2 mSec. This means the difference between one pulse and the next will be at least 1 mSec. Well, there's 1000 mSec per second, so I don't think this delay will be human perceptible, nor will it make a difference.

    Plus, you need to refresh the pulse every 20 mSec, and I believe it may take a few refreshes for the Servo to reach the desired position anyway. Bottom line, a BS2 with Servo's is as "simultaneous" as you're going to need.

    Now, I understand you can use the PSC unit to control more servos. And you CAN get better simultaneaity in the output signals if you use an SX platform. But my argument above says, it won't make that much difference.
Sign In or Register to comment.