User's Manual
PMAC2 User Manual
90 Using the Position Compare Feature on PMAC2
The home capture offset is a 24-bit signed integer, expressed in counts. It is best accessed with a 24-bit
signed M-variable. The registers and suggested M-variables for each motor are:
M173->Y:$0815,0,24,S ; Motor 1 home capture offset
M273->Y:$08D5,0,24,S ; Motor 2 home capture offset
M373->Y:$0995,0,24,S ; Motor 3 home capture offset
M473->Y:$0A55,0,24,S ; Motor 4 home capture offset
M573->Y:$0B15,0,24,S ; Motor 5 home capture offset
M673->Y:$0BD5,0,24,S ; Motor 6 home capture offset
M773->Y:$0C95,0,24,S ; Motor 7 home capture offset
M873->Y:$0D55,0,24,S ; Motor 8 home capture offset
The home offset I-variable Ix26 is in units of 1/16 count, so it should be divided by 16 before adding to
the motor position.
For example, for Motor 1 using Encoder 1, to set the Compare 1A register to trigger at motor position
+1500, use the following command, on-line, in a motion program, or in a PLC program:
M108=1500+M173+I126/16
The conversion from axis position to motor position involves a scale factor and an offset, with the
following equation:
MotorPosition = ScaleFactor * AxisPosition + Offset
The scale factor is specified in the axis definition statement in counts per engineering unit; it should be
constant for an application. Specify the scale factor directly in the equation or access the actual register
that PMAC is using with suggested M-variables:
Mx91 ; Axis scale factor for X, U, A, B, or C assigned to Motor x
Mx92 ; Axis scale factor for Y or V assigned to Motor x
Mx93 ; Axis scale factor for Z or W assigned to Motor x
The offset is the position bias term, with suggested M-variable Mx64, and units of 1/(Ix08*32) counts. It
is set equal to the axis definition offset (usually 0) on power-up/reset and homing. It can be changed after
this with on-line command {axis}= or motion program command PSET.
For example, with Motor 1 assigned to the X-axis, to set the compare 1A register to trigger at +2.5
engineering units from the axis origin, compute motor position in counts as:
P1=M191*2.5+M164/(I108*32)
Then set the actual compare register with:
M108=P1+M173+I126/16