View Full Version : Can you pulsout more than one pin in the same command?

Robot Jay
05-08-2006, 07:29 AM
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.

05-08-2006, 08:35 AM
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 Savage
05-08-2006, 08:58 AM
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 (mailto:csavage@parallax.com)

Robot Jay
05-08-2006, 01:56 PM
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.

05-08-2006, 04:53 PM
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...

05-08-2006, 08:10 PM
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.