// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
END_IF;
// If StartPg is TRUE and the Servo Drive is ready, the Servo is turned ON.
// If the Servo Drive is not ready, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (MC_Axis000.DrvStatus.Ready=TRUE) THEN
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
// If the Servo is ON and home is not defined, the Home instruction is executed.
IF (Pwr_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm_Ex:=TRUE;
END_IF;
// After home is defined, MC_MoveVelocity is executed.
IF MC_Axis000.Details.Homed=TRUE THEN
Vel_Ex:=TRUE;
END_IF;
// After MC_MoveVelocity is executed, MC_TouchProbe is executed.
IF Vel_Act=TRUE THEN
T_Probe_Ex:= TRUE;
END_IF;
// MC_Power
PWR(
Axis := MC_Axis000,
Enable := Pwr_En,
Status => Pwr_Status,
Busy => Pwr_Bsy,
Error => Pwr_Err,
ErrorID => Pwr_ErrID
);
// MC_Home
HM(
3 Axis Command Instructions
3-379
NY-series Motion Control Instructions Reference Manual (W561)
MC_TouchProbe
3
Sample Programming