10 Sample Programming
10-44
NJ/NX-series CPU Unit Motion Control Userās Manual (W507)
This sample changes the cam table during cam motion. CamProfile0 is used when the command posi-
tion for axis 0 is 5000 or less and CamProfile1 is used when it is over 5000.
* The array elements ARRAY[0..N] are set with the Cam Editor in the Sysmac Studio. The range of the array is 0 to
109 in this sample.
10-2-12 Changing the Cam Table by Re-execution of an Instruction
Main Variables Used in the Programming Samples
Variable name Data type Default Comment
MC_Axis000 _sAXIS_REF --- This is the Axis Variable for axis 0.
MC_Axis001 _sAXIS_REF --- This is the Axis Variable for axis 1.
CamProfile0 ARRAY[0..100] OF
_sMC_CAM_REF
--- This is the cam data variable.*
CamProfile1 ARRAY[0..10] OF
_sMC_CAM_REF
--- This is the cam data variable.*
Pwr1_S BOOL FALSE This variable is assigned to the Status out-
put variable from the PWR1 instance of the
MC_Power instruction. It is TRUE when the
Servo is ON.
Pwr2_S BOOL FALSE This variable is assigned to the Status out-
put variable from the PWR2 instance of the
MC_Power instruction. It is TRUE when the
Servo is ON.
CamTable0 BOOL FALSE TRUE when CamProfile0 is used for the
cam table.
CamTable1 BOOL FALSE TRUE when CamProfile1 is used for the
cam table.
Camin_InCam0 BOOL FALSE This variable is assigned to the InCam out-
put variable from the CAMIN instance of the
MC_CamIn instruction. It is TRUE during
cam motion for CamProfile0. After this vari-
able changes to TRUE, it remains TRUE
until the operation is completed or can-
celed.
Camin_InCam1 BOOL FALSE This variable is assigned to the InCam out-
put variable from the CAMIN instance of the
MC_CamIn instruction. It is TRUE during
cam motion for CamProfile1. After this vari-
able changes to TRUE, it remains TRUE
until the operation is completed or can-
celed.
Mv_Abs_Act BOOL FALSE This variable is assigned to the Active out-
put variable from the MV_ABS instance of
the MC_MoveAbsolute instruction.
Hm1_Ex BOOL FALSE This variable is used to re-execute the
MC_Home instruction for axis 0.
Hm2_Ex BOOL FALSE This variable is used to re-execute the
MC_Home instruction for axis 1.
Mv_Abs_Ex BOOL FALSE This variable is used to execute the
MC_MoveAbsolute (Absolute Positioning)
instruction.
Camin_Ex BOOL FALSE This variable is used to execute the MC_-
CamIn (Start Cam) instruction. It is used in
ST programming.
StartPg BOOL FALSE When StartPg is TRUE, the Servo is turned
ON if EtherCAT process data communica-
tions are active and normal.