10 Sample Programming
10-76
NJ-series CPU Unit Motion Control User’s Manual (W507)
// If the input parameters for the instructions are not set, the target values and other parameters are set.
IF InitFlag=FALSE THEN
// The input parameters for the MC_MoveVelocity (Velocity Control) instruction are set.
Vel_Vel
:= LREAL#36.0;
Vel_Acc
:= LREAL#1000.0;
Vel_Dec
:= LREAL#1000.0;
Vel_Jrk
:= LREAL#100.0;
// The input parameters for the MC_SetPosition instruction are set.
Set_Pos_Pos
:= LREAL#0.0;
// The Input Parameter Initialization Completed Flag is changed to TRUE.
InitFlag:=TRUE;
END_IF;
// When
StartPg
is TRUE, the Servo is turned ON for axis 0 if process data communications for axis 0 are active
and normal.
// If process data communications are not active, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]=FALSE) 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;
// If the Servo is ON for axis 0, velocity control is executed for axis 0.
IF Pwr_Status=TRUE THEN
Vel_Ex:=TRUE;
END_IF;
// If
StartSetPos
is TRUE while the Servo is ON, the Set Position instruction is executed.
IF (Pwr_Status=TRUE)
AND (StartSetPos=TRUE) THEN
Set_Pos_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_MC_MoveVelocity
VEL(
Axis
:= MC_Axis000,
Execute
:= Vel_Ex,
ST Programming
Summary of Contents for NJ501-1300
Page 12: ...Sections in this Manual 10 NJ series CPU Unit Motion Control User s Manual W507...
Page 18: ...16 NJ series CPU Unit Motion Control User s Manual W507 CONTENTS...
Page 22: ...Read and Understand this Manual 20 NJ series CPU Unit Motion Control User s Manual W507...
Page 34: ...Revision History 32 NJ series CPU Unit Motion Control User s Manual W507...
Page 86: ...3 Configuring Axes and Axes Groups 3 28 NJ series CPU Unit Motion Control User s Manual W507...
Page 122: ...5 Motion Control Parameters 5 24 NJ series CPU Unit Motion Control User s Manual W507...
Page 158: ...6 Motion Control Programming 6 36 NJ series CPU Unit Motion Control User s Manual W507...
Page 166: ...7 Manual Operation 7 8 NJ series CPU Unit Motion Control User s Manual W507...
Page 182: ...8 Homing 8 16 NJ series CPU Unit Motion Control User s Manual W507...
Page 346: ...10 Sample Programming 10 92 NJ series CPU Unit Motion Control User s Manual W507...
Page 422: ...Appendices A 18 NJ series CPU Unit Motion Control User s Manual W507...
Page 423: ...Index 1 NJ series CPU Unit Motion Control User s Manual W507 I Index...
Page 430: ...Index 8 NJ series CPU Unit Motion Control User s Manual W507 Index...