10 Sample Programming
10-4
NJ/NX-series CPU Unit Motion Control Userās Manual (W507)
// If the Servo Drive is ready when StartPg is TRUE, turn ON the Servo for axis 0.
IF (StartPg=TRUE)
AND (MC_Axis000.DrvStatus.Ready=TRUE) THEN
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
// If a minor fault level error occurs for axis 0, the error handler for the device (FaultHandler) is executed.
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
// MC_Power
PWR(
Axis := MC_Axis000,
Enable := Pwr_En,
Status => Pwr_Status,
Busy => Pwr_Bsy,
Error => Pwr_Err,
ErrorID => Pwr_ErrID
);
Ladder Diagram
ST Programming
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
StartPg
Lock0
MC_Axis000.DrvStatus.Ready
PWR
Error
Axis Axis
Enable Status
Busy
MC_Power
ErrorID
Lock0
MC_Axis000
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
If the Servo Drive is ready, turn ON the Servo for axis 0.
If a minor fault level error occurs for axis 0, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
Check if the Servo Drive is ready when StartPg is TRUE.