10 Sample Programming
10-78
NJ-series CPU Unit Motion Control User’s Manual (W507)
This sample uses the user program to change a cam data variable that was created on Cam Editor of
the Sysmac Studio. The displacements for phases of 0
°
to 180
°
are multiplied by 2 and the displace-
ments for phases of 181
°
to 360
°
are multiplied by 0.5.
If the changes to the cam data are completed, the motion control instruction MC_SaveCamTable is
used to save the cam data variable to non-volatile memory in the CPU Unit. When saving the data is
completed, the MC_CamIn (Start Cam Operation) instruction is executed to start cam motion.
Precautions for Correct Use
Precautions for Correct Use
•
If the phases are not in ascending order, an error occurs when the MC_CamIn (Start Cam
Operation) instruction is executed. The order of the phases are not checked in this sample. To
check the order of the phases, execute the MC_SetCamTableProperty (Set Cam Table Proper-
ties) instruction.
•
There is a limit to the number of times that you can write non-volatile memory in the CPU Unit.
Save cam table data only when necessary.
•
If the power supply to the Controller is turned OFF before the data is saved with the
MC_SaveCamTable instruction, the cam data variable will revert to the contents from before it
was changed by the user program.
* The array elements ARRAY[0..N] are set with the Cam Editor in the Sysmac Studio. The range of the array is 0 to
360 in this sample.
10-2-16 Changing a Cam Data Variable and Saving the Cam Table
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..360] OF
_sMC_CAM_REF
---
This is the cam data variable.*
Pwr1_Status
BOOL
FALSE
This variable is assigned to the
Status
output vari-
able from the PWR1 instance of the MC_Power
instruction. It is TRUE when the Servo is ON.
Pwr2_Status
BOOL
FALSE
This variable is assigned to the
Status
output vari-
able from the PWR2 instance of the MC_Power
instruction. It is TRUE when the Servo is ON.
StartPg
BOOL
FALSE
When
StartPg
is TRUE, the Servo is turned ON if
EtherCAT process data communications are active
and normal.
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 that the changes to
the cam data are completed. It is changed to TRUE
when the changes to the cam data are completed.
SaveCamtable
BOOL
FALSE
This variable is used to execution the Save Cam
Table instruction.
_MC_COM.Status.
CamTableBusy
BOOL
FALSE
This system-defined variable is TRUE while cam
table data is being saved.
Sv_Cam_Ex
BOOL
FALSE
This variable is used to execute the
MC_SaveCamTable instruction.
Camin_Ex
BOOL
FALSE
This variable is used to execute the MC_CamIn
(Start Cam) instruction. It is used in ST program-
ming.
Содержание 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...