![background image](http://html1.mh-extra.com/html/omron/nj501-1300/nj501-1300_user-manual_742205337.webp)
10-83
10 Sample Programming
NJ-series CPU Unit Motion Control User’s Manual (W507)
10-2 Basic Pr
o
g
ram
m
in
g
Samples
10
10-2-16 C
hanging a Cam D
ata V
a
riab
le and Sa
ving the Ca
m T
ab
le
// 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#1000.0;
Vel_Acc
:= LREAL#0.0;
Vel_Dec
:= LREAL#0.0;
Vel_Dir
:= _eMC_DIRECTION#_mcPositiveDirection;
// The input parameters for the MC_CamIn (Start Cam Operation) instruction are set.
Camin_Em
:= TRUE;
Camin_Sm
:= _eMC_START_MODE#_mcRelativePosition;
Camin_Sp
:= LREAL#0.0;
Camin_Msd
:= LREAL#0.0;
Camin_Ms
:= LREAL#1.0;
Camin_Ss
:= 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 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
Pwr1_En:=TRUE;
ELSE
Pwr1_En:=FALSE;
END_IF;
// When
StartPg
is TRUE, the Servo is turned ON for axis 1 if process data communications for axis 1 are active
and normal.
// If process data communications are not active, the Servo is turned OFF.
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 in the MC Common Error Status Variable or for any of the axes, 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)
OR (_MC_COM.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 for axis 0.
IF (Pwr1_Status=TRUE)
AND (MC_Axis000.Details.Homed=FALSE) THEN
ST Programming
Содержание NJ501-1300
Страница 12: ...Sections in this Manual 10 NJ series CPU Unit Motion Control User s Manual W507...
Страница 18: ...16 NJ series CPU Unit Motion Control User s Manual W507 CONTENTS...
Страница 22: ...Read and Understand this Manual 20 NJ series CPU Unit Motion Control User s Manual W507...
Страница 34: ...Revision History 32 NJ series CPU Unit Motion Control User s Manual W507...
Страница 44: ...1 Introduction to the Motion Control Function Module 1 10 NJ series CPU Unit Motion Control User s Manual W507...
Страница 58: ...2 Motion Control Configuration and Principles 2 14 NJ series CPU Unit Motion Control User s Manual W507...
Страница 86: ...3 Configuring Axes and Axes Groups 3 28 NJ series CPU Unit Motion Control User s Manual W507...
Страница 98: ...4 Checking Wiring from the Sysmac Studio 4 12 NJ series CPU Unit Motion Control User s Manual W507...
Страница 122: ...5 Motion Control Parameters 5 24 NJ series CPU Unit Motion Control User s Manual W507...
Страница 158: ...6 Motion Control Programming 6 36 NJ series CPU Unit Motion Control User s Manual W507...
Страница 166: ...7 Manual Operation 7 8 NJ series CPU Unit Motion Control User s Manual W507...
Страница 182: ...8 Homing 8 16 NJ series CPU Unit Motion Control User s Manual W507...
Страница 346: ...10 Sample Programming 10 92 NJ series CPU Unit Motion Control User s Manual W507...
Страница 422: ...Appendices A 18 NJ series CPU Unit Motion Control User s Manual W507...
Страница 423: ...Index 1 NJ series CPU Unit Motion Control User s Manual W507 I Index...
Страница 430: ...Index 8 NJ series CPU Unit Motion Control User s Manual W507 Index...