User's Manual

PMAC User Manual
Writing Programs for PMAC 197
Rotation Example
To rotate the coordinate system 15 degrees about the origin in the XY plane. Set up the matrix as
follows:
TSEL 2
;Select Matrix 2
Q40=COS(15) Q41=SIN(15) Q42=0 ;Variables for first row
Q43=-SIN(15) Q44=COS(15) Q45=0 ;Variables for second row
Q46=0 Q47=0 Q48=1 ;Variables for third row
AROT 40 ;Assign these values to the rotation portion
This transformation rotates the points 15 degrees counterclockwise in the XY plane relative to fixed XY
axes when viewed from the +Z axis in a right-handed coordinate system (i x j = k). Alternately stated, it
rotates the XY axes 15 degrees clockwise in the XY plane relative to fixed points when viewed from the
+Z axis in a right-handed coordinate system.
Displacement Example
To offset the Y and Z axes by five units and 2.5 units, respectively, leaving the X axis unchanged. Set up
the matrix as follows:
TSEL 3 ; Select Matrix 3
Q191=0 ; First variable
Q192=5 ; Second variable
Q193=2.5 ; Third variable
ADIS 191 ; Assign these values to the displacement portion
Second Rotation Example
To rotate the coordinate system 15 degrees in the XY plane, as in the first rotation example, but about an
arbitrary point (P1, P2) instead of the origin. In this case, the rotation matrix is the same as for a rotation
about the origin, but a displacement vector is also required. In general, for a rotation of angle θ about a
point (x
0
, y
0
), the displacement vector required is:
(
)
[
]
sinycos10x 0
(
)
[
]
cos1ysinx 00
+
[ 0 ]
To implement this in PMAC code, assuming that Q40 through Q48 are as in the above rotation example,
we add:
Q50=P1*(1-COS(15))-P2*SIN(15)
Q51=P1*SIN(15)+P2*(1-COS(15))
Q52=0
AROT40 ; Create 15 degree rotation
ADIS50 ; Create proper displacement
Current Position Transformation
When a coordinate system is transformed, it is important to realize that the starting positions for the
upcoming move are transformed, and this has an effect on an axis not explicitly commanded in this
upcoming move. In absolute mode, any axis not explicitly commanded implicitly receives a command to
its existing position, in this case, the transformed position. For example, if the absolute move X1Y0 is
followed by a 45
°
rotation, this position is transformed to X0.707Y0.707. If this is followed by an
absolute X2 move command, this is equivalent to an X2Y0.707 command, not to an X2Y0 command.