10 Sample Programming
10-90
NJ-series CPU Unit Motion Control User’s Manual (W507)
This sample increases the valid number of data points by 10 in a cam table with a maximum number of
data points of 110 and a valid number of data points of 100. It also updates the end point index.
* 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-18 Updating the Cam Table End Point Index
Main Variables Used in the Programming Samples
Variable name
Data type
Default
Comment
CamProfile0
ARRAY[0..109] OF
_sMC_CAM_REF
---
This is a cam data variable with a maximum
number of data points of 110.* It contains
100 valid cam data points and 10 null cam
data points.
WriteCamdata
BOOL
FALSE
This variable is used to start changing the
cam data. It is changed to TRUE to start
editing.
WriteDone
BOOL
FALSE
This variable is used to indicate when the
changes to the cam data are completed. It
changes to TRUE when the changes to the
cam data are completed.
Ladder Diagram
InitFlag
1
2
3
4
5
StartPg
1
2
3
4
5
6
7
WriteCamData
_MC_COM.MFaultLvl.Active
EN
FaultHandler
FaultHandler
FOR Index := UINT#10#100 TO UINT#10#109 DO
PhaseData:=PhREAL#1.0;
DistanceData:=DistaREAL#3.0;
CamProfile0[Index].Phase:=PhaseData;
CamProfile0[Index].Distance:=DistanceData;
END_FOR;
WriteDone:=TRUE;
If a minor fault level error occurs in the MC Common Error Status Variable, the error handler for the device
(FaultHandler) is executed. Program the FaultHandler according to the device.
// The phases and displacements for null cam data are set.
PhaseData:=REAL#99.0;
DistanceData:=REAL#250.0;
// The Initialization Completed Flag is changed to TRUE.
InitFlag := TRUE;
The axis parameters are set. When setting the parameters is completed,
InitFlag
is changed to TRUE.
If
StartPg
and
WriteCamData
are TRUE, the values in the cam data variable are changed.
Phases and displacements are set for
CamProfile[100]
to
CamProfile[109].
When the changes to the cam data variable are completed,
WriteDone
is changed to TRUE.
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...