announcing SiMAD - a new algorithm to control N S&D channels with N+1 signals using existing S&D drivers
I'm happy to announce that last fall I developed
a new software algorithm (I don't think this has
been described anywhere else), and I named it:
SiMAD - Simultaneous Multi-Axis Direction
This software-only technique amazingly allows the
control of N Step&Direction channels with only
N+1 bits (ex: 6 axis hexapod control with 7 bits).
Even more amazingly, the SiMAD technique allows
the use of existing Step & Direction motor drivers.
This is important for those of us who have a limited
number of output bits (such as in a parallel port which
is commonly configured for only 12 output bits). The
bits freed up can be used to add more functionality
(ie more relays to control coolant, vacuum, etc).
Therefore, I am hoping some day EMC will encorporate
this algorithm to make more efficient use of the
parallel port. Huge multinational corporations are not
exempt from paying licensing fees of course!
Here is a brief review of the commonly used techniques:
#0 Phase Control
Just for steppers, this uses 4 bits per channel
an is very limiting (3 channels max, or 2 channels
with 4 aux output bits).
#1 ClockUP, ClockDOWN
This uses 2 bits per channel, and needs a CW/CCW
controller.
#2 Step & Direction
This also uses two bits per channel and uses the
standard Step & Direction motor controller.
and now SiMAD which uses 1 bit (called a Direction bit)
which is distributed in parallel to all the S&D controllers,
and is actually hooked up to their STEP input terminals
(giving the Multi-Axis-Direction moniker);
and an additional 1 bit per channel (each output bit is
connected to the S&D controllers DIRECTION input terminal).
The only downside of the technique is that simultaneous
CW and CCW motor motion is not allowed. But that is academic
because CW and CCW commands can be given microseconds
(or even nanoseconds) apart and thus essentially are moving
simultaneously mechanically.
Comparing 4 and 6 channel Step&Direction and SiMAD:
S&D SiMAD
4 channels 4 channels
uses 8 bits uses 5 bits
4 aux output bits 7 aux output bits
OR
6 channels (hexapod) 6 channels (hexapod)
uses 12 bits uses 7 bits
0 aux output bits 5 aux output bits
-----------------------------------------------------
technical stuff below just for experts...
Basically, there is only one DIRECTION bit which is hooked
up to all the S&D drivers DIRECTION input (why didn't anyone
think of this sooner?).
DIR (bit0) .. hooks to all DIR input drivers
X (bit1) .. hooks to X Step input driver
Y (bit2) .. hooks to Y Step input driver
. .
. .
(just draw a picture on the left with the bits, on the right with
N axes of S&D drivers.....)
so here comes an X step CW (DIR high)
_____________________
DIR ... |____________________
_______ ___________________________
X ... |______|
step
and here comes a Y step CCW (DIR low)
_____________________ ____________
Y ... |_______|
step
oh look, Z stepped CW with X
_______ ___________________________
Z ... |______|
step
OK, the downside of the process is that, if you
are stepping multiple axes at the same time, they
have to be in the same direction. If you want two
axes to go different directions (say X CW and Y CCW)
then you have to do them serially, but thats no big
deal at all. In fact before with two cards, you
could never step all the axes together anyway (you'd
do one pport, then the other pport).
The upside is that we free up some output pins!
Most of us use 12 out and 5 in. That allows us to:
- 4 axes out (1+4=5) PLUS 7 bits out PLUS 5 bits in.
or, as most everyone uses 8 bits (for 4 axes)
- 7 axes out (1+7=8) PLUS 4 bits out PLUS 5 bits in.
or, for a hexapod (6 axes)
- 6 axes out (1+6=7) PLUS 5 bits out PLUS 5 bits in.
OK, now Gecko drives have a funny requirement that
the signals are UP for a minimum of 4000ns and down
for a minimum of 500 ns, and stepping happens on the
falling edge of the step bit.
Here is a more detailed microscopic explanation:
________________________ ______________________
D:__| ^ |________
1: prev state 2: processor 5: next
was set to CW wakes up, pulse (some
because we knew keeps signal hi time from now)
in advance is going to be
(thus it satisfies CCW, so lower
setup time of 4uS ) the signal in
preparation
_________________________ _______
X:_| ^____________________|
4: raise line
1: prev state for the 3: upon waking up jam
axes was left at hi the signal down which
which causes a Gecko step
and keep it down 500ns
(ie go check the pport
for changed in-bits).
4: when done that, 500ns
must have elapsed, so
raise the X line again...
5: look ahead, the next pulse
(say Z axis) is CCW, so lower
the C signal in preparation
(so it has a setup time of 4uS)
This more detailed view addresses both the 500ns & 4uS requirements,
and also the simultaneous CW and CCW steps (ie you can't, simultaneous
same-direction steps CAN happen, but opposite direction steps have
to be done at a DIFFERENT time). Thus we try to leave all the
axis (X,Y,Z,A,B,C) signals high between interrupts (because, upon
waking up, we just haul them down immediately and that makes a step,
and then wait a mere 500ns delay, and then we can bring the signal
back up, and then leave the interrupt).
This seems so simple, doesn't it? In fact, it did not
come to me in a brainstorm, but by the math (this is not to
scale, the clocks are too close, and X is low for explanation
purposes, in the real world it should be left high):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _
C: _| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_| |_
_ _ _ _ _
X: _________________| |_| |_| |_______________| |_|
|____________________
do nothing forward 3 nothing back 2
because because
X is in sync the signal is
with the clock inverse with the clock
Step = X*C + X*notC = X*(C + notC) = X*1 = X
Dir = X*C + not(X * notC) = X*C + notX + C = C*(1+X) + notX = C+notX
but we do nothing when (notX) so essentially Dir = C
conclusion for 4 Axes (XYZA) and 1 clock channel C: it only takes 5 bits
X: Step = X see above diagram, what could be simpler!
Dir = C
Y: Step = Y
Dir = C
Z: Step = Z
Dir = C
A: Step = A
Dir = C
Note that we can use standard "Step and Direction" motor drivers,
except now the clock pulse stream goes to the motor driver "Direction"
input, and the axis pulse goes to the "Step" driver input (exactly
backwards from normal).
regards
Doug Fortune
Calgary Canada
http://www.cncKITS.com
Date Index |
Thread Index |
Back to archive index |
Back to Mailing List Page
Problems or questions? Contact