Virtual Axis Monitoring Motion
Virtual Axis Monitoring Motion
at the programmed speed, but the velocity will be proportional to the override of the coordinate system,
whether due to time-base control or lookahead. This permits another action to be slaved to the position of
the virtual axis.
To create a move proportional to the vector length of the programmed move, this length must be calculated.
Turbo PMAC does this by looking at the move parameters passed as arguments into the subroutine call
through the READ statement.
This example computes the length for linear and rapid moves only. This computation is possible for
circle moves as well, but the calculations are much more involved.
Substitutions and Definitions
#define DXSqrd P4001 ; Square of X distance
#define DYSqrd P4002 ; Square of Y distance
#define DZSqrd P4003 ; Square of Z distance
#define Vdist P4004 ; Virtual axis distance
G-code Subroutine Program
OPEN PROG 1000 CLEAR ; G-code subprogram
N0 RAPID ; G00 is RAPID mode
INC(V) ; Make sure V is incremental
PRELUDE1 G00.1 ; Make moves a subroutine call
RETURN
Subroutine for Calculations on LINEAR and RAPID Moves
N100 ; G00.1 subroutine
READ(X,Y,Z) ; Destinations into Q124,5,6
IF(AbsMode=1) ; ABS, subtract last destination
DXSqrd=(XArg-CS1XTargPos)*(XArg-CS1XTargPos)
DYSqrd=(YArg-CS1YTargPos)*(YArg-CS1YTargPos)
DZSqrd=(ZArg-CS1ZTargPos)*(ZArg-CS1ZTargPos)
ELSE ; INC, use new distances
DXSqrd=XArg*XArg
DYSqrd=YArg*YArg
DZSqrd=ZArg*ZArg
ENDIF
VDist=SQRT(DXSqrd+DYSqrd+DZSqrd)
X(XArg)Y(YArg)Z(ZArg)V(VDist) ; Append V-axis move
RETURN
N1000 LINEAR ; G01 is LINEAR mode
INC(V) ; Make sure V is incremental
PRELUDE1 G00.1 ; Make moves a subroutine call
RETURN
N90000 ABS(X,Y,Z) ; G90 is absolute real moves
AbsMode=1 ; Internal flag
RETURN
N91000 INC(X,Y,Z) ; G91 is incremental real moves
AbsMode=0 ; Internal flag
RETURN
CLOSE
To use the V-axis position as the time-base master for CS2 on Turbo PMAC, use the following setup:
I8006=$403506 ; Use result of I8005 as master
I8007=128 ; Scale factor (app. dependent)
I5293=@I8007 ; CS2 use this for time base
The virtual motor can be used also to output a pulse frequency proportional to its speed. See the Virtual
Motor with Synthesized Encoder example for details.