10 Sample Programming
10-2 Basic Programming Samples
This section provides programming samples for the basic functions of the MC Function Module.
Precautions for Correct Use
Precautions for Correct Use
• When you use these programming samples for reference, be sure to add programming for suit-
able interlocks that suit the operating conditions of the devices.
• Enter the variables that are used in the programming samples from the Programming Layer in
the Edit Pane of the Sysmac Studio.
10-2-1 Monitoring EtherCAT Communications and Turning ON Servos
In this sample, the MC_Power (Power Servo) instruction is executed to turn ON the Servo for the Servo
Drive when EtherCAT process data communications are established with the Servo Drive.
Samples are provided for both ladder diagram and ST programming.
Main Variables Used in the Programming Samples
Variable name
MC_Axis000
MC_Axis000.MFaultLvl.Active
MC_Axis000.Cfg.NodeAddress
_EC_PDSlavTbl[N]
StartPg
10-4
Data type
Default
_sAXIS_REF
---
BOOL
FALSE
UINT
---
BOOL
FALSE
BOOL
FALSE
NJ-series CPU Unit Motion Control User's Manual (W507)
Comment
This is the Axis Variable for axis 0.
TRUE when there is a minor fault level error for
axis 0.
This is the node address.
TRUE when EtherCAT process data communi-
cations for node address N are in Operational
state.
When StartPg is TRUE, the Servo is turned ON
if EtherCAT process data communications are
active and normal.