![background image](http://html1.mh-extra.com/html/omron/nj501-1300/nj501-1300_user-manual_742205304.webp)
10 Sample Programming
10-50
NJ-series CPU Unit Motion Control User’s Manual (W507)
// If the input parameters for absolute positioning and starting cam operation are not set, the target values and other
parameters are set.
IF InitFlag=FALSE THEN
// The input parameters for the MC_MoveAbsolute (Absolute Positioning) instruction are set.
Mv_Abs_Pos
:= LREAL#10000.0;
Mv_Abs_Vel
:= LREAL#2000.0;
Mv_Abs_Acc
:= LREAL#2000.0;
Mv_Abs_Dec
:= LREAL#2000.0;
// The input parameters for the MC_CamIn (Start Cam Operation) instruction are set.
Camin_EM
:= TRUE;
Camin_StMode
:= _eMC_START_MODE#_mcAbsolutePosition;
Camin_StPos
:= LREAL#1.0;
Camin_MStDis
:= LREAL#1.0;
Camin_MSc
:= LREAL#1.0;
Camin_SSc
:= LREAL#1.0;
Camin_MO
:= LREAL#0.0;
Camin_SO
:= LREAL#0.0;
Camin_RT
:= _eMC_REFERENCE_TYPE#_mcCommand;
Camin_Dir
:= _eMC_DIRECTION#_mcNoDirection;
// The cam table is selected.
CamTable0
:=BOOL#TRUE;
CamTable1
:=BOOL#FALSE;
// 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 are active and normal.
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;
// When
StartPg
is TRUE, the Servo is turned ON for axis 1 if process data communications are active and normal.
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]=FALSE) THEN
Pwr2_En:=TRUE;
ELSE
Pwr2_En:=FALSE;
END_IF;
// If a minor fault level error occurs for axis 0 or axis 1, the error handler for the device (FaultHandler) is executed.
// Program the FaultHandler according to the device.
IF (MC_Axis000.MFaultLvl.Active=TRUE)
OR (MC_Axis001.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 0 and home is not defined, the MC_Home instruction is executed.
IF (Pwr1_S=TRUE)
AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the MC_Home instruction is executed.
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...