In a setup I am using digital servo's that are tested to hold position in absence of input signal.
The only thing I need is a clea way to start the servo pulse chain for 7 servo's, and to end it in a clean way.
But I have run into the following 2 problems.
using 28X2
Problem 1: starting the 20mSec servo frame correctly
A typical initialization of 7(8) servo signals would be
But this causes the first servo pulse to the B.0 servo to extend to 4.5mSec. I figured this was becuase the first pulse was started, and during this pulse B.1...B.7 where added. So I tried reverse order. Since the pulse of B.6 would be generated prior to B.7 we have almost a whole 20mSec frame to initialize the servo's.
This causes the first pulse on B.7 to be 15 mSec.....far worse.
Then I tried to use pause , to forse the init of the added servo channels to happen outside the active pulse of the first channel.
This way I ended up with a first pulse on B.3 of 20mSec. I seem to (completely) miss the point. Is there anyone that can suggest a 7(8) servo startup sequence that guaranties a glitch free startup of the whole 20mSec frame ?? This feels a bit like "try and error" without any logic behind it.
Problem 2: terminating the 20mSec frame correctly.
shutting down servo pulses by a "low B.x" is an option but that is not synchronized with the 20mSec servo frame, so it potentially cuts an active servo pulse in half, causing the servo to move. Therefore I had all my hopes set in "servopos B.x,OFF". Hoping that command would stop the timer for servo B.x and terminate correctly. Tests have shown that is not the case. "servopos B.x.OFF" also cuts pulses in half.
Generates a 1.5mSec first pulse, and a 1 mSec second pulse because it shuts B.0 down.
Another (non documented) feature of servopos ...
Does not start the sero pulses anymore. You need to use the "servo" command to start again. Bit awkward, using servopos to stop, and servo to start again. But that is just part of the learning curve I guess.
The idea I have now is to generate a 8'th servo pulse on B7 (I don't need that, 7 servo's is enough, but it will become part of the servo frame), and poll the B.7 line. When it is high, other servo's will be low, and I can (staring with B.0 who is the next in time) put all the lines low with fast "low B.x" commands.
When I solved the puzzles, I will let you know, but I welcome any suggestions....
The only thing I need is a clea way to start the servo pulse chain for 7 servo's, and to end it in a clean way.
But I have run into the following 2 problems.
using 28X2
Problem 1: starting the 20mSec servo frame correctly
A typical initialization of 7(8) servo signals would be
Code:
servo B.0,150
servo B.1,150
servo B.2,150
servo B.3,150
servo B.4,150
servo B.5,150
servo B.6,150
servo B.7,150
Code:
servo B.7,150
servo B.6,150
servo B.5,150
servo B.4,150
servo B.3,150
servo B.2,150
servo B.1,150
servo B.0,150
Then I tried to use pause , to forse the init of the added servo channels to happen outside the active pulse of the first channel.
Code:
servo B.0,150
pause 3 'first pulse is max 2 msec
servo B.1,150
pause 3 'second pulse is max 2 msec
servo B.2,150
pause 3 '3rd pulse is max 2 msec, and we definitely did not cover a 20msec frame
servo B.3,150
pause 3 'not important anymore for the story, but it is in the code
servo B.4,150
pause 3
servo B.5,150
pause 3
servo B.6,150
pause 3
servo B.7,150
pause 3
Problem 2: terminating the 20mSec frame correctly.
shutting down servo pulses by a "low B.x" is an option but that is not synchronized with the 20mSec servo frame, so it potentially cuts an active servo pulse in half, causing the servo to move. Therefore I had all my hopes set in "servopos B.x,OFF". Hoping that command would stop the timer for servo B.x and terminate correctly. Tests have shown that is not the case. "servopos B.x.OFF" also cuts pulses in half.
Code:
servo B.0,150
pause 20
servopos B.0,OFF
Another (non documented) feature of servopos ...
Code:
servo B.0,150
... code
servopos B.0,OFF
.... all kind of code
servopos B.0,150
The idea I have now is to generate a 8'th servo pulse on B7 (I don't need that, 7 servo's is enough, but it will become part of the servo frame), and poll the B.7 line. When it is high, other servo's will be low, and I can (staring with B.0 who is the next in time) put all the lines low with fast "low B.x" commands.
When I solved the puzzles, I will let you know, but I welcome any suggestions....
Last edited: