User's Manual
PMAC2 User Manual
50 Setting Up PMAC2 Commutation (Direct PWM or Sine Wave)
The time between typing the commands would provide sufficient delay for settling into position.
The following PLC program is a good starting point for variants on the stepper-motor phasing search
method. Extensions to this program could be to phase two gantry motors simultaneously or to step out of
a position limit. This example uses Ix73 and Ix74 as they would be used in the automatic stepper-motor
phasing search method.
Set-up and Definitions
CLOSE ; Make sure all buffers are closed
M70->X:$0700,0,24,S ; 24-bit automatic timer register
M271->X:$007D,0,24,S ; Motor 2 phase position register
Program to do Phasing search
OPEN PLC 1 CLEAR
CMD#2O0 ; Force zero-magnitude open-loop
P229=I229 ; Save real Phase A bias
P279=I279 ; Save real Phase B bias
I229=-I273 ; Force negative bias into A
I279=I273 ; Force positive bias into A
M70=I274*256 ; Starting value for countdown timer
WHILE (M70>0) ; Wait for prescribed time
ENDWHILE
P271=M271 ; Store phase position at this point
I229=P229 ; Restore real bias to A for 0 deg
M70=I274*256 ; Starting value for countdown timer
WHILE (M70>0) ; Wait for prescribed time
ENDWHILE
P271=P271-M271 ; Get difference between two positions
IF (I282>0 OR I272<128) ; Direct PWM or check analog phase
M271=0 ; Set phase position to zero
ELSE ; Analog system with Ix72>128
M271=I271/2 ; Set phase position to 180 deg
I279=P279 ; Restore real bias to B
IF (ABS(P271)>I271/12) ; Greater than 1/12 cycle?
CMD #2J/ ; Close servo loop
ELSE ; Not enough movement
CMD#2K ; Bad phasing, kill
SENDPHASING FAILED
DISABLE PLC 1 ; Keep from executing again
CLOSE
Final Phase Correction with Index Pulse
To make the final phase correction, move PMAC to the index pulse and force the value obtained during
the fine phasing test into the phase position register. Before doing this, the position/velocity servo loop
must be reasonably tuned; the tuning for this loop is the same as for any other PMAC motor.
Usually the move to the index pulse will be the homing search move, where the trigger for the home
position includes the leading edge of the index pulse; typically the first index pulse inside the home flag
pulse. I-variables I9n2 and I9n3 control the home trigger. Typically the preliminary phasing will permit
a reasonable move all the way to the home position. It is also possible to perform a preliminary homing
search to the first index pulse, correct the phase, then do the real homing search.
A sample motion program segment that performs the homing search and phase correction is:
HOME1 ; Command homing search move
WHILE (M140=0) WAIT ; Loop until in position
M171=P171 ; Force value into phase position register