Posts: 542
Threads: 98
Joined: Jun 2008
In a script PLC I would like to perform a phase search (#n$) if a motor has not been phased and should be and then home the motor if it has not been homed already. For each step I need to monitor if the command completes properly. This is part of a servo-on function that will run after an E-stop. The E-stop will not usually remove power from PPMAC but is the same routine used at initial startup.
Posts: 675
Threads: 50
Joined: Jun 2008
08-28-2008, 09:48 PM
(This post was last modified: 08-29-2008, 08:11 AM by Sina.)
Brad,
I have done this code which works for phasing, but you need to add the required features for homing. The following is just for phasing from a Script PLC:
Kill 6;
If (Motor[6].Status[0]&$1==0)
{
Motor[6].PhaseFindingStep=1;
Do While(Motor[6].PhaseFindingStep<>0);
}
If (Motor[6].Status[0]&$1==1)
{
Home 6;
Do While((Motor[6].Status[0]&$400000)==0);
}
else
{
Disable PLC 1;
}