NY-series Motion Control Instructions Reference Manual

NY-series Motion Control Instructions Reference Manual
Industrial PC Platform
NY-series
Motion Control Instructions
Reference Manual
NY532-1500
NY532-1400
NY532-1300
NY512-1500
NY512-1400
NY512-1300
W561-E1-01
NOTE
All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form, or by any means, mechanical, electronic, photocopying, recording, or otherwise, without the prior
written permission of OMRON.
No patent liability is assumed with respect to the use of the information contained herein. Moreover, because
OMRON is constantly striving to improve its high-quality products, the information contained in this manual is
subject to change without notice. Every precaution has been taken in the preparation of this manual. Nevertheless, OMRON assumes no responsibility for errors or omissions. Neither is any liability assumed for damages
resulting from the use of the information contained in this publication.
Trademarks
• Sysmac and SYSMAC are trademarks or registered trademarks of OMRON Corporation in Japan and other
countries for OMRON factory automation products.
• Microsoft, Windows, Windows Vista, Excel, and Visual Basic are either registered trademarks or trademarks of
Microsoft Corporation in the USA and other countries.
• EtherCAT® is registered trademark and patented technology, licensed by Beckhoff Automation GmbH, Germany.
• ODVA, CIP, CompoNet, DeviceNet, and EtherNet/IP are trademarks of ODVA.
• The SD and SDHC logos are trademarks of SD-3C, LLC.
Other company names and product names in this document are the trademarks or registered trademarks of their
respective companies.
Copyrights
Microsoft product screen shots reprinted with permission from Microsoft Corporation.
Introduction
Introduction
Thank you for purchasing an NY-series IPC Machine Controller Industrial Panel PC / Industrial Box PC.
This manual provides a collective term of Industrial Panel PC and Industrial Box PC which are applicable products as the NY-series Industrial PC. This manual also provides the range of devices that are
directly controlled by the Controller functions embedded the Real-Time OS in the NY-series Industrial
PC as the Controller.
This manual describes the motion control instructions. Please be sure you sufficiently understand the
operations and handling procedures, and use the Motion Control Function Module (abbreviated as “MC
Function Module”) correctly.
Use this manual together with the user’s manuals for the NY-series Controller.
When you have finished reading this manual, keep it in a safe location where it will be readily available
for future use.
Intended Audience
This manual is intended for the following personnel, who must also have knowledge of electrical systems (an electrical engineer or the equivalent).
• Personnel in charge of introducing FA systems.
• Personnel in charge of designing FA systems.
• Personnel in charge of installing and maintaining FA systems.
• Personnel in charge of managing FA systems and facilities.
For programming, this manual is intended for personnel who understand the programming language
specifications in international standard IEC 61131-3 or Japanese standard JIS B 3503.
Applicable Products
This manual covers the following products.
NY-series IPC Machine Controller Industrial Panel PC
• NY532-15……
• NY532-14……
• NY532-13……
NY-series IPC Machine Controller Industrial Box PC
• NY512-15……
• NY512-14……
• NY512-13……
Part of the specifications and restrictions for the Industrial PC are given in other manuals. Refer to Relevant Manuals on page 2 and Related Manuals on page 23.
NY-series Motion Control Instructions Reference Manual (W561)
1
Relevant Manuals
Relevant Manuals
The following table provides the relevant manuals for NY-series Controller.
Read all of the manuals that are relevant to your system configuration and application before you use
NY-series Controller.
Most operations are performed from the Sysmac Studio Automation Software. Refer to the Sysmac Studio Version 1 Operation Manual (Cat. No. W504) for information on the Sysmac Studio.
Manual
Basic information
NY-series
Troubleshooting Manual
NY-series IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Built-in EtherNet/IP Port User's Manual
NY-series IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Built-in EtherCAT Port User’s Manual
NY-series Motion Control
Instructions Reference Manual
NY-series IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Motion Control User's Manual
NY-series
Instructions Reference Manual
NY-series IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Software User’s Manual
NY-series IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Setup User's Manual
NY-series IPC Machine Controller
Industrial Box PC
Hardware User’s Manual
Introduction to NY-series Panel PCs
NY-series IPC Machine Controller
Industrial Panel PC
Hardware User’s Manual
Purpose of use
{
Introduction to NY-series Box PCs
{
Setting devices and hardware
Using motion control
Using EtherCAT
{
{
{
{
Using EtherNet/IP
{
*1
Making setup
{
Making initial settings
Preparing to use Controllers
Software settings
Using motion control
{
{
Using EtherCAT
{
Using EtherNet/IP
{
Writing the user program
Using motion control
{
Using EtherCAT
{
{
{
{
Using EtherNet/IP
{
Programming error processing
{
Testing operation and debugging
Using motion control
{
Using EtherCAT
{
{
Using EtherNet/IP
{
Learning about error management and
{
corrections*2
Maintenance
Using motion control
Using EtherCAT
Using EtherNet/IP
{
{
{
{
{
*1 Refer to the NY-series Industrial Panel PC / Industrial Box PC Setup User’s Manual (Cat. No. W568) for how to set up and
how to use the utilities on Windows.
*2 Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for the error management concepts and an overview of
the error items.
2
NY-series Motion Control Instructions Reference Manual (W561)
Manual Structure
Manual Structure
Some of the instructions described in this manual are common to NJ/NX-series as well. Therefore, note
the following conditions.
• With the NY-series Controller, use the primary periodic task and priority-16 periodic task. You cannot
use the priority-5 periodic task.
• Use _MC_AX[*] when using the Axis Variable name of the system-defined variable. You cannot use
_MC1_AX[*] and _MC2_AX[*].
• Use _MC_GRP[*] when using the Axes Group Variable name of the system-defined variable. You
cannot use _MC1_GRP[*] and _MC2_GRP[*].
• In explanation of the instructions, replace the term “CPU Unit” with “NY-series Controller.”
• The unit version of the NY-series Controller is 1.12 or later.
NY-series Motion Control Instructions Reference Manual (W561)
3
Manual Structure
Page Structure
The following page structure is used in this manual.
Level-1 section heading
Level-2 section heading
3 Axis Command Instructions
MC_Power
The MC_Power instruction makes a Servo Drive ready to operate.
Instruction
Name
MC_Power
FB/FUN
Power Servo
Graphic expression
FB
ST expression
MC_Power_instance (
Axis :=parameter,
Enable :=parameter,
Status =>parameter,
Busy =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_Power_instance
MC_Power
Axis
Enable
Level-3 section heading
Axis
Status
Busy
Error
ErrorID
Variables
Input Variables
Name
Meaning
Enable
Enable
Data type
BOOL
Valid range
Default
TRUE or FALSE
FALSE
Description
The device is ready for operation when
Enable is TRUE, and not ready when it is
FALSE.
Output Variables
Name
Meaning
Data type
Valid range
Description
Status
Servo ON
BOOL
TRUE or FALSE
TRUE when the device is ready for operation.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to A-1 Error Codes.
Output Variable Update Timing
Name
Timing for changing to TRUE
Status
When the specified axis becomes
ready for operation.
Timing for changing to FALSE
• When operation ready status for the
specified axis is cleared.
• When Error changes to TRUE.
Busy
When Enable changes to TRUE.
• When Enable changes to FALSE.
• When Error changes to TRUE.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
3-2
Manual name
NJ-series Motion Control Instructions Reference Manual (W508)
3 Axis Command Instructions
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify an Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio. (The default axis variable names
are MC_Axis***.)
Level-2 section heading
Function
• When Enable changes to FALSE, the ready status is cleared for the axis specified by Axis.
You cannot control the axis after the ready status is cleared because it will not acknowledge operation commands. Also, an error occurs if a motion command is executed for an axis for which the
ready status is cleared. You can execute the MC_Power (Power Servo) and MC_Reset (Reset Axis
Error) instructions even for axes that are not ready.
• If home is not defined for a Servomotor with an absolute encoder, compensation is performed using
the absolute encoder home offset to define home when the axis is ready to operate.
For details on the absolute encoder home offset, refer to the NJ-series CPU Unit Motion Control
User’s Manual (Cat. No. W507).
Special information
Icons indicate
precautions, additional
information, or reference
information.
3
Function
• You can use this instruction to disable the operation of axes while they are in motion. In this case,
CommandAborted will change to TRUE. Output of the operation command will stop and the axis will
not longer be ready for operation.
MC_Power
• When Enable changes to TRUE, the axis specified by Axis is made ready to operate.
You can control the axis when it is ready to operate.
The level-2 section heading
is given.
Level-1 section number
The level-1 section number
is given.
Level-3 section heading
Precautions for Correct Use
• You can use this instruction for servo axes and virtual servo axes. If the instruction is used for
encoder axes or virtual encoder axes, an error will occur.
• Executing this Instruction for the Master Axis of Synchronized Control
When master axis operation is disabled for a vertical axis, the position of the master axis may
change rapidly. This may cause the motion of t he slave axis to change rapidly. Take suitable
measures to prevent the slave axis from moving rapidly, such as applying a brake to the master axis or leaving master axis operation enabled until after synchronized control is completed.
The level-3 section heading
is given.
Timing Charts
• When Enable changes to TRUE, Busy (Executing) changes to TRUE to indicate that the instruction
was acknowledged.
• After the axis becomes ready for operation, Status (Servo ON) changes to TRUE.
• When Enable changes to FALSE, Busy (Executing) changes to FALSE. Status (Servo ON) changes
to FALSE when ready status is cleared. Status (Servo ON) outputs the axis ready status regardless
of whether Enable is TRUE or FALSE.
Enable
Status
Busy
The specified axis becomes
ready for operation.
NJ-series Motion Control Instructions Reference Manual (W508)
Ready status is cleared for the
specified axis.
3-3
Note: This page is for illustration only. It does not represent a specific page in this manual.
4
NY-series Motion Control Instructions Reference Manual (W561)
Manual Structure
Special Information
Special information in this manual is classified as follows:
Precautions for Safe Use
Precautions on what to do and what not to do to ensure safe usage of the product.
Precautions for Correct Use
Precautions on what to do and what not to do to ensure proper operation and performance.
Additional Information
Additional information to read as required.
This information is provided to increase understanding or make operation easier.
Version Information
Information on differences in specifications and functionality for Controller with different unit versions
and for different versions of the Sysmac Studio are given.
Note References are provided to more detailed or related information.
NY-series Motion Control Instructions Reference Manual (W561)
5
Manual Structure
6
NY-series Motion Control Instructions Reference Manual (W561)
Sections in this Manual
Sections in this Manual
1
2
1
Introduction to Motion Control Instructions
3
2
Variables and Instructions
4
3
Axis Command Instructions
4
Axes Group Instructions
5
Common Command Instructions
A
Appendices
I
5
A
I
Index
NY-series Motion Control Instructions Reference Manual (W561)
7
Sections in this Manual
8
NY-series Motion Control Instructions Reference Manual (W561)
CONTENTS
CONTENTS
Introduction............................................................................................................... 1
Relevant Manuals...................................................................................................... 2
Manual Structure ...................................................................................................... 3
Sections in this Manual............................................................................................ 7
Terms and Conditions Agreement ........................................................................ 15
Safety Precautions ................................................................................................. 17
Precautions for Safe Use ....................................................................................... 18
Precautions for Correct Use .................................................................................. 19
Regulations and Standards ................................................................................... 20
Versions................................................................................................................... 21
Related Manuals ..................................................................................................... 23
Revision History ..................................................................................................... 26
Section 1
1-1
Introduction to Motion Control Instructions
Motion Control Instructions.................................................................................................... 1-2
Function Blocks for PLCopen® Motion Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-2
Overview of Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-3
Precautions for Master and Auxiliary Axes in Synchronized Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-6
1-2
Basic Information on Motion Control Instructions............................................................... 1-8
Motion Control Instruction Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-8
Languages for Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-8
Motion Control Instruction Locations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-9
Multi-execution of Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-17
Online Editing of Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-18
Changes in the Operating Mode of the NY-series Controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-18
Section 2
2-1
Variables and Instructions
Variables ................................................................................................................................... 2-2
MC Common Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-3
Axis Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-4
Axes Group Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-9
Input Variables for Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-12
Output Variables for Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-25
In-Out Variables for Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-28
2-2
Instructions ............................................................................................................................ 2-30
Common Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-30
Axis Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-31
Axes Group Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-32
2-3
PDO Mapping ......................................................................................................................... 2-34
Required Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-34
Objects Required for Specific Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .2-36
NY-series Motion Control Instructions Reference Manual (W561)
9
CONTENTS
Section 3
Axis Command Instructions
MC_Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-4
MC_MoveJog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-9
MC_Home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-17
MC_HomeWithParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-38
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-38
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-41
MC_Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-44
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-44
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-46
MC_MoveAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-49
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-49
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-51
Sample Programming 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-59
Sample Programming 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-67
MC_MoveRelative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-76
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-76
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-78
MC_MoveVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-83
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-83
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-85
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-90
MC_MoveZeroPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-98
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-98
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-100
MC_MoveFeed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-105
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-106
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-109
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-122
MC_Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-133
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-133
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-134
MC_ImmediateStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-142
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-142
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-143
MC_SetPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-147
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-147
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-148
MC_SetOverride . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-153
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-153
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-154
MC_ResetFollowingError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-158
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-158
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-159
MC_CamIn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-165
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-165
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-169
Sample Programming 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-192
Sample Programming 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-203
MC_CamOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-219
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-219
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-220
MC_GearIn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-224
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-224
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-226
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-233
10
NY-series Motion Control Instructions Reference Manual (W561)
CONTENTS
MC_GearInPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-243
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-243
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-246
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-254
MC_GearOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-264
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-264
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-266
MC_MoveLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-269
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-269
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-272
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-282
MC_CombineAxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-292
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-292
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-295
MC_Phasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-304
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-304
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-306
MC_TorqueControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-312
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-312
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-314
MC_SetTorqueLimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-323
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-323
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-324
MC_ZoneSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-330
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-330
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-332
MC_TouchProbe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-336
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-336
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-339
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-351
MC_AbortTrigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-358
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-358
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-360
MC_AxesObserve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-363
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-363
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-365
MC_SyncMoveVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-369
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-369
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-371
MC_SyncMoveAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-379
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-379
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-381
MC_Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-386
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-386
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-387
MC_ChangeAxisUse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-390
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-390
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-391
MC_DigitalCamSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-394
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-395
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-396
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-406
MC_TimeStampToPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-413
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-413
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-414
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-417
MC_SyncOffsetPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-425
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-425
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-427
NY-series Motion Control Instructions Reference Manual (W561)
11
CONTENTS
Section 4
Axes Group Instructions
MC_GroupEnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-3
MC_GroupDisable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-7
MC_MoveLinear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-12
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-23
MC_MoveLinearAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
MC_MoveLinearRelative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-41
MC_MoveCircular2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-45
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-54
MC_GroupStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-66
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-66
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-68
MC_GroupImmediateStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-75
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-75
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-76
MC_GroupSetOverride . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-79
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-79
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-80
MC_GroupReadPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-83
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-83
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-85
MC_ChangeAxesInGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-89
MC_GroupSyncMoveAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-91
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-91
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-93
MC_GroupReset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-97
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-97
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-98
Section 5
Common Command Instructions
MC_SetCamTableProperty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-2
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-3
MC_SaveCamTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-8
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
MC_Write . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-15
MC_GenerateCamTable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-21
Sample Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-35
MC_WriteAxisParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-47
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-47
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-49
12
NY-series Motion Control Instructions Reference Manual (W561)
CONTENTS
MC_ReadAxisParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-62
Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-62
Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .5-64
Appendices
A-1 Instructions for Which Multi-execution Is Supported ..........................................................A-2
A-1-1
A-1-2
Axis and Axes Group Status .......................................................................................................A-3
State Transitions and Instructions for which Multi-execution Is Supported .................................A-5
A-2 Connecting to NX Units ........................................................................................................A-10
Index
NY-series Motion Control Instructions Reference Manual (W561)
13
CONTENTS
14
NY-series Motion Control Instructions Reference Manual (W561)
Terms and Conditions Agreement
Terms and Conditions Agreement
Warranty, Limitations of Liability
Warranties
z Exclusive Warranty
Omron’s exclusive warranty is that the Products will be free from defects in materials and workmanship for a period of twelve months from the date of sale by Omron (or such other period expressed in
writing by Omron). Omron disclaims all other warranties, express or implied.
z Limitations
OMRON MAKES NO WARRANTY OR REPRESENTATION, EXPRESS OR IMPLIED, ABOUT
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OF
THE PRODUCTS. BUYER ACKNOWLEDGES THAT IT ALONE HAS DETERMINED THAT THE
PRODUCTS WILL SUITABLY MEET THE REQUIREMENTS OF THEIR INTENDED USE.
Omron further disclaims all warranties and responsibility of any type for claims or expenses based
on infringement by the Products or otherwise of any intellectual property right.
z Buyer Remedy
Omron’s sole obligation hereunder shall be, at Omron’s election, to (i) replace (in the form originally
shipped with Buyer responsible for labor charges for removal or replacement thereof) the non-complying Product, (ii) repair the non-complying Product, or (iii) repay or credit Buyer an amount equal
to the purchase price of the non-complying Product; provided that in no event shall Omron be
responsible for warranty, repair, indemnity or any other claims or expenses regarding the Products
unless Omron’s analysis confirms that the Products were properly handled, stored, installed and
maintained and not subject to contamination, abuse, misuse or inappropriate modification. Return of
any Products by Buyer must be approved in writing by Omron before shipment. Omron Companies
shall not be liable for the suitability or unsuitability or the results from the use of Products in combination with any electrical or electronic components, circuits, system assemblies or any other materials or substances or environments. Any advice, recommendations or information given orally or in
writing, are not to be construed as an amendment or addition to the above warranty.
See http://www.omron.com/global/ or contact your Omron representative for published information.
Limitation on Liability; Etc
OMRON COMPANIES SHALL NOT BE LIABLE FOR SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, LOSS OF PROFITS OR PRODUCTION OR COMMERCIAL LOSS IN ANY
WAY CONNECTED WITH THE PRODUCTS, WHETHER SUCH CLAIM IS BASED IN CONTRACT,
WARRANTY, NEGLIGENCE OR STRICT LIABILITY.
Further, in no event shall liability of Omron Companies exceed the individual price of the Product on
which liability is asserted.
NY-series Motion Control Instructions Reference Manual (W561)
15
Terms and Conditions Agreement
Application Considerations
Suitability of Use
Omron Companies shall not be responsible for conformity with any standards, codes or regulations
which apply to the combination of the Product in the Buyer’s application or use of the Product. At
Buyer’s request, Omron will provide applicable third party certification documents identifying ratings
and limitations of use which apply to the Product. This information by itself is not sufficient for a complete determination of the suitability of the Product in combination with the end product, machine, system, or other application or use. Buyer shall be solely responsible for determining appropriateness of
the particular Product with respect to Buyer’s application, product or system. Buyer shall take application responsibility in all cases.
NEVER USE THE PRODUCT FOR AN APPLICATION INVOLVING SERIOUS RISK TO LIFE OR
PROPERTY WITHOUT ENSURING THAT THE SYSTEM AS A WHOLE HAS BEEN DESIGNED TO
ADDRESS THE RISKS, AND THAT THE OMRON PRODUCT(S) IS PROPERLY RATED AND
INSTALLED FOR THE INTENDED USE WITHIN THE OVERALL EQUIPMENT OR SYSTEM.
Programmable Products
Omron Companies shall not be responsible for the user’s programming of a programmable Product, or
any consequence thereof.
Disclaimers
Performance Data
Data presented in Omron Company websites, catalogs and other materials is provided as a guide for
the user in determining suitability and does not constitute a warranty. It may represent the result of
Omron’s test conditions, and the user must correlate it to actual application requirements. Actual performance is subject to the Omron’s Warranty and Limitations of Liability.
Change in Specifications
Product specifications and accessories may be changed at any time based on improvements and other
reasons. It is our practice to change part numbers when published ratings or features are changed, or
when significant construction changes are made. However, some specifications of the Product may be
changed without any notice. When in doubt, special part numbers may be assigned to fix or establish
key specifications for your application. Please consult with your Omron’s representative at any time to
confirm actual specifications of purchased Product.
Errors and Omissions
Information presented by Omron Companies has been checked and is believed to be accurate; however, no responsibility is assumed for clerical, typographical or proofreading errors or omissions.
16
NY-series Motion Control Instructions Reference Manual (W561)
Safety Precautions
Safety Precautions
Refer to the following manuals for safety precautions.
• NY-series Industrial Box PC Hardware User’s Manual (Cat. No. W556)
• NY-series Industrial Panel PC Hardware User’s Manual (Cat. No. W557)
• NY-series Industrial Panel PC / Industrial Box PC Software User’s Manual (Cat. No. W558)
NY-series Motion Control Instructions Reference Manual (W561)
17
Precautions for Safe Use
Precautions for Safe Use
Refer to the following manuals for precautions for safe use.
• NY-series Industrial Box PC Hardware User’s Manual (Cat. No. W556)
• NY-series Industrial Panel PC Hardware User’s Manual (Cat. No. W557)
• NY-series Industrial Panel PC / Industrial Box PC Software User’s Manual (Cat. No. W558)
18
NY-series Motion Control Instructions Reference Manual (W561)
Precautions for Correct Use
Precautions for Correct Use
Refer to the following manuals for precautions for correct use.
• NY-series Industrial Box PC Hardware User’s Manual (Cat. No. W556)
• NY-series Industrial Panel PC Hardware User’s Manual (Cat. No. W557)
• NY-series Industrial Panel PC / Industrial Box PC Software User’s Manual (Cat. No. W558)
NY-series Motion Control Instructions Reference Manual (W561)
19
Regulations and Standards
Regulations and Standards
Conformance to EU Directives
Applicable Directives
• EMC Directives
Concepts
z EMC Directive
OMRON devices that comply with EU Directives also conform to the related EMC standards so that
they can be more easily built into other devices or the overall machine. The actual products have
been checked for conformity to EMC standards.*
Whether the products conform to the standards in the system used by the customer, however, must
be checked by the customer. EMC-related performance of the OMRON devices that comply with EU
Directives will vary depending on the configuration, wiring, and other conditions of the equipment or
control panel on which the OMRON devices are installed. The customer must, therefore, perform the
final check to confirm that devices and the overall machine conform to EMC standards.
*
Applicable EMC (Electromagnetic Compatibility) standards are as follows:
EMS (Electromagnetic Susceptibility): EN 61131-2
EMI (Electromagnetic Interference): EN 61131-2 (Radiated emission: 10-m regulations)
z Conformance to EU Directives
The NY-series Controllers comply with EU Directives. To ensure that the machine or device in which
the NY-series Controller is used complies with EU Directives, the Controller must be installed as follows:
• The NY-series Controller must be installed within a control panel.
• You must use the power supply in SELV specifications for the DC power supplies connected to DC
Power Supply Units and I/O Units.
• NY-series Controllers that comply with EU Directives also conform to the Common Emission Standard (EN 61000-6-4). Radiated emission characteristics (10-m regulations) may vary depending
on the configuration of the control panel used, other devices connected to the control panel, wiring, and other conditions.
You must therefore confirm that the overall machine or equipment complies with EU Directives.
Software Licenses and Copyrights
This product incorporates certain third party software. The license and copyright information associated with this software is available at http://www.fa.omron.co.jp/nj_info_e/.
20
NY-series Motion Control Instructions Reference Manual (W561)
Versions
Versions
Hardware revisions and unit versions are used to manage the hardware and software in NY-series Controllers and EtherCAT slaves. The hardware revision or unit version is updated each time there is a
change in hardware or software specifications. Even when two Units or EtherCAT slaves have the same
model number, they will have functional or performance differences if they have different hardware revisions or unit versions.
Checking Versions
You can check versions on the ID information indications or with the Sysmac Studio.
Checking Unit Versions on ID Information Indications
The unit version is given on the ID information indication on the back side of the product.
The ID information on an NY-series NY5…2-1……… Controller is shown below.
ID information indication
Unit version
Ver.1.
Checking Unit Versions with the Sysmac Studio
You can use the Sysmac Studio to check unit versions. The procedure is different for Units and for EtherCAT slaves.
z Checking the Unit Version of an NY-series Controller
You can use the Production Information while the Sysmac Studio is online to check the unit version
of a Unit. You can only do this for the Controller.
• Right-click CPU Rack under Configurations and Setup − CPU/Expansion Racks in the Multiview Explorer and select Production Information.
The Production Information Dialog Box is displayed.
z Changing Information Displayed in Production Information Dialog Box
Click the Show Detail or Show Outline Button at the lower right of the Production Information Dialog Box.
The view will change between the production information details and outline.
NY-series Motion Control Instructions Reference Manual (W561)
21
Versions
Outline View
Detail View
The information that is displayed is different for the Outline View and Detail View. The Detail View
displays the unit version, hardware revision, and other versions. The Outline View displays only the
unit version.
z Checking the Unit Version of an EtherCAT Slave
You can use the Production Information while the Sysmac Studio is online to check the unit version
of an EtherCAT slave. Use the following procedure to check the unit version.
1
Double-click EtherCAT under Configurations and Setup in the Multiview Explorer. Or, rightclick EtherCAT under Configurations and Setup and select Edit from the menu.
The EtherCAT Tab Page is displayed.
2
Right-click the master on the EtherCAT Tab Page and select Display Production Information.
The Production Information Dialog Box is displayed.
The unit version is displayed after “Rev.”
z Changing Information Displayed in Production Information Dialog Box
Click the Show Detail or Show Outline Button at the lower right of the Production Information Dialog Box.
The view will change between the production information details and outline.
Outline View
22
Detail View
NY-series Motion Control Instructions Reference Manual (W561)
Related Manuals
Related Manuals
The followings are the manuals related to this manual. Use these manuals for reference.
Manual name
NY-series
IPC Machine Controller
Industrial Panel PC
Hardware
User’s Manual
NY-series
IPC Machine Controller
Industrial Box PC
Hardware
User’s Manual
NY-series
IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Setup
User’s Manual
Cat. No.
W557
W556
W568
Model numbers
NY532-1………
NY512-1………
NY532-1………
NY512-1………
Application
Description
Learning the basic
specifications of the
NY-series Industrial
Panel PCs, including
introductory information, designing, installation, and
maintenance.
An introduction to the entire NY-series system
is provided along with the following information on the Industrial Panel PC.
Mainly hardware
information is provided.
• Installation and wiring
Learning the basic
specifications of the
NY-series Industrial
Box PCs, including
introductory information, designing, installation, and
maintenance.
An introduction to the entire NY-series system
is provided along with the following information on the Industrial Box PC.
Mainly hardware
information is provided.
• Installation and wiring
Learning about initial
setting of the NYseries Industrial PCs
and how to prepare
the Controller.
The following information is provided on an
introduction to the entire NY-series system.
• Features and system configuration
• Introduction
• Part names and functions
• General specifications
• Maintenance and inspection
• Features and system configuration
• Introduction
• Part names and functions
• General specifications
• Maintenance and inspection
• Two OS systems
• Initial settings
• Industrial PC Support Utility
• NYCompolet
• Industrial PC API
• Backup and recovery
NY-series
IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Software
User’s Manual
W558
NY532-1………
NY512-1………
Learning how to program and set up the
Controller functions
of an NY-series
Industrial PC.
The following information is provided on the
NY-series Controller functions.
• Controller operation
• Controller features
• Controller settings
• Programming based on IEC 61131-3 language specifications
NY-series
Instructions
Reference Manual
W560
NY-series
IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Motion Control
User’s Manual
W559
NY-series
Motion Control Instructions
Reference Manual
W561
NY532-1………
NY512-1………
NY532-1………
NY512-1………
NY532-1………
NY512-1………
NY-series Motion Control Instructions Reference Manual (W561)
Learning detailed
specifications on the
basic instructions of
the NY-series Industrial PC.
The instructions in the instruction set (IEC
61131-3 specifications) are described.
Learning about
motion control settings and programming concepts of an
NY-series Industrial
PC.
The settings and operation of the Controller
and programming concepts for motion control
are described.
Learning about the
specifications of the
motion control
instructions of an NYseries Industrial PC.
The motion control instructions are
described.
23
Related Manuals
Manual name
Cat. No.
NY-series
IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Built-in EtherCAT® Port
User’s Manual
W562
NY-series
IPC Machine Controller
Industrial Panel PC / Industrial Box PC
Built-in EtherNet/IP™ Port
User’s Manual
W563
NY-series
Troubleshooting
Manual
W564
Sysmac Studio Version 1
Operation Manual
W504
NX-series
EtherCAT® Coupler Unit
User’s Manual
NX-series NX Units User’s
Manuals
Model numbers
NY532-1………
Application
Description
Using the built-in EtherCAT port in an NYseries Industrial PC.
Information on the built-in EtherCAT port is
provided.
Using the built-in EtherNet/IP port in an
NY-series Industrial
PC.
Information on the built-in EtherNet/IP port is
provided.
Learning about the
errors that may be
detected in an NYseries Industrial PC.
Concepts on managing errors that may be
detected in an NY-series Controller and information on individual errors are described.
SYSMAC
-SE2………
Learning about the
operating procedures and functions
of the Sysmac Studio.
Describes the operating procedures of the
Sysmac Studio.
W519
NX-ECC………
Learning how to use
an NX-series EtherCAT Coupler Unit and
EtherCAT Slave Terminals.
The following items are described: the overall
system and configuration methods of an EtherCAT Slave Terminal (which consists of an
NX-series EtherCAT Coupler Unit and NX
Units), and information on hardware, setup,
and functions to set up, control, and monitor
NX Units through EtherCAT.
W521
NX-ID…………
Learning how to use
NX Units.
Describe the hardware, setup methods, and
functions of the NX Units.
NY512-1………
NY532-1………
NY512-1………
NY532-1………
NY512-1………
NX-IA…………
W522
This manual provides an introduction and
provides information on the configuration,
features, and setup.
Information is provided on the basic setup,
tag data links, and other features.
NX-OC…………
Manuals are available for the following Units.
NX-OD…………
Digital I/O Units, Analog I/O Units, System
Units, and Position Interface Units.
NX-AD…………
NX-DA…………
NX-TS…………
W523
NX-PD1………
NX-PF0………
NX-PC0………
NX-TBX……
W524
NX-EC0………
NX-ECS………
NX-PG0………
NX-series Data
Reference Manual
W525
NX-………………
Referring to the list of
data required for NXseries unit system
configuration.
Provides the list of data required for system
configuration including the power consumption and weight of each NX-series Unit.
GX-series EtherCAT Slave
Units User’s Manual
W488
GX-ID…………
Learning how to use
the EtherCAT remote
I/O terminals.
Describes the hardware, setup methods, and
functions of the EtherCAT remote I/O terminals.
GX-OD…………
GX-OC…………
GX-MD…………
GX-AD…………
GX-DA…………
GX-EC…………
XWT-ID……
XWT-OD……
24
NY-series Motion Control Instructions Reference Manual (W561)
Related Manuals
Manual name
Cat. No.
Model numbers
AC Servomotors/Servo
Drives 1S-series with Built-in
EtherCAT® Communications
User’s Manual
I586
AC Servomotors/Servo
Drives G5-series with Built-in
EtherCAT® Communications
User’s Manual
I573
R88M-K…
I576
R88M-K…
R88M-1…
R88D-1SN…-ECT
R88D-KN…-ECT-R
R88D-KN…-ECT
I577
R88L-EC-…
Application
Description
Learning how to use
the Servomotors/Servo Drives
with built-in EtherCAT Communications.
Describes the hardware, setup methods and
functions of the Servomotors/Servo Drives
with built-in EtherCAT Communications.
Learning how to use
the Servomotors/Servo Drives
with built-in EtherCAT Communications.
Describes the hardware, setup methods and
functions of the Servomotors/Servo Drives
with built-in EtherCAT Communications.
The linear motor type model and the model
dedicated for position controls are available in
G5-series.
R88D-KN…-ECT-L
NY-series Motion Control Instructions Reference Manual (W561)
25
Revision History
Revision History
A manual revision code appears as a suffix to the catalog number on the front and back covers of the
manual.
Cat. No. W561-E1-01
Revision code
Revision code
01
26
Date
September 2016 Original production
Revised content
NY-series Motion Control Instructions Reference Manual (W561)
1
Introduction to Motion Control
Instructions
This section gives an introduction to motion control instructions supported by NY-series
Controllers.
1-1 Motion Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-2
1-2 Basic Information on Motion Control Instructions . . . . . . . . . . . . . . . . . . . 1-8
NY-series Motion Control Instructions Reference Manual (W561)
1-1
1 Introduction to Motion Control Instructions
1-1
Motion Control Instructions
Motion control instructions are used in the user program to execute motion controls for an NY-series
Controller. These instructions are defined as function blocks.
The motion control instructions of the MC Function Module are based on the technical specifications of
function blocks for PLCopen® motion control.
There are two types of motion control instructions: PLCopen®-defined instructions and instructions that
are unique to the MC Function Module. This section provides an overview of the PLCopen® motion
control function blocks and motion control instructions.
For details on motion control instructions, refer to the NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for information on using
the NX-series Position Interface Units.
Function Blocks for PLCopen® Motion Control
PLCopen® standardizes motion control function blocks to define a program interface for the languages
specified in IEC 61131-3 (JIS B 3503). Single-axis positioning, electronic cams, and multi-axes coordinated control are defined along with basic procedures for executing instructions.
By using PLCopen® motion control function blocks, programming can be more easily reused without
hardware dependence. Costs for training and support are also reduced.
Additional Information
PLCopen®
PLCopen® is a promotion body for IEC 61131-3 that has its headquarters in Europe and a worldwide membership structure. IEC 61131-3 is an international standard for PLC programming.
PLCopen® Japan is the promotion committee for the Japanese market and consists of members
that have concerns related to the Japanese market.
• The website of headquarters of PLCopen® in Europe is http://www.plcopen.org/.
1-2
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
This section describes items defined in the technical specifications of function blocks for PLCopen®
motion control and provides an overview of their application in the MC Function Module.
1-1 Motion Control Instructions
Overview of Motion Control Instructions
Types of Motion Control Instructions
1
The following table list the different types of motion control instructions.
Classification
Type
Functional group
Common administration instructions
Cam tables
Instructions for axis
commands
Single-axis motion
instructions
Single-axis position
control
Parameters
These instructions are used to control the common
status of the MC Function Module, and to manipulate and monitor data.
These instructions move single axes.
Single-axis velocity control
Single-axis torque control
Single-axis synchronized control
Single-axis manual
operation
Instructions for axes
group commands
Single-axis administration instructions
Auxiliary functions for
single-axis control
This instructions control or monitor axis status.
Multi-axes motion
instructions
Multi-axes coordinated
control
These instructions perform coordinated movement
of an axes group.
Multi-axes administration instructions
Auxiliary functions for
multi-axes coordinated
control
These instructions control or monitor axes group
status.
State Transitions
State transitions are defined for axes, axes groups, and instruction execution. For details on the state
and state transitions of the MC Function Module, refer to the NY-series Industrial Panel PC / Industrial
Box PC Motion Control User’s Manual (Cat. No. W559).
Execution and Status of Motion Control Instructions
Variables that start instruction execution or that indicate the execution status are defined as common
rules for the instructions. There are two input variables that start instruction execution: Execute and
Enable. The output variables that indicate the execution status of an instruction include Busy, Done,
CommandAborted, and Error.
For detailed specifications of the MC Function Module, refer to the NY-series Industrial Panel PC /
Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Precautions for Correct Use
The timing in the timing charts that are given in this manual may not necessarily be the same as
the timing displayed for data traces on the Sysmac Studio.
Refer to the NY-series Industrial Panel PC / Industrial Box PC Software User’s Manual (Cat. No.
W558) for details on data tracing.
NY-series Motion Control Instructions Reference Manual (W561)
1-3
Overview of Motion Control Instructions
Instructions for common commands
Description
1 Introduction to Motion Control Instructions
Error Processing
You execute motion control instructions to implement motion control with the MC Function Module.
When motion control instructions are executed, input parameters and instruction processing are
checked for errors. If an error occurs in an instruction, the Error output variable from the instruction
changes to TRUE and an error code is output to ErrorID output variable.
There are two ways that you can use to program processing of errors for motion control instructions.
z Error Processing for Individual Instructions
You can use the Error and ErrorID output variables from the instruction to process errors that occur for
each instruction.
The following example shows how to determine if an Illegal Axis Specification occurs for the instruction
with the instance name PWR1. The instructions are programmed so that error processing is executed if
NoAxisErr changes to TRUE.
Turning ON the Servo
PWR1
MC_Power
Pwr1_En
MC_Axis000
Axis
Axis
Enable
Pwr1_Status
Status
Busy
Pwr1_Bsy
Error
Pwr1_Err
ErrorID
Pwr1_ErrID
Checking to See If the Specified Axis Exists
EQ
Pwr1_Err
NoAxisErr
EQ
Pwr1_ErrID
In1
WORD#16#5460
In2
In3
In4
In5
z Error Processing for Different Types of Errors
You can use the error status that is provided by the system-defined variables for motion control to
process each type of error separately.
The following example shows how to determine if a Slave Communications Error occurs for the axis
that is called MC_Axis000. The instructions are programmed so that error processing is executed if
ConnectErr changes to TRUE.
Checking for Communications Errors between the Controller and Servo Drive
EQ
Off
ConnectErr
EQ
MC_Axis000.MFaultLvl.Code
In1
WORD#16#8440
In2
In3
In4
In5
1-4
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
If the values of the input variables to an instruction instance are changed while the motion control
instruction is under execution and then Execute is changed to TRUE again, operation will follow the new
values.
1-1 Motion Control Instructions
For details on re-execution of MC Function Module instructions, refer to the NY-series Industrial Panel
PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
1
Changing Input Variables during Execution of Motion Control
Instructions (Restarting Instructions)
A different instruction instance can be executed during axis motion. You can specify when a motion
starts by setting an input variable called BufferMode. The following Buffer Modes are supported for BufferMode.
• Aborting: Abort (Aborting)
• Buffered: Standby (Buffered)
• Blending Low: Blending with the low velocity (BlendingLow)
• Blending Previous: Blending with the previous velocity (BlendingPrevious)
• Blending Next: Blending with the next velocity (BlendingNext)
• Blending High: Blending with the high velocity (BlendingHigh)
In Aborting Mode, other motions are aborted and the function block is executed immediately. In other
buffer modes, the next instruction waits until an output variable such as Done or InVelocity from the currently executed instruction changes to TRUE. For Buffered, the next instruction is executed after the
current instruction is executed and Done changes to TRUE. For the blending modes, two instruction
motions are executed consecutively without pausing. The transition velocity between the two motions is
selected from four buffer modes.
For the MC Function Module, BufferMode is also referred to as multi-execution of instructions.
For details on multi-execution of instructions for the MC Function Module, refer to the NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Whether multi-execution of instructions is supported in the MC Function Module depends on the current
axis status, the current axes group status, and the instruction to execute. Refer to A-1 Instructions for
Which Multi-execution Is Supported for detailed information.
Structures Used for Motion Control
Information required for motion control are defined as structures in PLCopen® technical materials. Data
type names and basic aspects are defined, but the contents of the structures are not defined.
NY-series Motion Control Instructions Reference Manual (W561)
1-5
Overview of Motion Control Instructions
Multi-execution of Instructions with BufferMode
1 Introduction to Motion Control Instructions
The main data types defined in PLCopen® and the data types used in the MC Function Module are
shown in the following table.
Data type
PLCopen®
Definition
MC Function Module
AXIS_REF
_sAXIS_REF
This is a structure that contains information on the corresponding axis.
AXES_GROUP_REF
_sGROUP_REF
This is a structure that contains information on the corresponding axes group.
TRIGGER_REF
_sTRIGGER_REF
This is a structure that contains information on trigger inputs.
• Trigger specifications
• Detection pattern information (positive, negative, both, edge,
level, pattern recognition, etc.)
INPUT_REF
---
This is a structure that contains information relating to the input
specifications. It may include virtual data. This data type is not
used by the MC Function Module.
OUTPUT_REF
_sOUTPUT_REF
This is a structure relating to physical outputs.
As shown in the above table, the MC Function Module uses some data types that are defined by PLCopen® and some that are defined specifically for the MC Function Module.
Refer to the NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No.
W559) for definitions of the data types and structures that are handled by the MC Motion Module.
Precautions for Master and Auxiliary Axes in Synchronized Control
Precautions that are related to sudden changes in velocity and conditions that lead to errors are given
below for master and auxiliary axes in synchronized control.
Sudden Changes in Velocity
When the velocity of the master or auxiliary axis changes suddenly when synchronized motion is
started or during synchronized motion, the motion of the slave axis can change suddenly and sometimes place an excessive load on the machine. Take suitable precautions in the following cases
because the velocity of the master or auxiliary axis may change suddenly.
• When one of the following three instructions is executed for the master or auxiliary axis:
MC_ImmediateStop instruction
MC_ResetFollowingError instruction
MC_SyncMoveVelocity (Cyclic Synchronous Velocity Control) instruction
To ensure that the slave axis does not move suddenly, set suitable input parameters and execution
timing for the above instructions or execute them after synchronized control has been released.
• When the immediate stop input signal or limit stop input signal changes to TRUE for the master or
auxiliary axis
• When the Servo turns OFF for the master or auxiliary axis
When the Servo is turned OFF when the master or auxiliary axis is a vertical axis, the position of the
axis may change suddenly. Take suitable measures to prevent the slave axis from moving suddenly,
such as applying a brake to the master or auxiliary axis or turning OFF the Servo after synchronized
control has been released.
• When you change the control mode of the Servo Drive
Take suitable precautions for changes in the velocity when an instruction is executed. Set suitable
input parameters for the instruction.
1-6
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
When any of the following four conditions occurs for the master or auxiliary axis when synchronized
motion is started or during synchronized motion, a Master Axis Position Read Error or Auxiliary Axis
Position Read Error occurs for the slave axis.
The CommandAborted output variable from the synchronized control instruction changes to TRUE at
the same time.
• EtherCAT process data communications are not established.
• An EtherCAT Slave Communications Error occurs while EtherCAT communications are not established.
• The slave is disconnected.
The following occur if multi-execution of instructions is used for synchronized control instructions for the
slave axis.
• Even if the master or auxiliary axis is in one of the four conditions given above, multi-execution of
instructions is acknowledged normally and the instruction is buffered.
• The motion for the buffered instruction is started as normal if none of the above four conditions exist.
Additional Information
If the MC_Home or MC_HomeWithParameter instruction is executed for the master or auxiliary
axis or if the MC_Power instruction is executed for an axis that uses an absolute encoder, the
slave ignores the changes in position of the master or auxiliary axis. Therefore, the slave axis
does not move suddenly when defining home.
NY-series Motion Control Instructions Reference Manual (W561)
1-7
1
Precautions for Master and Auxiliary Axes in Synchronized Control
• An Absolute Encoder Current Position Calculation Failed error occurs.
1-1 Motion Control Instructions
Conditions That Lead to Errors
1 Introduction to Motion Control Instructions
1-2
Basic Information on Motion Control
Instructions
This section describes basic specifications and restrictions for programming with motion control instructions for the MC Function Module built into the NY-series Controller. For details on motion control
instructions, refer to Section 3 Axis Command Instructions, Section 4 Axes Group Instructions, and
Section 5 Common Command Instructions.
Motion Control Instruction Names
All motion control instructions for the MC Function Module begin with “MC_”.
To see whether an instruction is defined by PLCopen® or whether it is an instruction defined for the MC
Function Module itself, refer to 2-2 Instructions.
Languages for Motion Control Instructions
Motion control instructions of the MC Function Module can be used in the following programming languages.
• Ladder diagrams (LD)
• Structured text (ST)
Ladder Diagrams (LD)
Instruction instances of motion control instructions are located in ladder diagrams. The instruction
instances can be named.
The following example shows the MC_MoveAbsolute (Absolute Positioning) instruction.
Instance name
In-out variable
MC_ABS_instance
Body name
MC_MoveAbsolute
PTP_Absolute MC_Axis001
Input parameters
Axis
Axis
Execute
Done
PTP_Position
Position
Busy
PTP_Velocity
Velocity
Active
PTP_Acc
Acceleration
PTP_Dec
Deceleration
Omitted.
Jerk
Omitted.
Direction
Omitted.
BufferMode
Axis1
PTP_Done
Output parameter
Command Aborted
Error
ErrorID
Output variables
Input variables
• The axis variable name of the Servo Drive or other device to control is specified with the in-out variable Axis.
• Motion conditions, such as the target position or target velocity, are specified with input variables.
• The status of the instruction or the status of the Servo Drive is output with output variables.
• If input parameters are omitted, input variables are set to default values.
1-8
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
The instruction instance name is specified. Instruction variables are written from upper left to lower left,
then upper right to lower right. The following example shows MC_MoveAbsolute (Absolute Positioning).
MC_ABS_instance(
Axis := MC_Axis001 ,
Execute := PTP_Absolute ,
1-2 Basic Information on Motion
Control Instructions
Structured Text (ST)
1
Position := PTP_Position ,
Velocity := PTP_Velocity ,
Motion Control Instruction Locations
Acceleration := PTP_Acc ,
Deceleration := PTP_Dec ,
Jerk := PTP_Jerk ,
Direction := _mcNoDirection ,
BufferMode := _mcAborting ,
Axis => MC_Axis001 ,
Done => PTP_Done
);
Motion Control Instruction Locations
This section describes the tasks in which motion control instructions can be located, and the differences in operation that can occur for different locations in the user program.
Task Types
Motion control instructions can be used in the primary periodic task or in a priority-16 periodic task. If
you use motion control instructions in any other task, an error will occur when you build the program.
Task type
Applicable?
Remarks
Primary periodic task
OK
• Common instructions for which an axis or axes group
is not specified.
• Instructions for an axis or axes group assigned to the
primary periodic task
Periodic task (execution priority: 16)
OK
• Common instructions for which an axis or axes group
is not specified.
• Instructions for an axis or axes group assigned to the
primary periodic task
Periodic task (execution priority: 17)
No
Periodic task (execution priority: 18)
No
Event task (execution priority: 8)
No
Event task (execution priority: 48)
No
NY-series Motion Control Instructions Reference Manual (W561)
1-9
1 Introduction to Motion Control Instructions
Function Block Definitions
You can also use motion control instructions in user-defined function block definitions.
Additional Information
Design efficiency is improved through program structuring, and program visibility is improved if a
process with multiple operations is treated as a single function block.
Master Control Regions
The area in a ladder diagram between the Master Control Start instruction (MC) and the Master Control
End instruction (MCR) is the master control region.
MC
Master control region
MCR
If a motion control instruction is located in the master control region, and the MC input condition is
FALSE, the following will occur.
• Motion control instructions for which input variable Enable or Execute is connected directly to the
left bus bar are executed with a FALSE value for Enable or Execute.
• Inline ST sections are executed normally.
• The values of the output parameters are updated as normal even when the Enable or Execute
input variables to the motion control instructions are FALSE.
z Enable-type Motion Control Instructions
• Instructions located in master control regions are equivalent to the programming shown on the
right in the following figure.
• When G0 is TRUE, MC_Power is executed normally.
• When G0 is FALSE, MC_Power is executed as if the Enable input variable was FALSE.
G0
MC
IN
PW1
PW1
MC_Power
Axis
Axis
MC_Power
Axis
Axis
Enable
Status
Busy
Equivalent
Status_PW
Busy_PW
G0 IN
Enable
Status
Busy
Status_PW
Busy_PW
MCR
1-10
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
1-2 Basic Information on Motion
Control Instructions
G0
IN
PW1.Busy_PW
PW1.Status_PW
Servo ON/OFF
1
z Execute-type Motion Control Instructions
• Instructions located in master control regions are equivalent to the programming shown on the
right in the following figure.
• When G0 is TRUE, MC_MoveRelative is executed normally.
• When G0 is FALSE, MC_MoveRelative is executed as if the Execute input variable was FALSE.
• Instructions executed when G0 is TRUE continue operation until completion, even if G0 changes
to FALSE during operation. The values of output parameters are also updated in the normal way.
G0
MC
Rel1
IN
Rel1
MC_MoveRelative
Axis
Axis
Execute
Equivalent
Done
Done_1
Busy
Active
G0 IN
MC_MoveRelative
Axis
Axis
Execute
Done
Done_1
Busy_1
Busy
Busy_1
Active_1
Active
Active_1
MCR
G0
IN
Rel1.Execute
Rel1.Busy_1
Positioning starts when
Execute changes to TRUE.
Rel1.Active_1
Rel1.Done_1
Positioning is completed when Execute changes
to FALSE, so Rel.Done_1 changes to TRUE for
one period.
Precautions for Correct Use
Execute-type motion control instructions are executed when G0 changes to TRUE. It is not recommended to use them in the master control region. If they must be used, be careful of the operation.
NY-series Motion Control Instructions Reference Manual (W561)
1-11
Motion Control Instruction Locations
Enable of the motion control instruction changes to
FALSE and the Servo turns OFF.
1 Introduction to Motion Control Instructions
Additional Information
• The function of the MC (Master Control Start) instruction is disabled in ST. All instructions in
ST are executed normally.
For details on the MC and MCR instructions, refer to the NY-series Instructions Reference Manual (Cat. No. W560).
Motion Control Instructions in ST Structure Instructions
This section describes the operation of motion control instructions when they are located in ST structures, such as IF, CASE, WHILE, or REPEAT structures.
When the evaluation result for the condition expression of an ST structure instruction is FALSE, the
motion control instructions within the structure are not executed. Also, the values of the output variables
are not updated.
If execution of an execute-type instruction is started and then the evaluation result changes to FALSE,
processing is continued until it is completed. In that case, however, the values of the output variables
are not updated.
Precautions for Correct Use
The execution status of an execute-type instruction in an ST structure will not be clear if the evaluation result of the condition expression changes to FALSE during execution of the instruction.
We therefore do not recommend using execution-type instructions in ST structures.
If they must be used, be careful of the operation.
Additional Information
To switch the execution of an execute-type instruction with the condition expression, place only
the Execute input parameter in the ST structure. Place the execute-type instruction itself outside
of the ST structure.
For details on the ST structure instructions, refer to the NY-series Instructions Reference Manual
(Cat. No. W560).
Treatment of REAL and LREAL Data
REAL and LREAL are floating-point decimal data types. This section describes how they are expressed
and processed.
z REAL and LREAL Data Sizes
The data sizes of REAL data and LREAL data are different. REAL data has 32 bits and LREAL data
has 64 bits.
z Floating-point Decimal Data Format
A real number in floating-point decimal format is expressed using a sign, exponent, and mantissa.
When a real number is substituted in the following formulas, the value corresponding to ‘s’ becomes
the sign, ‘e’ the exponent, and ‘f’ the mantissa.
• REAL Data
Number = (−1)s2e−127(1 + f × 2−23)
• LREAL Data
Number = (−1)s2e−1023(1 + f × 2−52)
1-12
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
Sign Exponent
REAL data (32 bits)
s
Mantissa
e
f
31 30 23 22
Sign
LREAL data (64 bits)
0
Exponent
s
Mantissa
e
63 62
1-2 Basic Information on Motion
Control Instructions
The floating-point data format conforms to the IEEE754 standards. The following formats are used.
f
52 51
1
0
Example: Expressing −86.625 as REAL Data
Motion Control Instruction Locations
1
Setting the Sign
The number is negative, so s = 1.
2
Binary Expression
The number 86.625 is 1010110.101 as a binary number.
3
Normalized Binary Expression
When the above number is normalized, it becomes 1.010110101 × 26.
4
Exponent Expression
From the previous equation, e-127 = 6. Therefore e = 133. The number 133 is 10000101 as a
binary number. This expresses the exponent.
5
Mantissa Expression
Numbers following the decimal point in 1.010110101 are 010110101. This number is expressed
using 23 bits, but here there are insufficient digits. Therefore zeros are added. The 23-bit figure
becomes f. Therefore f = 01011010100000000000000.
Therefore, −86.625 is expressed as shown in the following figure.
Sign Exponent
REAL data (32 bits)
Mantissa
1 10000101 01011010100000000000000
31 30
23 22
0
z Valid Ranges
The valid ranges of REAL and LREAL are shown in the following table.
Data type
−∞
Negative numbers
0
Positive number
+∞
REAL
−∞
−3.402823e+38 to
−1.175495e-38
0
+1.175495e-38 to
+3.402823e+38
+∞
LREAL
−∞
−1.79769313486231e+308 to
−2.22507385850721e−308
0
+2.22507385850721e−308 to
+1.79769313486231e+308
+∞
NY-series Motion Control Instructions Reference Manual (W561)
1-13
1 Introduction to Motion Control Instructions
REAL −3.402823e+38
LREAL −1.79769313486231e+308
REAL +3.402823e+38
LREAL +1.79769313486231e+308
−∞
+∞
0
REAL −1.175495e−38
LREAL −2.22507385850721e−308
REAL +1.175495e−38
LREAL +2.22507385850721e−308
z Special Numbers
Positive infinity, negative infinity, +0, −0, and nonnumeric data are called special numbers. Nonnumeric data is data that cannot be expressed in floating-point decimal format. They are not treated as
numbers. Mathematically, +0 and −0 both mean the same as 0, but in data processing it is treated
differently.
A detailed explanation is given later. The sign ‘s’, exponent ‘e’, and mantissa ‘f’ for special numbers
take on the following values.
Data type
REAL
LREAL
1-14
Special number
Sign s
Exponent e
Mantissa f
+∞
0
255
0
−∞
1
255
0
+0
0
0
0
−0
1
0
0
Nonnumeric data
---
255
Not 0
+∞
0
2047
0
−∞
1
2047
0
+0
0
0
0
−0
1
0
0
Nonnumeric data
---
2047
Not 0
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
Numbers that are very close to 0 (with very small absolute values) cannot be expressed using the
floating-point decimal format. Subnormal numbers were introduced to expand the validity of numbers near 0. Subnormal numbers can be used to express numbers whose absolute values are
smaller than numbers expressed in the normal data format.
1-2 Basic Information on Motion
Control Instructions
z Subnormal Numbers
Additional Information
Values expressed in the normal data format are called normalized numbers or normal numbers.
• REAL Data
Number = (−1)s2−126(f × 2−23)
• LREAL Data
Number = (−1)s2−1022(f × 2−52)
Example: Expressing 0.75 x 2−127 as REAL Data
1
Setting the Sign
The number is positive, so s = 0.
2
Binary Expression
The number 0.75 is 0.11 as a binary number.
3
Mantissa Calculation
From (0.11)2 × 2−127 = 2−126(f × 2−23), f = (0.11)2 × 222.
4
Mantissa Expression
From the previous equation, f = 01100000000000000000000.
Therefore, 0.75 × 2−127 is expressed as shown in the following figure.
Sign Exponent
REAL data (32 bits) 0
Mantissa
00000000 01100000000000000000000
31 30
23 22
0
Subnormal numbers have fewer effective digits than normalized numbers. Therefore, if the calculation
of a normalized number results in an subnormal number, or if an intermediate result is an subnormal
number, the number of effective digits of the calculated result may be less than that of the normalized
number.
NY-series Motion Control Instructions Reference Manual (W561)
1-15
Motion Control Instruction Locations
Numbers with exponent e=0 and mantissa f ≠ 0 are considered subnormal numbers and their values
are expressed in the following manner.
1
1 Introduction to Motion Control Instructions
z Data Processing
The floating-point decimal format is an approximate expression of a value, with a slight error from
the actual value. There is a limit to the valid range of the value. For these reasons, the following process should be used for calculation.
Rounding
If the actual value exceeds the effective digits of the mantissa, the value must be rounded according
to the following rules.
• Of the values that can be expressed in floating-point decimal format, the value that is closest to
the actual value is taken as the calculation result.
• If there are two values that are equally close to the actual value that can be expressed in floatingpoint decimal format, the value with the lowest significant 0 bit is taken as the calculation result.
When there are two values that are equally close to the actual value, the actual value is exactly in
the middle of the two values.
Overflows and Underflows
When the true absolute value exceeds the values that can be expressed by a floating-point data
type, it is called an overflow. On the other hand, if the value is smaller than the values that can be
expressed by a floating-point decimal data type, it is called an underflow.
• If the sign of the true value is positive, the processing result will be positive infinity when an overflow occurs. If the sign of the true value is negative, the processing result will be negative infinity
when an overflow occurs.
• If the sign of the true value is positive, the processing result will be +0 when an underflow occurs.
If the sign of the true value is negative, the processing result will be −0 when an overflow occurs.
Calculating with Special Numbers
The following rules apply when calculating with special numbers. For details on special values, refer
to Special Numbers on page 1-14.
• Adding positive infinity and negative infinity results in nonnumeric data.
• Subtracting infinity from infinity with the same signs results in nonnumeric data.
• Multiplying +0 by infinity or −0 by infinity results in nonnumeric data.
• Dividing +0 by +0, −0 by −0, or infinity by infinity results in nonnumeric data.
• Adding +0 and −0 results in +0.
• Subtracting +0 from +0, or −0 from −0 results in +0.
• Basic arithmetic operations including nonnumeric data results in nonnumeric data.
• Comparison instructions such as the CMP instruction treat +0 and −0 as the same value.
• If a nonnumeric number is included in a comparison, the comparison instruction always returns
"not equal."
Precautions for Correct Use
Floating-point decimal (LREAL) variables are used to set electronic gears, target positions, and
other parameters of motion control instructions in the MC Function Module. For this reason, calculation results contain rounding errors. For example, if the MC_MoveRelative (Relative Positioning) instruction is repeatedly executed, following error will accumulate. If the accumulated error
becomes a problem, set the command unit to pulses, or specify an absolute position with the
MC_MoveAbsolute (Absolute Positioning) instruction.
1-16
NY-series Motion Control Instructions Reference Manual (W561)
1 Introduction to Motion Control Instructions
• In the following programming, instruction instances Move1 and Move2 start in the same task period
when bit a turns ON.
1-2 Basic Information on Motion
Control Instructions
• Instructions in a program are executed from the top. Therefore Move1 is started first, and then Move2
is started before Move1 is finished.
1
Multi-execution of Motion Control Instructions
This section describes executing multiple motion control instructions for the same axis within the same
task period.
• This is considered multi-execution of motion control instructions (BufferMode). In this example,
Blending is used to execute Move2 in relation to Move1.
Axis 1
Move1
Axis
Aborting
Axis 1
Move2
Axis
Blending
For details on multi-execution of motion control instructions, refer to the NY-series Industrial Panel PC /
Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Additional Information
If the MC_SetOverride (Set Override Factors) instruction is executed simultaneously in the same
way as the instructions shown above, the override value is valid even when it is placed on the
bottom. When different override values are set with the MC_SetOverride (Set Override Factors)
instruction, the following type of programming is recommended.
A
MOVE
rate
50
B
MOVE
rate
70
MC_SetOverride
C
Axis 1
Axis
rate
NY-series Motion Control Instructions Reference Manual (W561)
1-17
Multi-execution of Motion Control Instructions
Bit a
1 Introduction to Motion Control Instructions
Online Editing of Motion Control Instructions
You can perform the following online editing operations for motion control instructions from the Sysmac
Studio.
Online editing operations
Deleting motion control instructions
Adding motion control instructions
Adding input variables, output variables, and in-out variables to motion control instructions
Changing input variables, output variables, and in-out variables in motion control instructions
Deleting input variables, output variables, and in-out variables in motion control instructions.
Precautions for Correct Use
If instructions to stop the axis motion, such as MC_Stop or MC_GroupStop, are deleted while the
axis is still moving, the axis may not stop depending on the contents of the user program. Make
sure that it is safe to use the online editing before using it for motion control instructions.
Changes in the Operating Mode of the NY-series Controller
An NY-series Controller has two operating modes: PROGRAM mode and RUN mode. This section
describes the operation of the MC Function Module when the operating mode changes.
Changes from RUN Mode to PROGRAM Mode
• The motion control instruction that is under execution will be aborted. The CommandAborted output
variable remains FALSE, but the operation is the same as when CommandAborted is TRUE.
• If the axis is moving, it will decelerate to a stop at the maximum deceleration. The Servo ON/OFF status will continue.
• If saving the cam table is in progress for the Save Cam Table instruction, the save operation continues.
• If creation of the cam table is in progress for the Generate Cam Table instruction, the creation operation continues.
• Motion control instructions located in a priority 16 periodic task perform the above process after the
END instruction in the task is executed.
Changes from PROGRAM Mode to RUN Mode
• The output variables of the motion control instructions are cleared.
• The axis decelerates to a stop when the mode changes from RUN mode to PROGRAM mode. If the
operating mode is changed back to RUN mode while the axis is decelerating, the output variables
from the motion control instruction are cleared. Therefore, CommandAborted of the motion control
instruction that was under execution remains FALSE.
Additional Information
• To enable accessing output variables for motion control instructions even after the operating
mode changes, assign variables that have output parameters with a Retain attribute. By
accessing the assigned output parameter, you can access the output variable immediately
before the operating mode changes.
• The Servo ON/OFF status will continue even if the operating mode is changed.
1-18
NY-series Motion Control Instructions Reference Manual (W561)
2
Variables and Instructions
This section describes the variables and instructions for the Motion Control Function
Module.
2-1 Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-2
2-2 Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-30
2-3 PDO Mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-34
NY-series Motion Control Instructions Reference Manual (W561)
2-1
2 Variables and Instructions
2-1
Variables
There are two types of variables for the MC Function Module.
The first type is system-defined variables, which you use to monitor axis status and some of the parameter settings. System-defined variables that are used by the MC Function Module are called systemdefined variables for motion control.
The second type is variables that are used to input arguments to motion control instructions and to output execution status from motion control instructions. Some input variables to motion control instruction
are enumerated variables. With enumerated variables, selections are made from a set of enumerators.
This section describes the variable types, the valid ranges of motion control instruction input variables,
and the enumerated variables.
z System-defined Variables for Motion Control
Level 1
System-defined
variables
Level 2
System-defined
variables for
motion control
Level 3
Description
MC Common Variable
You can monitor the overall status of the MC
Function Module.
Axis Variables
You can monitor axis status and the settings of
part of the axis parameters.
Axes Group Variable
You can monitor axes group status and the settings of part of the axes group parameters.
For details on system-defined variables for motion control, refer to the NY-series Industrial Panel PC
/ Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Additional Information
Axis Variables and Axes Group Variables are system-defined variables.
When you use them in the user program, use the system-defined variable names (_MC_AX[*]
and _MC_GRP[*]). You can also use the variable names that are set on the Sysmac Studio in the
user program. You can change the names of any of the Axis Variables or Axes Group Variables
that you create on the Sysmac Studio. In the following example, the Axis Variable name for the
axis that was added for the system-defined Axis Variable name of _MC_AX[0] has been changed
to MyAxis1 in the Sysmac Studio.
Axis in-out variable
Specify the name
of an Axis Variable.
MyAxis1
MC_Power_instance
MC_Power
Axis
Enable
ServoOn
Axis
Status
MyAxis1OnStatus
Busy
MyAxis1OnBusy
Error
MyAxis1OnError
ErrorID
2-2
MyAxis1
MyAxis1OnErrorID
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
z Variables for Motion Control Instructions
Type
Outline
Instruction arguments
Output variables
Instruction execution status monitoring information
In-out variables
Specify data to process with the
instruction
2-1 Variables
Input variables
Additional Information
• Data types that start with “_e” are enumerations.
2
• Data types that start with “_s” are structures.
MC Common Variables
The variable name _MC_COM is used for the MC Common Variables. The data type is _sCOMMON_REF, which is a structure. This section describes the configuration of the MC Common Variables
and provides details on the members.
Name
_MC_COM
Data type
Meaning
Function
_sCOMMON_REF
MC Common Variable
_sCOMMON_REF_STA
MC Common Status
RunMode
BOOL
MC Run
TRUE during MC Function Module operation.
TestMode
BOOL
MC Test Run
TRUE during test mode operation from the
Sysmac Studio.
CamTableBusy
BOOL
Cam Table File Save Busy
TRUE while the Cam Table is being saved
or on standby.
GenerateCamBusy
BOOL
Cam Table Creation Busy
TRUE while the cam table is being created.
_sMC_REF_EVENT
MC Common Partial Fault
Active
BOOL
MC Common Partial Fault
Occurrence
TRUE while there is an MC common partial fault.
Code
WORD
MC Common Partial Fault
Code
Contains the code for an MC common partial fault. The upper four digits of the event
code have the same value.
_sMC_REF_EVENT
MC Common Minor Fault
Active
BOOL
MC Common Minor Fault
Occurrence
TRUE while there is an MC common minor
fault.
Code
WORD
MC Common Minor Fault
Code
Contains the code for an MC common
minor fault. The upper four digits of the
event code have the same value.
_sMC_REF_EVENT
MC Common Observation
Active
BOOL
MC Common Observation
Occurrence
TRUE while there is an MC common
observation.
Code
WORD
MC Common Observation
Code
Contains the code for an MC common
observation. The upper four digits of the
event code have the same value.
Status
PFaultLvl
MFaultLvl
Obsr
NY-series Motion Control Instructions Reference Manual (W561)
2-3
MC Common Variables
For details on the data types that are handled by the MC Function Module, refer to the NY-series
Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
2 Variables and Instructions
Axis Variables
The variable names of the system-defined Axis Variables are _MC_AX[0..63]. The data type is _sAXIS_REF, which is a structure.
Name
_MC_AX[0..63]
Data type
Meaning
Function
_sAXIS_REF
Axis Variable
_sAXIS_REF_STA
Axis Status
Ready
BOOL
Axis Ready-to-execute
TRUE when preparations for axis execution are
finished and the axis is stopped. This variable
gives the same status as _MC_AX[*].Status.Standstill (TRUE: standstill).
Disabled
BOOL
Axis Disabled
TRUE while the Servo is OFF for the axis. This
includes the following status.
The following axis status are mutually exclusive.
Only one of them can be TRUE at a time.
Status
Disabled, Standstill, Discrete, Continuous, Synchronized, Homing, Stopping, ErrorStop, or
Coordinated
2-4
Standstill
BOOL
Standstill
TRUE while the Servo is ON for the axis.
Discrete
BOOL
Discrete Motion
TRUE while position control is executed toward
the target position.
This includes when the velocity is 0 because the
override factor was set to 0 during a discrete
motion.
Continuous
BOOL
Continuous Motion
TRUE during continuous motion without a target
position.
This state exists during velocity control and
torque control.
This includes when the velocity is 0 because the
target velocity is set to 0 and when the velocity is
0 due to an override factor set to 0 during continuous motion.
Synchronized
BOOL
Synchronized Motion
TRUE during execution of synchronized control.
This includes waiting for synchronization after
changing to synchronized control instructions.
Homing
BOOL
Homing
TRUE when homing for the MC_Home or
MC_HomeWithParameter instruction.
Stopping
BOOL
Deceleration Stopping
TRUE until the axis stops for a MC_Stop or
MC_TouchProbe instruction. This includes when
Execute is TRUE after the axis stops for an
MC_Stop instruction. Axis motion instructions
are not executed while decelerating to a stop.
(CommandAborted is TRUE.)
ErrorStop
BOOL
Error Deceleration Stopping
This status exists when the axis is stopping or
stopped for execution of the MC_ImdediateStop
instruction or a minor fault (while
_MC_AX[*].MFaultLvl.Active is TRUE (Axis
Minor Fault Occurrence).
Axis motion instructions are not executed in this
state (CommandAborted is TRUE).
Coordinated
BOOL
Coordinated Motion
TRUE when an axes group is enabled by a multiaxes coordinated control instruction.
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Details
Data type
Meaning
Function
Axis Control Status*1
Idle
BOOL
Idle
TRUE when processing is not currently performed for the command value, except when
waiting for in-position state.*2
Idle and InPosWaiting are mutually exclusive.
They cannot both be TRUE at the same time.
InPosWaiting
BOOL
In-position Waiting
TRUE when waiting for in-position state. The inposition check is performed when positioning for
the in-position check.
Homed
BOOL
Home Defined
TRUE when home is defined.*3
2-1 Variables
_sAXIS_REF_DET
TRUE: Home defined.
2
FALSE: Home not defined.
InHome
BOOL
In Home Position
TRUE when the axis is in the range for home. It
gives an AND of the following conditions.
• The actual current position is in the zero position range with home as the center.
TRUE also when the zero position is passed by
while the axis is moving in command status.
BOOL
Command Velocity Saturation
_sAXIS_REF_DIR
Command Direction*5
Posi
BOOL
Positive Direction
TRUE when there is a command in the positive
direction.
Nega
BOOL
Negative Direction
TRUE when there is a command in the negative
direction.
_sAXIS_REF_STA_DRV
Servo Drive Status*6
ServoOn
BOOL
Servo ON
TRUE when the Servomotor is powered.
VelLimit*4
Dir
DrvStatus
TRUE while the axis velocity is held to the maximum velocity during synchronized control.
Ready
BOOL
Servo Ready
TRUE when the Servo is ready.
MainPower
BOOL
Main Power
TRUE when the Servo Drive main power is ON.
P_OT
BOOL
Positive Limit Input
TRUE when the positive limit input is enabled.
N_OT
BOOL
Negative Limit Input
TRUE when the negative limit input is enabled.
HomeSw
BOOL
Home Proximity Input
TRUE when the home proximity input is
enabled.
Home
BOOL
Home Input
TRUE when the home input is enabled.*7
ImdStop
BOOL
Immediate Stop Input
TRUE when the immediate stop input is
enabled.
Latch1
BOOL
External Latch Input 1
TRUE when latch input 1 is enabled.
Latch2
BOOL
External Latch Input 2
TRUE when latch input 2 is enabled.
DrvAlarm
BOOL
Drive Error Input
TRUE while there is a Servo Drive error.
DrvWarning
BOOL
Drive Warning Input
TRUE while there is a Servo Drive warning.
ILA
BOOL
Drive Internal Limiting
TRUE when the Servo Drive limiting function
actually limits the axis.*8
CSP
BOOL
Cyclic Synchronous Position (CSP) Control Mode
TRUE when the Servo is ON at the Servo Drive
and the current mode is CSP Mode.*9
CSV
BOOL
Cyclic Synchronous Velocity
(CSV) Control Mode
TRUE when the Servo is ON at the Servo Drive
and the current mode is CSV Mode.*9
CST
BOOL
Cyclic Synchronous Torque
(CST) Control Mode
TRUE when the Servo is ON at the Servo Drive
and the current mode is CST Mode.*9
NY-series Motion Control Instructions Reference Manual (W561)
2-5
Axis Variables
• Home defined
2 Variables and Instructions
Name
Cmd
Data type
_sAXIS_REF_CMD_
Meaning
Function
Axis Command Value
DATA
Pos
LREAL
Command Current Position
Contains the current value of the command position. (Unit: command units)
When the Servo is OFF and the mode is not
position control mode, this variable contains the
actual current position.*10
Vel
LREAL
Command Current Velocity
Contains the current value of the command
velocity. (Unit: command units/s)
A plus sign is added when traveling in the positive direction, and a minus sign when traveling in
the negative direction. The velocity is calculated
from the difference with the command current
position. When the Servo is OFF and the mode
is not the position control mode, the velocity is
calculated based on the actual current position.
AccDec
LREAL
Command Current Acceleration/Deceleration
Contains the current value of the command
acceleration/deceleration rate. (Unit: command
units/s2)
The acceleration/deceleration rate is calculated
from the difference with the command current
velocity. A plus sign is added for acceleration,
and a minus sign is added for deceleration. Zero
when the command acceleration/deceleration
rate of the instruction under execution is 0.
Jerk
LREAL
Command Current Jerk
Contains the current value of the command jerk.
(Unit: command units/s3)
A plus sign is added when the absolute value of
acceleration/deceleration is increasing, and a
minus sign is added when it is decreasing. Zero
when the command acceleration/deceleration
rate and command jerk of the instruction under
execution is 0.
Trq
LREAL
Command Current Torque
Contains the current value of the command
torque. (Unit: %)
A plus sign is added when traveling in the positive direction, and a minus sign when traveling in
the negative direction. Contains the same value
as the actual current torque except in torque
control mode.
_sAXIS_REF_ACT_DATA
Axis Current Value
Pos
LREAL
Actual Current Position
Contains the actual current position. (Unit: command units)*10
Vel
LREAL
Actual Current Velocity
Contains the actual current velocity. (Unit: command units/s)
A plus sign is added when traveling in the positive direction, and a minus sign when traveling in
the negative direction.
Trq
LREAL
Actual Current Torque
Contains the current value of the actual torque.
(Unit: %)
A plus sign is added when traveling in the positive direction, and a minus sign when traveling in
the negative direction.
TimeStamp
ULINT
Time Stamp
Contains the time when the current position of
the axis was updated. This variable is valid for
an axis for which time stamping is operating.
(Unit: ns)
_sMC_REF_EVENT
Axis Minor Fault
Active
BOOL
Axis Minor Fault Occurrence
TRUE while there is an axis minor fault.
Code
WORD
Axis Minor Fault Code
Contains the code for an axis minor fault. The
upper four digits of the event code have the
same value.
Act
MFaultLvl
2-6
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Obsr
Data type
Meaning
Function
Axis Observation
Active
BOOL
Axis Observation Occurrence
TRUE while there is an axis observation.
Code
WORD
Axis Observation Code
Contains the code for an axis observation. The
upper four digits of the event code have the
same value.
_sAXIS_REF_CFG
Axis Basic Settings*11
AxNo
UINT
Axis Number
Contains the logical number of the axis.
This number is accessed to recognize the axis
number when accessing _sAXIS_REF.
AxEnable
_eMC_AXIS_USE
Axis Use
Shows if the axis is enabled or disabled.
Cfg
2-1 Variables
_sMC_REF_EVENT
2
0: _mcNoneAxis (Undefined Axis)
1: _mcUnusedAxis (Unused Axis)
2: _mcUsedAxis (Used Axis)
_eMC_AXIS_TYPE
Axis Type
Contains the axis type.
I/O wiring is not required for virtual axes.
Axis Variables
AxType
0: _mcServo (Servo Axis)
1: _mcEncdr (Encoder Axis)
2: _mcVirServo (Virtual Servo Axis)
3: _mcVirEncdr (Virtual Encoder Axis)
NodeAddress
UINT
Node Address
Contains the EtherCAT slave address.*12
A value of 16#FFFF indicates that there is no
address.
ExecID
UNIT
Execution ID
Contains the task execution ID.
0: Not assigned to task (undefined axis).
1: Assigned to primary periodic task
Scale
_sAXIS_REF_SCALE
Unit Conversion Settings*13
Num
UDINT
Command Pulse Count Per
Motor Rotation
Contains the number of pulses per motor rotation for command positions.
The command value is converted to a number of
pulses based on the electronic gear ratio.
Den
LREAL
Work Travel Distance Per
Motor Rotation
Contains the workpiece travel distance per
motor rotation for command positions.*14
Units
_eMC_UNITS
Unit of Display
Contains the display unit for command positions.
0: _mcPls(pulse)
1: _mcMm(mm)
2: _mcUm(μm)
3: _mcNm(nm)
4: _mcDeg(degree)
5: _mcInch(inch)
CountMode
_eMC_COUNT_MODE
Count Mode
Contains the count mode.
0: _mcCountModeLinear (Linear Mode)
1: _mcCountModeRotary (Rotary Mode)
MaxPos
LREAL
Maximum current position
Contains the maximum value of the current position indication.*15
MinPos
LREAL
Minimum current position
Contains the minimum value of the current position indication.*16
*1 Gives the control status of the command.
*2 This also includes states where processing is performed while in motion at velocity 0, during following error counter
resets, during synchronized control, and during multi-axes coordinated control motion.
*3 Even if the variable is TRUE, the home must be defined again in the following cases.
When you make a change in the position count settings or the unit conversion settings.
If an error or erroneous operation occurs on the Servo Drive, which leads to loss of absolute position data. Examples of
errors and erroneous operations include breaks of encoder cables and clear of absolute encoder data.
*4 Use VelLimit only for a slave axis that is currently in synchronized control.
NY-series Motion Control Instructions Reference Manual (W561)
2-7
2 Variables and Instructions
*5 Gives the command travel direction.
*6 Gives the status of the Servo Drive or other device.
*7 This variable shows the status of the signal that is set for the Encoder Phase Z Detection setting of the digital inputs in the
Detailed Settings Area of the Axis Basic Settings Display of the Sysmac Studio. You may not be able to map this signal to
a PDO for a servo driver from another manufacturer. Refer to the manual for the servo driver.
*8 This variable shows the status of bit 11(internal limit active) of the Status word (6041 hex) mapped to a PDO. The condition for it to change to TRUE depends on the specifications of the Servo Drive. Refer to the manual for the servo driver.
This corresponds to one of the following limits in the OMRON 1S-series Servo Drive and G5-series Servo Drive.
Torque limit
Velocity limit
Drive prohibit input
Software limits
*9 These variables are based on the value of the Modes of operation display (6061 hex) mapped to a PDO. The conditions
for CSP, CSV, and CST to change to TRUE depend on the specifications of the Servo Drive. Refer to the manual for the
servo driver. If the Modes of operation display (6061 hex) is not mapped to a PDO, they are TRUE when the status of the
Statusword (6041 hex) that was mapped to a PDO is Operation Enabled.
*10 When process data communications is not established between the NY-series Controller and an EtherCAT slave assigned
to an axis or between the NY-series Controller and an NX Unit, the actual current position and command current position
in the Axis Variable will be the actual current position from just before process data communications changed to a nonestablished state.
*11 This variable shows the settings in the Axis Basic Settings.
*12 For an NX-series Position Interface Unit, this is the node address of the EtherCAT Coupler Unit under which the Position
Interface Unit is mounted.
*13 This variable shows the settings of the electronic gear ratio.
*14 The parameter is disabled if you set to use a reducer in the unit conversion settings. To confirm alternatively enabled
parameters, i.e. Work Travel Distance Per Rotation, Work Gear Ratio, and Motor Gear Ratio, use the MC_ReadAxisParameter (Read Axis Parameters) instruction.
*15 If the Count Mode is set to Linear Mode, the position just before an overflow is given. In Rotary Mode, the modulo maximum position is given.
*16 If the Count Mode is set to Linear Mode, the position just before an underflow is given. In Rotary Mode, the modulo minimum position is given.
2-8
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Axes Group Variables
The variable names of the system-defined Axes Group Variables are _MC_GRP[0..31]. The data type
is _sGROUP_REF, which is a structure.
In the descriptions of functions, _MC_AX[*] is used as an example.
_MC_GRP[0..31]
Status
Ready
Data type
Meaning
_sGROUP_REF
Axes Group Variable
_sGROUP_REF_STA
Axes Group Status
BOOL
Ready-to-execute
2-1 Variables
Name
Function
TRUE when the axes group is stopped and is
ready to execute. The condition for being ready
to execute is an AND of the following conditions.
2
• Execution of the MC_Stop instruction is not
in progress for a composition axis.
• The Servo is ON for the composition axes.
• _MC_AX[*].Details.Homed is TRUE (home
defined) for the composition axes.
Disabled
BOOL
Axes Group Disabled
TRUE when the axes group is disabled and
stopped. The following axes group status are
mutually exclusive. Only one of them can be
TRUE at a time.
Disabled, Standby, Moving, Stopping, or ErrorStop
Standby
BOOL
Standby
TRUE when the axes group motion instruction
is stopped.
This is not related to the Servo ON/OFF status
of the composition axes in the axes group.
Moving
BOOL
Moving
TRUE while an axes group motion instruction
is executed toward the target position.
This includes in-position waiting status and
when the velocity is 0 for an override.
Stopping
BOOL
Deceleration Stopping
TRUE until the axes group stops for an
MC_GroupStop instruction. This includes
when Execute is TRUE after the axis stops for
an MC_GroupStop instruction. Axes group
motion instructions are not executed while
decelerating to a stop. (CommandAborted is
TRUE.)
ErrorStop
BOOL
Error Deceleration Stopping
TRUE while the axes group is stopping or
stopped for the MC_GroupImmediateStop
instruction or during an axes group minor fault
(when _MC_GRP[*].MFaultLvl.Active is
TRUE). Axes group motion instructions are not
executed in this state (CommandAborted is
TRUE).
_sGROUP_REF_DET
Axes Group Control Status*1
Idle
BOOL
Idle
TRUE when processing is not currently performed for the command value, except when
waiting for in-position state.*2
Idle and InPosWaiting are mutually exclusive.
They cannot both be TRUE at the same time.
InPosWaiting
BOOL
In-position Waiting
TRUE when any of the composition axes are
waiting for in-position state. The in-position
check performed when positioning for the inposition check.
Details
NY-series Motion Control Instructions Reference Manual (W561)
2-9
Axes Group Variables
• _MC_GRP[*].Status.Standby (standby) is
TRUE.
2 Variables and Instructions
Name
Data type
Meaning
Function
_sGROUP_REF_CMD_DATA
Axes Group Command Values
Vel
LREAL
Command Interpolation
Velocity
Contains the current value of the command
interpolation velocity. The interpolation velocity
is calculated from the difference with the interpolation command current position. A plus sign
is added when traveling in the positive direction, and a minus sign is added when traveling
in the negative direction. The value is 0 when
the axes group is disabled.
AccDec
LREAL
Command Interpolation
Acceleration/Deceleration
Contains the current value of the command
interpolation acceleration/deceleration. The
interpolation acceleration/deceleration rate is
calculated from the difference with the command interpolation velocity. A plus sign is
added for acceleration, and a minus sign is
added for deceleration. The value is 0 when
the axes group is disabled, or when the command acceleration/deceleration rate of the current axes group motion instruction is 0.
_sMC_REF_EVENT
Axes Group Minor Fault
Active
BOOL
Axes Group Minor Fault
Occurrence
TRUE while there is an axes group minor fault.
Code
UINT
Axes Group Minor Fault
Code
Contains the code for an axes group minor
fault. The upper four digits of the event code
have the same value.
_sMC_REF_EVENT
Axes Group Observation
Active
BOOL
Axes Group Observation
Occurrence
TRUE while there is an axes group observation.
Code
WORD
Axes Group Observation
Code
Contains the code for an axes group observation. The upper four digits of the event code
have the same value.
_sGROUP_REF_CFG
Axes Group Basic Settings
GrpNo
UINT
Axes Group Number
Contains the logical number of the axes group.
This number is accessed to recognize the axes
group number when accessing
_sGROUP_REF.
GrpEnable
_eMC_GROUP_USE
Axes Group Use
Shows if the axes group is enabled or disabled.
Cmd
MFaultLvl
Obsr
Cfg
0: _mcNoneGroup (Undefined Axes Group)
1: _mcUnusedGroup (Unused Axes Group)
2: _mcUsedGroup (Used Axes Group)
ExecID
UNIT
Execution ID
Contains the assigned task execution ID.
0: Not assigned to task (undefined axes
group).
1: Assigned to primary periodic task
2-10
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Kinematics
GrpType
Data type
Meaning
Function
_sGROUP_REF_KIM
Kinematics Transformation Settings*3
_eMC_GROUP_TYPE
Composition
Gives the axis composition for multi-axes coordinated control.
0: _mcXY (two axes)
2: _mcXYZU (four axes)
Axis[0]
UINT
Composition Axis for Axis
A0
Gives the axis number that is assigned to axis
A0.
Axis[1]
UINT
Composition Axis for Axis
A1
Gives the axis number that is assigned to axis
A1.
Axis[2]
UINT
Composition Axis for Axis
A2
Gives the axis number that is assigned to axis
A2.
Axis[3]
UINT
Composition Axis for Axis
A3
Gives the axis number that is assigned to axis
A3.
2
Axes Group Variables
*1 Gives the control status of the command.
*2 This also includes states where processing is performed while in motion at a velocity of 0.
*3 Gives the definition of the kinematic conversions for the axes group.
NY-series Motion Control Instructions Reference Manual (W561)
2-1 Variables
1: _mcXYZ (three axes)
2-11
2 Variables and Instructions
Input Variables for Motion Control Instructions
The following tables list the input variables and the valid ranges for motion control instructions, and the
valid ranges of enumerations.
Input Variables
Default
Description
Execute
Name
Execute
Meaning
BOOL
Data type
TRUE or FALSE
Valid range
FALSE
The instruction is executed
when Execute changes to
TRUE. Other input variables
are also input when Execute changes to TRUE. If
input values are changed,
they will be updated when
Execute changes to TRUE
again. The output variables
are valid as long as Execute
remains TRUE even after
the instruction is completed.
Then, all output variables
except for Error and ErrorID
are disabled when Execute
changes to FALSE. If Execute changes to FALSE
before the instruction is
completed, output variables are valid for at least
one period.
Enable
Enable
BOOL
TRUE or FALSE
FALSE
The instruction function is
enabled when Enable
changes to TRUE and disabled when it changes to
FALSE. While Enable is
TRUE, the other input variables are input every
period. If Enable changes to
FALSE, all output variables
except for Error and ErrorID
are disabled.
PositiveEnable
Positive
Direction
Enable
BOOL
TRUE or FALSE
FALSE
• MC_MoveJog Instruction
When this variable
changes to TRUE, the
axis starts moving in the
positive direction. When it
changes to FALSE, the
axis stops moving. The
Velocity, Acceleration,
and Deceleration input
variables to the
MC_MoveJog instruction
are read when PositiveEnable changes to
TRUE.
• MC_SetTorqueLimit
Instruction
When this variable
changes to TRUE, the
positive torque limit is
enabled. When it changes
to FALSE, the positive
torque limit is disabled.
2-12
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
NegativeEnable
Meaning
Negative
Direction
Enable
Data type
BOOL
Valid range
TRUE or FALSE
Description
• MC_MoveJog Instruction
When this variable
changes to TRUE, the
axis starts moving in the
negative direction. When
it changes to FALSE, the
axis stops moving. The
Velocity, Acceleration,
and Deceleration input
variables to the
MC_MoveJog instruction
are read when NegativeEnable changes to
TRUE.
BufferMode
Buffer Mode
Selection
_eMC_BUFFER_MODE
0: _mcAborting
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
4: _mcBlendingNext
5: _mcBlendingHigh
0*1
Specifies the operation
when executing more than
one motion instruction.
0:
1:
2:
3:
4:
5:
Aborting
Buffered
Blending low
Blending previous
Blending next
Blending high
Velocity
Target
Velocity
LREAL
Positive number*2
0
Specifies the target velocity.*3
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specifies the acceleration
rate.*4
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specifies the deceleration
rate.*4
Jerk
Jerk
LREAL
Non-negative number
0
Specifies the jerk.*5
Distance
Travel
Distance
LREAL
Negative number, positive number,
or 0
0
Specifies the travel distance
from the command current
position.
ARRAY [0..3] OF LREAL
Negative number, positive number,
or 0
0
Specifies the target position for linear interpolation.*6
LREAL
Negative number, positive number,
or 0
0
Specifies the absolute target position.*6
ARRAY [0..3] OF LREAL
Negative number, positive number,
or 0
0
Specifies the target position for linear interpolation.*6
LREAL
0 to 500
100
Specifies the velocity override factor.
The valid range of the override factors is between
0.01and 500.00.
Values above 500.00 are
treated as 500 and values
less then 0.01 (including
negative values) are treated
as 0.01.
The override factor will be 0
only when 0 is specified.
The unit is %.
Position
VelFactor
Target
Position
Velocity
Override
Factor
NY-series Motion Control Instructions Reference Manual (W561)
2-13
2
Input Variables for Motion Control Instructions
• MC_SetTorqueLimit
Instruction
When this variable
changes to TRUE, the
negative torque limit is
enabled. When it changes
to FALSE, the negative
torque limit is disabled.
2-1 Variables
Default
FALSE
2 Variables and Instructions
Name
Meaning
Data type
Valid range
Default
Description
AccFactor
(Reserved)
Acceleration/
Deceleration
Override
Factor
LREAL
0 to 500
100
(Reserved)
JerkFactor
(Reserved)
Jerk
Override
Factor
LREAL
0 to 500
100
(Reserved)
ReferenceType*7
Position Type
Selection
_eMC_REFERENCE_TYPE
0: _mcCommand
1: _mcFeedback
2: _mcLatestCommand
0*1
Specifies the master axis
input information.
Negative number, positive number,
or 0
0
Specifies the travel distance
after the interrupt feed
input.
LREAL
0: Command position
(value calculated in the
previous primary period)
1: Actual position (value
obtained in the same primary period)
2: Command position
(value calculated in the
same primary period)
FeedDistance
Feed Distance
FeedVelocity
Feed Velocity LREAL
Positive number
0
Specifies the travel target
velocity after the interrupt
feed input.
ErrorDetect
Error Detection Selection
TRUE or FALSE
FALSE
Specifies whether to detect
an error when there is no
interrupt feed input.
BOOL
TRUE: Detect errors.
FALSE: Do not detect
errors.
Periodic
Periodic
Mode
BOOL
TRUE or FALSE
FALSE
Specifies whether to execute the specified cam table
periodically or only once.
TRUE: Periodic
FALSE: Non-periodic
StartMode
Start Mode
_eMC_STARTMODE
0: _mcAbsolutePosition
1: _mcRelativePosition
0*1
Specifies the coordinates
used by MasterStartDistance (master following distance).
0: Absolute position
1: Relative position
StartPosition
Cam Table
Start Position
LREAL
Negative number, positive number,
or 0
0
Specifies the starting point
of the cam table (0 phase)
as an absolute position of
the master axis.
MasterStartDistance
Master
Following
Distance
LREAL
Negative number, positive number,
or 0
0
Specifies the position of the
master axis when the following axis starts the cam
motion. If you specify absolute positioning for StartMode, specify the absolute
position of the master axis.
If you specify relative positioning for StartMode, specify the relative position of
the master axis from StartPosition (Cam Table Start
Position).
MasterScaling
Master
Coefficient
LREAL
Positive value (>0.0)
1.0
The master axis phase is
extended or contracted
using the specified scale.
2-14
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Meaning
Data type
Valid range
Default
Description
Slave Axis
Coefficient
LREAL
Positive value (>0.0)
1.0
The slave axis displacement is extended or contracted using the specified
scale.
MasterOffset
Master
Offset
LREAL
Negative number, positive number,
or 0
0
The phase of the master
axis is shifted using the
specified offset value.
SlaveOffset
Slave Offset
LREAL
Negative number, positive number,
or 0
0
The displacement of the
slave axis is shifted using
the specified offset value.
CamTransition
(Reserved)
Cam Transition Selection
_eMC_CAM_
0: _mcCTNone
0*1
(Reserved)
OutMode
(Reserved)
Sync End
Mode Selection
_eMC_OUT_MODE
0: _mcStop
0*1
(Reserved)
Direction
Direction
_eMC_DIRECTION
0: _mcPositiveDirection
1: _mcShortestWay
2: _mcNegativeDirection
3: _mcCurrentDirection
4: _mcNoDirection
4/0*1
Specifies the travel direction.
TRANSITION
2-1 Variables
SlaveScaling
2
Positive direction
Shortest way
Negative direction
Current direction
No direction specified
Continuous(Res
erved)
Continuation
Mode Selection
BOOL
TRUE or FALSE
FALSE
(Reserved)
RatioNumerator
Gear Ratio
Numerator
DINT
Positive or negative number
10,000
Specifies the electronic
gear ratio numerator
between the master and
slave axes.
Ratio
Denominator
Gear Ratio
Denominator
UDINT
Positive number
10,000
Specifies the electronic
gear ratio denominator
between the master and
slave axes.
MasterSync
Position
Master Sync
Position
LREAL
Negative number, positive number,
or 0
0
Specifies the absolute master sync position.
SlaveSyncPosition
Slave Sync
Position
LREAL
Negative number, positive number,
or 0
0
Specifies the absolute slave
sync position.
SlaveDistance
Slave Axis
Travel
Distance
LREAL
Negative number, positive number,
or 0
0
Specifies the travel distance
for the slave axis.
MasterDistance
Master Axis
Travel
Distance
LREAL
Non-negative number
0
Specifies the travel distance
of the master axis.
MasterDistanceInACC
Master
Distance in
Acceleration
LREAL
Non-negative number
0
Specifies the travel distance
of the master axis while the
slave axis is accelerating.
MasterDistanceInDEC
Master
Distance in
Deceleration
LREAL
Non-negative number
0
Specifies the travel distance
of the master axis while the
slave axis is decelerating.
LinkOption
Synchronization Start
Condition
_eMC_LINKOPTION
0: _mcCommandExecution
1: _mcTriggerDetection
2: _mcMasterReach
0*1
Specifies the condition for
the slave axis to synchronize with the master axis.
0: When instruction execution starts
1: When trigger is detected
2: When the master axis
reaches the master following distance.
NY-series Motion Control Instructions Reference Manual (W561)
2-15
Input Variables for Motion Control Instructions
0:
1:
2:
3:
4:
2 Variables and Instructions
Name
CombineMode
Meaning
Combine
Mode
Data type
_eMC_COMBINE_MODE
Valid range
0: _mcAddAxes
1: _mcSubAxes
Default
0*1
Description
Specifies the combining
method.
0: Addition
1: Subtraction
Ratio
Numerator
Master
(Reserved)
Master Axis
Gear Ratio
Numerator
DINT
Positive or negative number
10000
Specifies the electronic
gear ratio numerator
between the master and
slave axes.
Ratio
Denominator
Master
(Reserved)
Master Axis
Gear Ratio
Denominator
UDINT
Positive number
10000
Specifies the denominator
of the electronic gear ratio
between the master and
slave axes.
Ratio
Numerator
Auxiliary
(Reserved)
Auxiliary Axis
Gear Ratio
Numerator
DINT
Positive or negative number
10000
Specifies the numerator of
the electronic gear ratio
between the auxiliary and
slave axes.
Ratio
Denominator
Auxiliary
(Reserved)
Auxiliary Axis
Gear Ratio
Denominator
UDINT
Positive number
10000
Specifies the denominator
of the electronic gear ratio
between the auxiliary and
slave axes.
ReferenceType
Master
Master Axis
_eMC_
Position Type REFERENCE_TYPE
1: _mcFeedback
2*1
Specifies the position type
of the master axis.
2: _mcLatestCommand
1: Actual position (value
obtained in the same primary period)
2: Command position
(value calculated in the
same primary period)
ReferenceType
Auxiliary
Auxiliary Axis _eMC_
Position Type REFERENCE_TYPE
1: _mcFeedback
2*1
2: _mcLatestCommand
Specifies the position type
of the auxiliary axis.
1: Actual position (value
obtained in the same primary period)
2: Command position
(value calculated in the
same primary period)
PhaseShift
Phase Shift
Amount
LREAL
Negative number, positive number,
or 0
0
Specifies the master phase
shift amount.*6
Torque
Target
Torque
LREAL
0 to 1000.0
300.0
Specify the target torque to
output to the Servo Drive in
increments of 0.1%. The
target torque is specified as
a percentage of the rated
torque. The unit is %.
TorqueRamp
Torque
Ramp
LREAL
Non-negative number
0
Specifies the rate of change
in the torque from the current value to the target
torque. The unit is %/s.
PositiveValue
Positive
Torque Limit
LREAL
0.1 to 1000.0 or 0.0
300.0
Specifies the torque limit in
the positive direction in
increments of 0.1%.
If a value that exceeds the
Maximum Positive Torque
Limit axis parameter, the
positive torque will be the
Maximum Positive Torque
Limit.
The value will be 0 if 0 or a
negative value is specified.
2-16
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Meaning
Data type
Valid range
Default
Description
Negative
Torque Limit
LREAL
0.1 to 1000.0 or 0.0
300.0
Specifies the torque limit in
the negative direction in
increments of 0.1%.
If a value that exceeds the
Maximum Negative Torque
Limit axis parameter, the
negative torque will be the
Maximum Negative Torque
Limit.
The value will be 0 if 0 or a
negative value is specified.
2-1 Variables
WindowOnly
Window Only
BOOL
TRUE or FALSE
FALSE
Specify whether to enable
or disable the window
mask.
2
FirstPosition
First Position
LREAL
Negative number, positive number,
or 0
0
Specify the first position.
LastPosition
Last Position
LREAL
Negative number, positive number,
or 0
0
Specify the last position.
StopMode
Stopping
Mode
Selection
_eMC_STOP_MODE
1: _mcImmediateStop
2: _mcImmediateStopFEReset
3: _mcFreeRunStop
4: _mcNonStop
4*1
Specifies the stopping
method.
Relative
(Reserved)
Relative
Position
Selection
BOOL
TRUE or FALSE
FALSE
(Reserved)
Execution
Mode (Reserved)
Execution
Mode
_eMC_EXECUTION_MODE
0: _mcImmediately
0*1
(Reserved)
Permitted
Deviation
Permitted
Following
Error
LREAL
Non-negative number
0
Specifies the permitted
maximum value for the following error between the
master and slave axes.
CmdPos
Mode
Command
Current
Position
Count
Selection
_eMC_CMDPOS_
MODE
0: _mcCount
0*1
0: Use the actual current
position and update the
command current position.
Home remains defined.
CoordSystem
Coordinate
System
_eMC_COORD_SYSTEM
0: _mcACS
0*1
Specifies the coordinate
system.
1: Perform an immediate
stop.
2: Perform an immediate
stop and reset the following error counter
3: Perform an immediate
stop and turn OFF the
Servo
4: Do not stop.
0: Axis coordinate system
(ACS)
TransitionMode
Transition
Mode
_eMC_TRANSITION_MODE
0: _mcTMNone
10: _mcTMCornerSuperimposed
0*1
Specifies the path of
motion.
0: Transition disabled
10:Superimpose corners
MoveMode
Travel Mode
_eMC_MOVE_MODE
0: _mcAbsolute
1: _mcRelative
0*1
Selects the travel method.
0: Absolute positioning
1: Relative positioning
CircAxes
Circular Axes
ARRAY [0,1] OF UINT
0 to 3
0
Specifies the axes for circular interpolation.
0: Axis A0
1: Axis A1
2: Axis A2
3: Axis A3
NY-series Motion Control Instructions Reference Manual (W561)
2-17
Input Variables for Motion Control Instructions
NegativeValue
2 Variables and Instructions
Name
CircMode
Meaning
Data type
Circular
Interpolation
Mode
_eMC_CIRC_MODE
AuxPoint
Auxiliary
Point
EndPoint
PathChoice
ParameterNumber
HomingMode
Valid range
Default
Description
Specifies the method for circular interpolation.
0: _mcBorder
1: _mcCenter
2: _mcRadius
0*1
ARRAY [0,1] OF LREAL
Negative number, positive number,
or 0
0
Specifies the border point,
center, or radius.
End Point
ARRAY [0,1] OF LREAL
Negative number, positive number,
or 0
0
Specifies the target position.
Path Choice
_eMC_CIRC_PATHCHOICE
0: _mcCW
1: _mcCCW
0*1
Specifies the path direction.
_eMC_PARAMETER_NUMBER
0: _mcChkVel
1: _mcChkAcc
2: _mcChkDec
3: _mcPosiChkTrq
4: _mcNegaChkTrq
5: _mcFELmt
6: _mcChkFELmt
7: _mcSwLmtMode
8: _mcPosiSwLmt
9: _mcNegaSwLmt
10: _mcInPosTime
11: _mcInPosRange
12: _mcStartVel
0*1
0: _mcHomeSwTurnHomeSwOff
0 *1
Parameter
Number
Homing
Method
_eMC_HOMING_MODE
1: _mcHomeSwTurnHomeSwOn
4: _mcHomeSwOff
5: _mcHomeSwOn
8: _mcLimitInputOff
9: _mcHomeSwTurnHomeMask
11: _mcLimitInputOnly
12: _mcHomeSwTurnHoldingTime
13: _mcNoHomeSwHolding
HomeInput
14: _mcHomePreset
0: Border point
1: Center
2: Radius
0: CW
1: CCW
Specifies the parameter to
write.
0: Velocity Warning
Value/Interpolation
Velocity Warning Value
1: Acceleration Warning
Value/Interpolation
Acceleration Warning
Value
2: Deceleration Warning
Value/Interpolation
Deceleration Warning
Value
3: Positive Torque Warning
Value
4: Negative Torque Warning Value
5: Following Error Over
Value
6: Following Error Warning
Value
7: Software Limits
8: Positive Software Limit
9: Negative Software Limit
10:In-position Check Time
11:In-position Range
12:Start Velocity
Specify the new setting of
the Homing Method.
0: Proximity reverse
turn/home proximity
input OFF
1: Proximity reverse
turn/home proximity
input ON
4: Home proximity input
OFF
5: Home proximity input
ON
8: Limit input OFF
9: Proximity reverse
turn/home input mask
distance
11:Limit inputs only
12:Proximity reverse
turn/holding time
13:No home proximity
input/holding home input
14:Zero position preset
2-18
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
AxisUse
Meaning
Axis Use
Data type
_eMC_AXIS_USE
Valid range
1: _mcUnusedAxis
Default
1*1
2: _mcUsedAxis
Description
Specifies a used axis or an
unused axis.
1: Unused axis
2: Used axis
Enable
Tracks
WORD
16#0000 to FFFF
0
Specifies whether to enable
or disable each track. There
are a maximum of 16
tracks. Specify enable or
disable for track 0 with bit
00 and track 15 with bit 15.
2-1 Variables
EnableMask
0: Disable
1: Enable
2
---
---
(Reserved)
TimeStamp
Time Stamp
ULINT
Non-negative number
0
Specifies the time stamp for
which to calculate the position. A time stamp that is
based on the time in a Digital Input Unit, Encoder Input
Unit, or other Unit that supports time stamp refreshing
is specified. The unit is
nanoseconds.
OffsetPosition
Position Offset
LREAL
Negative number, positive number,
or 0
0
Specifies the position offset
to add to the command current position.*6
ValueSource
*1 The default value for an enumeration variable is actually not the number, but the enumerator.
*2 You can use instructions, such as the MC_MoveJog or MC_MoveVelocity instruction, to set the velocity to 0.
*3 The command unit is millimeters, micrometers, nanometers, degrees, inches, or pulses.
*4 The unit is command units/s2.
*5 The unit is command units/s3.
*6 This unit is command units.
*7 To use _mcLatestCommand, the following condition must be met for the master and slave axes.
The axis number set for the master axis in the system-defined variable for motion control must be lower than the axis
number set for the slave axis in the system-defined variable for motion control.
NY-series Motion Control Instructions Reference Manual (W561)
2-19
Input Variables for Motion Control Instructions
_sMC_SOURCE
(Reserved)
Input Information
2 Variables and Instructions
Valid Range of Input Variables
This section gives the valid ranges of input variables to motion control instructions. Refer to individual
instruction descriptions for the valid ranges for each instruction.
z BOOL Input Variables
Any value other than FALSE is treated as TRUE. For this reason, out-of-range errors do not occur.
z Enumerated (ENUM) Input Variables
Values that are outside of the valid range will result in an error.
z Input Variables Given as Full Range, Positive Number, or Negative Number
Operation when an input variable is set inside or outside the valid range is described in the following
table.
Outside the maximum
value range
−
Name
Outside the minimum
value range (excluding 0)
Outside the maximum
value range
+
0
Meaning
Valid range
Outside the maximum
value range
Outside the minimum
value range (excluding 0)
Velocity
Velocity
0, (−1 ≤ and ≤ −Maximum
velocity), or (1 ≤ and ≤ Maximum velocity)*1
Set to the maximum
velocity for a positive number, and to the −maximum velocity for a
negative number.*2
Set to 1 pulse/s when positive number, and −1
pulse/s when negative
number.*2
Acceleration
Acceleration Rate
0 or (0.004 ≤ and ≤ Maximum
acceleration)*3
Set to the maximum
acceleration.
Set to 0.004 pulses/s2
when positive number. If
the acceleration time*4 is
greater than 250 s, it will
always be 250 s.
If the acceleration time*4
is less than 125 μs, it will
always be 125 μs.
Error when negative number.
Deceleration
Deceleration Rate
0 or (0.004 ≤ and ≤ Maximum
deceleration)*5
Set to the maximum
deceleration.
If the deceleration time*4
is less than 125 μs, it will
always be 125 μs.
Set to 0.004 pulses/s2
when positive number. If
the deceleration time*4 is
greater than 250 s, it will
always be 250 s.
Error when negative number.
Jerk
Jerk
0 or (0.000016 ≤ and
25,600,000,000,000,000
pulses/s3)
Set to
25,600,000,000,000,000
pulses/s3. If the acceleration jerk application time*6
or the deceleration jerk
application time*6 is less
than 125 μs, it will always
be 125 μs.
Set to 0.000016 pulses/s3.
If the acceleration jerk
application time*6 or the
deceleration jerk application time*6 is greater than
250 s, it will always be
250 s.
Error when negative number.
Distance
Travel Distance
(0xFFFFFF0000000001) ≤
and ≤
(0x000000FFFFFFFFFF)
Error
Values outside of the minimum value range do not
occur.
Position
Command Position
(0xFFFFFF8000000000) ≤
and <
(0x0000007FFFFFFFFF+ 1)*7
Error
Values outside of the minimum value range do not
occur.
VelFactor
Velocity Override Factor
0 or 0.01 ≤ and ≤ 500.00*8
Set to 500.00% if higher
than 500.00%.
Set to 0.01% if less than
0.01%.
2-20
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Meaning
Valid range
Outside the maximum
value range
Outside the minimum
value range (excluding 0)
Interpolation Velocity
0.000 000 000 000 01 ≤ and ≤
Maximum interpolation velocity*9
Set to the maximum interpolation velocity.
Set to 0.000 000 000 1
pulses/s.
Acceleration
Interpolation Acceleration
0 or (0.000 000 000 000 4 ≤
and ≤ Maximum interpolation
acceleration)*10
Set to the maximum interpolation acceleration. If
the interpolation acceleration time*11 is less than
125 μs, it will always be
125 μs.
Set to 0.000 000 000 000 4
pulses/s2 when positive
number. If the interpolation
acceleration time*11 is
greater than 250 s, it will
always be 250 s.
2-1 Variables
Velocity
Error when negative number.
Deceleration
Interpolation Deceleration
0 or (0.000 000 000 000 000
04 ≤ and ≤ Maximum interpolation deceleration)*12
Set to 0.000 000 000 000 4
pulses/s2 when positive
number. If the interpolation
deceleration time*11 is
greater than 250 s, it will
always be 250 s.
Error when negative number.
Jerk
Interpolation Jerk
0 or (0.000 000 000 000 001 6
≤ and ≤
51,200,000,000,000,000
pulses/s3)
Set to
51,200,000,000,000,000
pulses/s3. If the interpolation acceleration jerk
application time*13 or the
interpolation deceleration
jerk application time*13 is
less than 125 μs, it will
always be 125 μs.
Set to 0.000 000 000 000
001 6 pulses/s3. If the
interpolation acceleration
jerk application time*13 or
the interpolation deceleration jerk application
time*13 is greater than
250 s, it will always be 250
s.
Error when negative number.
*1 The maximum value that you can set is 2,147,483,647 [pulses/s] when the value is converted to pulses.
*2 If a negative number or 0 is specified when negative numbers and 0 are not included in the effective range, an error
occurs.
*3 The upper limit of the Maximum Acceleration in the axis parameters is 3,200,000,000,000 pulses/s2.
*4 Calculated as follows: Acceleration time = Velocity/Acceleration rate, Deceleration time = Velocity/Deceleration rate, and
Acceleration/deceleration time = Acceleration time + Deceleration time.
*5 The upper limit of the Maximum Deceleration in the axis parameters is 3,200,000,000,000 pulses/s2.
*6 The acceleration jerk application time and the deceleration jerk application time are the times that jerk is applied.
Calculated as follows: Acceleration jerk application time = Acceleration rate/Jerk and Deceleration jerk application time =
Deceleration rate/Jerk.
*7 Position must be an absolute value in pulses and must be no more than 40 bits signed.
*8 The unit is %.
*9 The upper limit of the Maximum Interpolation Velocity in the axis parameters is the twice as high as the upper limit of the
Maximum Velocity in the axis parameters.
*10 The upper limit of the Maximum Interpolation Acceleration in the axis parameters is 6,400,000,000,000 pulses/s2.
*11 Calculated as follows: Interpolation acceleration time = Interpolation velocity/Interpolation acceleration rate, Interpolation
deceleration time = Interpolation velocity/Interpolation deceleration rate, and Acceleration/deceleration time = Acceleration time + Deceleration time.
*12 The upper limit of the Maximum Interpolation Deceleration in the axis parameters is 6,400,000,000,000 pulses/s2.
*13 The interpolation acceleration jerk application time and the interpolation deceleration jerk application time are the times
that interpolation jerk is applied.
Calculated as follows: Interpolation acceleration jerk application time = Interpolation acceleration rate/Jerk and Interpolation deceleration jerk application time = Interpolation deceleration rate/Jerk.
NY-series Motion Control Instructions Reference Manual (W561)
2-21
2
Input Variables for Motion Control Instructions
Set to the maximum interpolation deceleration. If
the interpolation deceleration time*11 is less than
125 μs, it will always be
125 μs.
2 Variables and Instructions
Enumerations
This ENUM data is used by input variables to motion control instructions. An enumeration input variable
is not actually set to the number, but to the enumerator.
Data type
_eMC_BUFFER_
MODE
_eMC_CIRC_
MODE
_eMC_CAM_
TRANSITION
Valid range
Description
0: _mcAborting
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
4: _mcBlendingNext
5: _mcBlendingHigh
Specifies the operation for multi-execution
of motion control instructions.
0: _mcBorder
1: _mcCenter
2: _mcRadius
Specifies the method for circular interpolation.
0: _mcCTNone
Specifies the slave axis command value
output method when the cam is restarted.
0:
1:
2:
3:
4:
5:
Corresponding instruction
variable
BufferMode (Buffer Mode
Selection)
Aborting
Buffered
Blending low
Blending previous
Blending next
Blending high
CircMode (Circular Interpolation Mode)
0: Border point
1: Center
2: Radius
CamTransition (Cam Transition
Selection)
0: No limit or correction
_eMC_CIRC_
PATHCHOICE
0: _mcCW
1: _mcCCW
Specifies the path direction.
_eMC_COMBINE_
MODE
0: _mcAddAxes
1: _mcSubAxes
Specifies the combining method.
_eMC_COORD_SYSTEM
0: _mcACS
_eMC_DIRECTION
PathChoice
0: CW
1: CCW
CombineMode
0: Addition
1: Subtraction
0: Axis coordinate system (ACS)
CoordSystem (Coordinate
System)
0: _mcPositiveDirection
1: _mcShortestWay
2: _mcNegativeDirection
3: _mcCurrentDirection
4: _mcNoDirection
Specifies the direction of motion.
Direction (Direction)
_eMC_
EXECUTION_MODE
0: _mcImmediately
(Reserved)
ExecutionMode (Execution
Mode)
_eMC_LINKOPTION
0: _mcCommandExecution
1: _mcTriggerDetection
2: _mcMasterReach
Specifies the condition for the slave axis to
synchronize with the master axis.
LinkOption (Synchronization
Start Condition)
0: _mcAbsolute
1: _mcRelative
2: _mcVelocity
Selects the travel method.
0: _mcStop
Specifies the mode to disable the synchronized control instruction.
OutMode (Sync End Mode
Selection)
0: Deceleration stop
(Reserved)
_eMC_MOVE_MODE
_eMC _OUT_MODE
2-22
Specifies the coordinate system.
0:
1:
2:
3:
4:
Positive direction
Shortest way
Negative direction
Current direction
No direction specified.
0: Start of instruction
1: When trigger is detected
2: When the master axis reaches the
master following distance.
MoveMode (Travel Mode)
0: Absolute positioning
1: Relative positioning
2: Velocity control
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Data type
_eMC_
PARAMETER_
NUMBER
Specifies the parameter to write.
0: _mcNonSwLmt
Enables and disables the software limits
and specifies the Stop Mode.
1: _mcCmdDecelerationStop
3: _mcActDecelerationStop
4: _mcActImmediateStop
_eMC_START_MODE
0: _mcCommand
1: _mcFeedback
2: _mcLatestCommand
0: _mcAbsolutePosition
1: _mcRelativePosition
Corresponding instruction
variable
ParameterNumber
0: Velocity Warning Value/Interpolation
Velocity Warning Value
1: Acceleration Warning Value/Interpolation Acceleration Warning Value
2: Deceleration Warning Value/Interpolation Deceleration Warning Value
3: Positive Torque Warning Value
4: Negative Torque Warning Value
5: Following Error Over Value
6: Following Error Warning Value
7: Software Limits
8: Positive Software Limit
9: Negative Software Limit
10: In-position Check Time
11: In-position Range
12: Start Velocity
2
SettingValue (Setting Value)
0: Disable software limits.
1: Deceleration stopping enabled for command position.
2: Enable software limits and perform
immediate stop for command position.
3: Enable software limits and decelerate
to stop for actual position.
4: Enable software limits and perform
immediate stop for actual position.
Specifies the position type.
0: Command position (value calculated in
the previous primary period)
1: Actual position (value obtained in the
same primary period)
2: Command position (value calculated in
the same primary period)
Specifies the coordinate system used by
MasterStartDistance (master following distance).
ReferenceType (Position Type
Selection)
ReferenceTypeMaster (Master
Axis Position Type Selection)
ReferenceTypeAuxiliary (Auxiliary Axis Position Type Selection)
StartMode
0: Absolute position
1: Relative position
_eMC_STOP_
MODE
0: _mcDeccelerationStop
Specifies the stopping method.
1: _mcImmediateStop
0: Deceleration stop
1: Perform an immediate stop.
2: Perform an immediate stop and reset
the following error counter
3: Turn OFF the Servo.
4: Do not stop.
2: _mcImmediateStopFEReset
3: _mcFreeRunStop
4: _mcNonStop
_eMC_TRIGGER_
LATCH_ID
0: _mcLatch1
1: _mcLatch2
Specifies which of the two latch functions
to use.
StopMode
LatchID
0: Latch 1
1: Latch 2
_eMC_
CMDPOS_MODE
0: _mcCount
0: Use the actual current position and
update the command current position.
Home remains defined.
CmdPosMode (Command
Current Position Count Selection)
_eMC_
TRANSITION_
MODE
0: _mcTMNone
Specifies the path of motion.
TransitionMode
10: _mcTMCornerSuperimposed
0: Transition disabled
10:Superimpose corners
_eMC_TRIGGER_
MODE
0: _mcDrive
Specifies the trigger mode.
1: _mcController
0: Drive Mode
1: Controller Mode
NY-series Motion Control Instructions Reference Manual (W561)
Mode
2-23
Input Variables for Motion Control Instructions
0: _mcChkVel
1: _mcChkAcc
2: _mcChkDec
3: _mcPosiChkTrq
4: _mcNegaChkTrq
5: _mcFELmt
6: _mcChkFELmt
7: _mcSwLmtMode
8: _mcPosiSwLmt
9: _mcNegaSwLmt
10: _mcInPosTime
11: _mcInPosRange
12: _mcStartVel
2: _mcCmdImmediateStop
_eMC_
REFERENCE_
TYPE *1
Description
2-1 Variables
_eMC_
SWLMT_MODE
Valid range
2 Variables and Instructions
Data type
Valid range
Description
_eMC_TRIGGER_
INPUT_DRIVE
0: _mcEncoderMark
Specifies the trigger signal in Drive Mode.
1: _mcEXT
0: Z-phase signal
1: External input
_eMC_HOMING_MODE
0: _mcHomeSwTurnHomeSw
Off
Specify the new setting of the Homing
Method.
1: _mcHomeSwTurnHomeSwOn
0: Proximity reverse turn/home proximity
input OFF
4: _mcHomeSwOff
5: _mcHomeSwOn
8: _mcLimitInputOff
9: _mcHomeSwTurnHomeMask
11: _mcLimitInputOnly
12: _mcHomeSwTurnHolding
Time
13: _mcNoHomeSwHolding
HomeInput
14: _mcHomePreset
Corresponding instruction
variable
InputDrive (Trigger Input Signal)
---
1: Proximity reverse turn/home proximity
input ON
4: Home proximity input OFF
5: Home proximity input ON
8: Limit input OFF
9: Proximity reverse turn/home input
mask distance
11:Limit inputs only
12:Proximity reverse turn/holding time
13:No home proximity input/holding home
input
14:Zero position preset
_eMC_HOME_
INPUT
0: _mcZPhase
1: _mcExternalSignal
Select the input to use for the home input
signal.
---
0: Use the Z-phase input as home.
1: Use external home input.
_eMC_LIMIT_
REVERSE_MODE
0: _mcErrorStop
1: _mcRevImmediateStop
2: _mcRevDecelerationStop
Sets the stopping method when the limit
input turns ON during homing.
---
0: No reverse turn/minor fault stop (Stop
according to Limit Input Stop Method
parameter.)
1: Reverse turn/immediate stop
2: Reverse turn/deceleration stop
_eMC_CAM_CURVE
0: _mcConstantLine
1: _mcStraightLine
Specifies the shape of the cam curve to
the node point.
2: _mcParabolic
0: Constant
3: _mcModifiedConstantVel
1: Straight line
4: _mcModifiedTrapezoid
2: Parabolic
5: _mcModifiedSine
3: Modified constant velocity
6: _mcCycloidal
4: Modified trapezoid
7: _mcTrapecloid
5: Modified sine
8: _mcReverseTrapecloid
6: Cycloidal
9: _mcSimpleHarmonic
7: Trapecloid
10: _mcDoubleHarmonic
8: Reverse trapecloid
11: _mcReverseDouble
Harmonic
9: Simple harmonic
12: _mcNC2Curve
11: Reverse double harmonic
13: _mcPolynomic3
12: NC2 curve
14: _mcPolynomic5
13: Polynomic 3
Curve (Curve Shape)
10: Double harmonic
14: Polynomic 5
2-24
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Data type
_eMC_
ACCDECOVER
Valid range
Corresponding instruction
variable
Description
0: _mcAccDecOverBuffer
2: _mcAccDecOverError
Stop
---
2-1 Variables
Sets the operation for when the maximum
acceleration/deceleration rate would be
exceeded after excessive acceleration/deceleration during acceleration/deceleration control of the axis
because stopping at the target position is
given priority.
1: _mcAccDecOverRapid
0: Use rapid acceleration/deceleration.
(Blending is changed to Buffered.)*2
1: Use rapid acceleration/deceleration.
2: Minor fault stop*3
_eMC_
REVERSE_MODE
0: _mcReverseMode
DecelerationStop
Specifies the operation for reversing rotation for multi-execution of instructions, reexecution of instructions, and interrupt
feeding.
Output Variables for Motion Control Instructions
1: _mcReverseMode
ImmediateStop
2
---
0: Deceleration stop
1: Immediate stop
_eMC_
COUNT_MODE
0: _mcCountModeLinear
Sets the count mode for the position.
1: _mcCountModeRotary
0: Linear Mode (finite length)
_eMC_UNITS
0: _mcPls
Sets the unit for command positions.
1: _mcMm
0: pulse
2: _mcUm
1: mm
3: _mcNm
2: μm
4: _mcDeg
3: nm
5: _mcInch
4: degree
---
1: Rotary Mode (infinite length)
---
5: inch
*1 To use _mcLatestCommand, the following condition must be met for the master and slave axes.
When you use mcLatestCommand, the axis number set for the master axis in the system-defined variable for motion control must be lower than the axis number set for the slave axis in the system-defined variable for motion control.
*2 Blending is not changed to Buffered. For details, refer to the NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
*3 The axis does not stop with an error and operation continues if blending operation is used. For details, refer to the NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Output Variables for Motion Control Instructions
The following table lists the output variables for motion control instructions.
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
At this time, output variables Active,
Error, and CommandAborted are FALSE.
Done will be TRUE for at least one period
if the input variable Execute is FALSE
when the instruction is completed. If Execute is TRUE, Done remains TRUE until
Execute changes to FALSE.
Busy
Executing
BOOL
TRUE or FALSE
Changes to TRUE when an instruction is
acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
Changes to TRUE when the instruction is
executed. Active (Controlling) is TRUE
while the instruction is actually controlling
an axis or axes group. At this time, output
variables Done, Error, and CommandAborted are FALSE.
Enabled
Enabled
BOOL
TRUE or FALSE
Changes to TRUE when busy.
NY-series Motion Control Instructions Reference Manual (W561)
2-25
2 Variables and Instructions
Name
CommandAborted
Meaning
Instruction Aborted
Data type
BOOL
Valid range
TRUE or FALSE
Description
TRUE when an instruction could not be
executed or when it was aborted during
execution. The instruction is not executed
if there is an error with the target axis or
axes group, or while the axis or axes
group is decelerating to a stop. The
instruction is aborted when another
instruction is executed, or if an error other
than for this instruction occurs. At this
time, output variables Done, Active, and
Error change to FALSE. If the instruction
is aborted while the input variable Execute is FALSE, CommandAborted will be
TRUE for at least one period. If Execute
or Enable is TRUE, CommandAborted
remains TRUE until Execute or Enable
changes to FLASE.
If Execute or Enable is TRUE, CommandAborted remains TRUE until Execute or Enable changes to FALSE.
Error
Error
BOOL
TRUE or FALSE
TRUE when there is an error caused by a
mistake in an input variable or instruction
processing.*1
ErrorID
Error Code
WORD
*2
Contains the error code when an error
occurs. 16#0000 indicates normal operation.
Failure
Failure End
BOOL
TRUE or FALSE
TRUE when the instruction was not executed correctly.
Status
Servo ON
BOOL
TRUE or FALSE
TRUE when the device is ready for operation.
EndOfProfile
End of Cam Cycle
BOOL
TRUE or FALSE
Changes to TRUE when the cam table
end point is executed.
Index
Index
UINT
Non-negative number
Contains the cam data index number.
StartSync
Following
BOOL
TRUE or FALSE
TRUE when acceleration/deceleration is
started for synchronization and the
device is ready for operation.
RecordedPosition
Latched Position
LREAL
Negative number,
positive number, or
0
Contains the latched position. *3
Invalid
Excessive Following
Error between Axes
BOOL
TRUE or FALSE
TRUE when the permitted following error
between axes is exceeded.
DeviatedValue
Following Error between
Axes
LREAL
Negative number,
positive number, or
0
Contains the difference between the
specified master and slave axes.*3
EndPointIndex
End Point Index
UINT
Non-negative number
Contains the cam table end point index.
MaxDataNumber
Maximum Number of
Cam Data
UINT
Positive
number
Contains the maximum cam data number.
InVelocity
Target Velocity Reached
BOOL
TRUE or FALSE
TRUE when the target velocity is
reached.
InSync
In Sync
BOOL
TRUE or FALSE
TRUE when slave axis is synchronized to
the master axis, or when the slave axis
reaches the slave sync position.
InGear
Gear Ratio Achieved
BOOL
TRUE or FALSE
TRUE when the slave axis reaches the
target velocity.
InCombination
Axes Combined
BOOL
TRUE or FALSE
TRUE when axes are combined.
InCam
Cam Motion
BOOL
TRUE or FALSE
TRUE when the cam table start point is
executed.
InTorque
Target Torque Reached
BOOL
TRUE or FALSE
TRUE when the target torque is reached.
2-26
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
Meaning
Data type
Valid range
Description
BOOL
TRUE or FALSE
TRUE while feeding after receiving a
latch input.
InZone
In Zone
BOOL
TRUE or FALSE
TRUE when the axes position is within
the zone range.
Valid
Enabled
BOOL
TRUE or FALSE
TRUE when the axes group is being controlled.
CommandPosition
Command Current Position
ARRAY [0..3] OF
LREAL
Negative number,
positive number, or
0
Contains the current value of the command position.*3
ActualPosition
Actual Current Position
ARRAY [0..3] OF
LREAL
Negative number,
positive number, or
0
Contains the actual current position.*3
InPosition
In Position
BOOL
TRUE or FALSE
TRUE when the actual current positions
for all composition axes are within the inposition range of their target positions.
InOperation
In Operation
BOOL
TRUE or FALSE
TRUE when the operation for the instruction is in progress.
CalcPosition
Calculated Position
LREAL
Negative number,
positive number, or
0
Contains the position for the specified
time stamp.*3
ErrorParameterCode
Parameter Detail Code
WORD
*4
Contains the attached information for
some error codes. If the information is
saved, the detail code of the parameter
for which the error occurred is output.
ErrorNodePointIndex
Node Point Element
Number
UINT
*4
Contains the attached information for
some error codes. If the information is
saved, the element number of the node
point for which the error occurred is output.
OutputtedOffsetPosition
Position Offset Output
Value
LREAL
Negative number,
positive number, or
0
Contains the position offset that was
added to the command current position.
The value is updated when Active is
TRUE. Updating is stopped and the value
is retained when CommandAborted or
Error is TRUE.
*1 Error is not reset to FALSE until you execute one of the following instructions: MC_Reset, MC_GroupReset, or ResetMCError. This behavior is different from the PLCopen® specifications. With PLCopen® specifications, it changes to
FALSE when Execute changes to FALSE. When Error is TRUE, the motion control instruction is not executed. Instructions
are not executed after an error is cleared even if Execute is TRUE. Execute must change from FALSE to TRUE to execute
the instruction. Enable-type motion control instructions are executed whenever their Enable variable is TRUE.
*2 The upper four digits of the event code have the same value. Refer to the NY-series Troubleshooting Manual (Cat. No.
W564) for details.
*3 This unit is command units. The command unit is millimeters, micrometers, nanometers, degrees, inches, or pulses.
*4 Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for details.
Additional Information
To enable accessing output variables for motion control instructions even after the operating
mode is changed, assign variables that have output parameters with a retain attribute.
By accessing the assigned output parameter, you can access the output variable immediately
before the operating mode changed.
NY-series Motion Control Instructions Reference Manual (W561)
2-27
2
Output Variables for Motion Control Instructions
Feeding
2-1 Variables
InFeed
2 Variables and Instructions
In-Out Variables for Motion Control Instructions
The following table lists the in-out variables for motion control instructions.
Name
Meaning
Data type
Valid range
Description
Axis
Axis
_sAXIS_REF
---
Specifies the axis.
AxesGroup
Axes Group
_sGROUP_REF
---
Specifies the axes group.
Auxiliary
Auxiliary Axis
_sAXIS_REF
---
Specifies the auxiliary axis.
Master
Master Axis
_sAXIS_REF
---
Specifies the master axis.
Slave
Slave Axis
_sAXIS_REF
---
Specifies the slave axis.
CamTable
Cam Table
ARRAY[0..N] OF
_sMC_CAM_REF
---
Specifies the cam data structure _sMC_CAM_REF array variable as the cam
table.*1
TriggerInput
Trigger Input Condition
_sTRIGGER_REF
---
Sets the trigger condition.
TriggerVariable
Trigger Variable
BOOL
TRUE or FALSE
Specifies a trigger input variable when
the controller mode is specified with a
trigger condition.
Target
Write Target
_sAXIS_REF or
_sGROUP_REF
---
Specifies the axis or axes group for which
to write a parameter.
SettingValue
Setting Value
Depends on the
variable that is
specified.
---
Specifies the value to write.
The valid range follows the motion control
parameter that is specified by ParameterNumber.*2
The default value is 0.
Axes
Axes Group Composition Axes
ARRAY [0..3] OF
UINT
---
Specify the axis numbers of the new
composition axes.
HomingParameter
Homing Parameter
_sHOMING_REF
---
Sets the homing parameter.
Switches
Switches
ARRAY[0..255]
OF
_sCAMSWITCH_
REF
---
Specifies an array variable of
_sCAMSWITCH_REF switch structures
for use as switch ON/OFF pattern data.
The array element numbers indicate the
switch numbers.
Outputs
Output Signals
ARRAY[0..15] OF
_sOUTPUT_REF
---
Specifies an array variable of _sOUTPUT_REF output signal structures for
use as the output destinations for digital
ON/OFF time outputs that are calculated
based on switch ON/OFF pattern data.
The array element numbers indicate the
track numbers. You can specify this array
variable as an in-out variable for a
NX_AryDOutTimeStamp instruction to
actually turn ON and OFF digital outputs.
TrackOptions
Track Options
ARRAY[0..15] OF
_sTRACK_REF
---
Specifies an array variable of
_sTRACK_REF track option structures
for use as switch operating conditions.
The array element numbers indicate the
track numbers.
2-28
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Name
CamProperty
Meaning
Cam Properties
Data type
_sMC_CAM_PROPERTY
Valid range
---
Description
Specifies a variable of _sMC_CAM_PROPERTY cam property structures.
CamNodes
AxisParameter
Cam Nodes
Axis Parameters
ARRAY[0..N] OF
_sMC_CAM_NODE
---
_sAXIS_PARAM
---
Specifies an array variable of _sMC_CAM_NODE cam node structures.
A user-defined variable with a data type
of _sMC_CAM_NODE or a cam node
variable created on the Cam Editor of the
Sysmac Studio is specified.*3
2
When writing, specifies the axis
parameters to write.
*1 N in the array variable is set automatically by the Sysmac Studio. Specify a cam data variable that was created on the
Sysmac Studio.
*2 For details on the data types of variables, refer to Parameter Data Types and Valid Ranges on page 5-14 under MC_Write
on page 5-12.
*3 If you use a user-defined variable, create an array variable with a starting element number of 0 and a maximum of 358
array elements N.
2-29
In-Out Variables for Motion Control Instructions
When reading, specifies the variable with
a data type of _sAXIS_PARAM to which
to write the axis parameters that are
read.
NY-series Motion Control Instructions Reference Manual (W561)
2-1 Variables
A user-defined variable with a data type
of _sMC_CAM_PROPERTY or a cam
property variable created on the Cam
Editor of the Sysmac Studio is specified.
2 Variables and Instructions
2-2
Instructions
There are three types of motion control instructions. They are given in the following table.
Type
Outline
Common commands
Common instructions for the MC Function Module
Axis commands
Instructions for MC Function Module to perform single-axis
control
Axes group commands
Instructions for MC Function Module to perform multi-axes
coordinated control
For details on common commands, refer to Section 5 Common Command Instructions. For axis commands, refer to Section 3 Axis Command Instructions. For axes groups, refer to Section 4 Axes Group
Instructions.
With the NX-series Position Interface Units, some motion control instructions are subject to functional
restrictions and some motion control instructions cannot be used. Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for details.
Common Commands
This section describes the common instructions for the MC Function Module. The Classification Column gives "Administration" for non-motion instructions and "Motion" for motion instructions.
P: Instructions defined in PLCopen® technical specifications.
O: Instructions defined for the MC Function Module.
Instruction
Instruction name
Outline
Classification
MC_SetCamTableProperty
Set Cam Table Properties
The end point index of the cam table that is specified in the input parameter is changed.
Administration
O
MC_SaveCamTable
Save Cam Table
Saves the cam table specified with the input parameter.
Administration
O
MC_Write
Write MC Setting
Writes part of the parameter settings for motion
control.
Administration
O
MC_GenerateCamTable
Generate Cam Table
Creates a cam table for the cam properties and
cam nodes specified in the I/O parameters.
Administration
O
MC_WriteAxisParameter
Write Axis Parameters
Writes the settings of the axis parameters in the
motion control parameters.
Administration
O
MC_ReadAxisParameter
Read Axis Parameters
Reads the settings of the axis parameters from the
motion control parameters.
Administration
O
For details on the axis states due to instruction execution, refer to the NY-series Industrial Panel PC /
Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
2-30
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Axis Commands
P: Instructions defined in PLCopen® technical specifications.
O: Instructions defined for the MC Function Module.
Instruction
Instruction name
Outline
Classification
Power Servo
Makes the Servo Drive ready to operate.
Administration
P
MC_MoveJog
Jog
Performs jogging according to the specified target
velocity.
Motion
O
MC_Home
Home
Operates the motor to determine home using the
limit signals, home proximity signal, and home signal.
Motion
P
MC_HomeWithParameter
Home with Parameters
Sets the homing parameter and operates the motor
to determine home. It uses the limit signals, home
proximity signal, and home signal.
Motion
O
MC_Move
Positioning
Performs absolute positioning or relative positioning.
Motion
O
MC_MoveAbsolute
Absolute Positioning
Performs positioning for the specified absolute target position.
Motion
P
MC_MoveRelative
Relative Positioning
Performs positioning for the specified travel distance from the command current position.
Motion
P
MC_MoveVelocity
Velocity Control
Performs velocity control with the Position Control
Mode of the Servo Drive.
Motion
P
MC_MoveZeroPosition
High-speed Home
Performs positioning with an absolute position of 0
as the target position to return to home.
Motion
O
MC_MoveFeed
Interrupt Feeding
Positioning is performed for the specified travel distance from the position where an external device
triggers an interrupt input.
Motion
O
MC_Stop
Stop
Decelerates an axis to a stop.
Motion
P
MC_ImmediateStop
Immediate Stop
Stops an axis according to the stopping mode that
is set with the StopMode (Stopping Mode Selection)
input variable regardless of the status of the axis.
Motion
O
MC_SetPosition
Set Position
Changes the command current position or the
actual current position as required for an axis.
Administration
P
MC_SetOverride
Set Override Factors
Changes the target velocity for an axis.
Administration
P
MC_ResetFollowingError
Reset Following Error
Counter
Resets the following error between the command
position and the actual position.
Motion
O
MC_CamIn
Start Cam Operation
Starts cam operation with a specified cam table.
Motion
P
MC_CamOut
End Cam Operation
Ends cam operation for the axis specified with the
input parameter.
Motion
P
MC_GearIn
Start Gear Operation
Specifies the gear ratio between the master axis
and the slave axis and starts gear operation.
Motion
P
MC_GearInPos
Positioning Gear
Operation
Specifies the gear ratio between the master axis
and the slave axis and starts electronic gear operation. Specifies the positions of the master axis and
slave axis to start synchronization.
Motion
P
MC_GearOut
End Gear Operation
Cancels MC_GearIn and MC_GearInPos instructions.
Motion
P
MC_MoveLink
Synchronous Positioning
Performs positioning in sync with the specified master axis.
Motion
O
MC_CombineAxes
Combine Axes
Outputs the sum or difference of the command
positions of two axes as the command position.
Motion
O
MC_Phasing
Shift Master Axis
Phase
Shifts the phase of the master axis currently in synchronized control.
Motion
P
NY-series Motion Control Instructions Reference Manual (W561)
2-31
2
Axis Commands
MC_Power
2-2 Instructions
This section describes the instructions that are used to perform single-axis control for the MC Function
Module. The Classification Column gives "Administration" for non-motion instructions and "Motion" for
motion instructions.
2 Variables and Instructions
Instruction
Instruction name
Outline
Classification
MC_TorqueControl
Torque Control
Uses the Torque Control Mode of the Servo Drive to
control the torque.
Motion
P
MC_SetTorqueLimit
Set Torque Limit
Limits the torque output from the Servo Drive
through the torque limit function of the Servo Drive.
Administration
O
MC_ZoneSwitch
Zone Monitor
Determines if the command position or actual current position of an axis is within a specified zone.
Administration
O
MC_TouchProbe
Enable External Latch
Records the position of an axis when a trigger signal occurs.
Administration
P
MC_AbortTrigger
Disable External
Latch
Disables the current latch.
Administration
P
MC_AxesObserve
Monitor Axis Following Error
Monitors the deviation between the command positions or feedback positions for the specified two
axes to see if it exceeds the allowed value.
Administration
O
MC_SyncMoveVelocity
Cyclic Synchronous
Velocity Control
Outputs the value set for the target velocity every
primary period to the Servo Drive in Cyclic Synchronous Velocity Mode.
Motion
O
MC_SyncMoveAbsolute
Cyclic Synchronous
Absolute Positioning
Cyclically outputs the specified target positions for
the axes.
Motion
O
MC_Reset
Reset Axis Error
Clears an axis error.
Administration
P
MC_ChangeAxisUse
Change Axis Use
Temporarily changes the Axis Use axis parameter.
Administration
P
MC_DigitalCamSwitch
Enable Digital Cam
Switch
Turns a digital output ON or OFF according to the
axis position.
Administration
P
MC_TimeStampToPos
Time Stamp to Axis
Position Calculation
Calculates the position of the axis for the specified
time stamp.
Administration
O
MC_SyncOffsetPostion
Cyclic Synchronous
Position Offset Compensation
Compensates the position of a slave axis currently
in synchronized control.
Motion
O
For details on the axis states due to instruction execution, refer to the NY-series Industrial Panel PC /
Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Refer to the compliance list for items that conform to PLCopen® technical specifications. The compliance list can be accessed on the PLCopen® website.
Axes Group Commands
This section describes the instructions to perform multi-axes coordinated control for the MC Function
Module. The Classification Column gives "Group administration" for non-motion instructions and "Group
motion" for motion instructions.
P: Instructions defined in PLCopen® technical specifications.
O: Instructions defined for the MC Function Module.
Instruction
Instruction name
Outline
Classification
MC_GroupEnable
Enable Axes Group
Enables an axes group.
Group
administration
P
MC_GroupDisable
Disable Axes Group
Disables an axes group.
Group
administration
P
MC_MoveLinear
Linear Interpolation
Performs linear interpolation.
Group motion
O
MC_MoveLinearAbsolute
Absolute Linear Interpolation
Performs linear interpolation for the specified absolute position.
Group motion
P
MC_MoveLinearRelative
Relative Linear Interpolation
Performs linear interpolation for the specified relative position.
Group motion
P
MC_MoveCircular2D
Circular 2D Interpolation
Performs circular interpolation for two axes.
Group motion
O
MC_GroupStop
Group Stop
Decelerates all axes in an interpolated motion to a
stop.
Group motion
P
2-32
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Instruction
Instruction name
Outline
Classification
Axes Group Immediate Stop
Immediately stops all axes that are currently in
interpolated motion with the method that is specified in the axis parameters.
Group motion
O
MC_GroupSetOverride
Set Group Overrides
Changes the blended target velocity during an interpolated motion.
Group
administration
P
MC_GroupReadPosition
Read Axes Group
Position
Gets the command current positions and the actual
current positions of an axes group.
Group
administration
O
MC_ChangeAxesInGroup
Change Axes in
Group
Temporarily changes the Composition Axes axes
group parameter.
Group
administration
O
MC_GroupSyncMoveAbsolute
Axes Group Cyclic
Synchronous Absolute Positioning
Cyclically outputs the specified target positions for
the axes.
Group motion
O
MC_GroupReset
Group Reset
Clears axes group errors and axis errors.
Group
administration
P
Refer to the compliance list for items that conform to PLCopen® technical specifications. The compliance list can be accessed on the PLCopen® website.
NY-series Motion Control Instructions Reference Manual (W561)
2-33
2
Axes Group Commands
For details on the axes group states due to instruction execution, refer to the NY-series Industrial Panel
PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
2-2 Instructions
MC_GroupImmediateStop
2 Variables and Instructions
2-3
PDO Mapping
You must map the objects that are required for the motion control functions that you will use to process
data communications. The PDO map lists all of the objects that are registered in advance.
If you use an OMRON 1S-series R88D-1SN………-ECT, G5-series R88D-KN………-ECT (version 2.1 or
later), or R88D-KN………-ECT-L (version 1.1 or later) Servo Drive, it is not necessary to change the
default PDO map on the Sysmac Studio.
RxPDO: 261th Receive
PDO Mapping (1704
hex)
Controlword (6040 hex), Target Position (607A hex), Target Velocity (60FF hex), Target Torque (6071 hex), Modes of Operation (6060 hex), Touch Probe Function (60B8
hex), Max Profile Velocity (607F hex), Positive Torque Limit Value (60E0 hex), and
Negative Torque Limit Value (60E1 hex)
TxPDO: 259th Transmit PDO Mapping
(1B02 hex)
Error Code(603F hex), Status Word (6041 hex), Position Actual Value (6064 hex),
Torque Actual Value (6077 hex), Modes of Operation Display (6061 hex), Touch Probe
Status (60B9 hex), Touch Probe Pos1 Pos Value (60BA hex), Touch Probe Pos2 Pos
Value (60BC hex), and Digital Inputs (60FD hex)
Additional Information
To perform fully-closed control with an OMRON G5-series R88D-KN………-ECT Servo Drive, set
1701 hex as an RxPDO or select a total object size of 12 bytes or less for 1600 hex (for version
2.1 or later).
For details on setting the PDO map, refer to the NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
Refer to I/O Entry Mappings in the NX-series Position Interface Units User’s Manual (Cat. No. W524) for
information on using the NX-series Position Interface Units.
Required Objects
There are objects that are required for Servo axes and an object that is required for encoder axes. If
even one of the required objects is not set, a Required Process Data Object Not Set error (error code
3460 hex) occurs.
Servo Axes
The following objects must be set to use motion control instructions for a Servo axis.
Input/output
Output
Input
2-34
Function
Process data
Control word
6040 hex
Target position
607A hex
Status word
6041 hex
Position actual value
6064 hex
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
Additional Information
• Operation is as described in the following table depending on whether Modes of Operation
(6060 hex) and Modes of Operation Display (6061 hex) are mapped.
• You can execute instructions that
use CSP,*1 CSV,*2 or CST.*3
• The servo is OFF in any control
mode other than CSP, CSV, or
CST.
• You can execute instructions that
use CSP. If you execute any
instruction that uses any other control mode, a Process Data Object
Setting Missing error (error code
3461 hex) occurs.
• The MC Function Module assumes
that the CSP Servo Drive control
mode is used. Command the
Servo Drive to use CSP.
• You can execute instructions that
• You can execute instructions that
use CSP. If you execute any
use CSP. If you execute any
instruction that uses any other coninstruction that uses any other control mode, a Process Data Object
trol mode, a Process Data Object
Setting Missing error (error code
Setting Missing error (error code
3461 hex) occurs.
3461 hex) occurs.
• The servo is OFF in any control
mode other than CSP.
*1 CSP is the Cyclic Synchronous Position Control Mode of the Servo Drive.
*2 CSV is the Cyclic Synchronous Velocity Control Mode of the Servo Drive.
*3 CST is the Cyclic Synchronous Torque Control Mode of the Servo Drive.
Encoder Axes
The following object must be set to use motion control instructions for an encoder axis.
Input/output
Input
Function
Position actual value
NY-series Motion Control Instructions Reference Manual (W561)
Process data
4010 hex
2-35
2
Required Objects
Modes of Operation
(6060 hex) not
mapped
Modes of Operation Display (6061
hex) not mapped
2-3 PDO Mapping
Modes of Operation
(6060 hex) mapped
Modes of Operation Display (6061
hex) mapped
2 Variables and Instructions
Objects Required for Specific Instructions
There are objects that you must set to use specific instructions. There are settings required for both
Servo axes and encoder axes. If an object that is required for an instruction is not set, a Process Data
Object Setting Missing error (error code 3461 hex) occurs.
Servo Axes
There are objects that you must set to use specific instructions for Servo axes. Refer to the following
tables and set the required objects. There are no additional object settings required for Servo axis operation for any instructions that are not listed in the following table.
z Output Settings
Function
Instruction
Target
velocity
(60FF hex)
Target
torque (6071
hex)
Modes of
operation
(6060 hex)*1
Touch probe
function
(60B8 hex)
MC_Home or MC_HomeWithParameter
Conditionally
required*2
MC_MoveFeed
Conditionally
required*3
MC_MoveLink
Conditionally
required*4
MC_TorqueControl
Required
Required
MC_SyncMoveVelocity
Positive
torque limit
value (60E0
hex)
Negative
torque limit
value (60E1
hex)
Required
Required
Conditionally
required*5
MC_SetTorqueLimit
MC_TouchProbe
Max. profile
velocity
(607F hex)
Conditionally
required*2
Required
Required
*1 If you set Modes of Operation (6060 hex), also set Modes of Operation Display (6061 hex). Normal operation is not possible if only one of these objects is set.
*2 Setting is not required for Homing Operation Modes 11, 12, and 14.
*3 Setting is required when Mode is set to Drive Mode.
*4 Setting is required when LinkOption (Synchronization Start Condition) is set to_mcTriggerDetection and Mode is set to
Drive Mode.
*5 This setting is checked only when an OMRON 1S-series Servo Drive with built-in EtherCAT communications or G5-series
Servo Drive with built-in EtherCAT communications is used.
2-36
NY-series Motion Control Instructions Reference Manual (W561)
2 Variables and Instructions
z Input Settings
Function
Instruction
Touch probe status (60B9 hex)
Touch probe pos1
pos value (60BA
hex)
Touch probe pos2
pos value (60BC
hex)
MC_Home or MC_HomeWithParameter
Conditionally
required*2
Conditionally
required*2
MC_MoveFeed
Conditionally
required*3
Conditionally
required*4
Conditionally
required*5
MC_MoveLink
Conditionally
required*6
Conditionally
required*7
Conditionally
required*8
Conditionally
required*3
Conditionally
required*4
Conditionally
required*5
MC_TorqueControl
Required
Required
*1 If you set Modes of Operation Display (6061 hex), also set Modes of Operation (6060 hex). Normal operation is not possible if only one of these objects is set.
*2 Setting is not required for Homing Operation Modes 11, 12, and 14.
*3 Setting is required when Mode is set to Drive Mode.
*4 Setting is required when Mode is set to Drive Mode and LatchID is set to _mcLatch1 (Latch 1).
*5 Setting is required when Mode is set to Drive Mode and LatchID is set to _mcLatch2 (Latch 2).
*6 Setting is required when LinkOption (Synchronization Start Condition) is set to_mcTriggerDetection and Mode is set to
Drive Mode.
*7 Setting is required when LinkOption (Synchronization Start Condition) is set to _mcTriggerDetection, Mode is set to Drive
Mode, and LatchID is set to _mcLatch1 (Latch 1).
*8 Setting is required when LinkOption (Synchronization Start Condition) is set to _mcTriggerDetection, Mode is set to Drive
Mode, and LatchID is set to _mcLatch2 (Latch 2).
NY-series Motion Control Instructions Reference Manual (W561)
2-37
Objects Required for Specific Instructions
MC_SyncMoveVelocity
2
Required
MC_TouchProbe
2-3 PDO Mapping
Torque actual
value (6077 hex)
Modes of operation display
(6061 hex)*1
2 Variables and Instructions
Encoder Axes
There are objects that you must set to use specific instructions for encoder axes. Refer to the following
tables and set the required objects. There are no additional object settings required for encoder axis
operation for any instructions that are not listed in the following table.
z Output Settings
Function
Instruction
MC_TouchProbe
Touch probe function (4020 hex)
Conditionally required*1
Software Switch of Encoder’s Input Slave
(4020 hex)
Conditionally required*2
*1 Setting is required when Mode is set to Drive Mode.
*2 Setting is required when an OMRON GX-series encoder slave is used and Mode is set to Drive Mode.
z Input Settings
Function
Instruction
MC_TouchProbe
Touch probe status (4030 hex)
Conditionally
required*1
Touch probe pos1
pos value
(4012 hex)
Conditionally
required*2
Touch probe pos2
pos value
(4013 hex)
Conditionally
required*3
Status of Encoder’s
Input Slave
(4030 hex)
Conditionally
required*4
*1 Setting is required when Mode is set to Drive Mode.
*2 Setting is required when Mode is set to Drive Mode and LatchID is set to _mcLatch1 (Latch 1).
*3 Setting is required when Mode is set to Drive Mode and LatchID is set to _mcLatch2 (Latch 2).
*4 Setting is required when an OMRON GX-series encoder slave is used and Mode is set to Drive Mode.
2-38
NY-series Motion Control Instructions Reference Manual (W561)
Axis Command Instructions
3
This section describes the instructions that are used to perform single-axis control for
the MC Function Module.
MC_Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
MC_MoveJog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-8
MC_Home . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-16
MC_HomeWithParameter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-38
MC_Move . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-44
MC_MoveAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-49
MC_MoveRelative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-76
MC_MoveVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-83
MC_MoveZeroPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-98
MC_MoveFeed . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-105
MC_Stop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-133
MC_ImmediateStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-142
MC_SetPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-147
MC_SetOverride . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-153
MC_ResetFollowingError . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-158
MC_CamIn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-165
MC_CamOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-219
MC_GearIn . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-224
MC_GearInPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-243
MC_GearOut . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-264
MC_MoveLink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-269
MC_CombineAxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-292
MC_Phasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-304
MC_TorqueControl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-312
MC_SetTorqueLimit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-323
MC_ZoneSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-330
MC_TouchProbe . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-336
NY-series Motion Control Instructions Reference Manual (W561)
3-1
3 Axis Command Instructions
MC_AbortTrigger . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-358
MC_AxesObserve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-363
MC_SyncMoveVelocity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-369
MC_SyncMoveAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-379
MC_Reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-386
MC_ChangeAxisUse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-390
MC_DigitalCamSwitch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-394
MC_TimeStampToPos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-413
MC_SyncOffsetPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-425
3-2
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_Power
The MC_Power instruction makes a Servo Drive ready to operate.
Instruction
MC_Power
Name
Power Servo
FB/FUN
Graphic expression
FB
ST expression
MC_Power_instance
MC_Power
Axis
Status
Busy
Error
ErrorID
MC_Power
Axis
Enable
MC_Power_instance (
Axis :=parameter,
Enable :=parameter,
Status =>parameter,
Busy =>parameter,
Error =>parameter,
ErrorID =>parameter
);
3
Variables
Variables
Input Variables
Name
Enable
Meaning
Enable
Data type
BOOL
Valid range
Default
Description
TRUE or FALSE
FALSE
The device is ready for operation when
Enable is TRUE, and not ready when it is
FALSE.
Output Variables
Name
Meaning
Data type
Valid range
Description
Status
Servo ON
BOOL
TRUE or FALSE
TRUE when the device is ready for operation.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Status
When the specified axis becomes
ready for operation.
• When operation ready status for the
specified axis is cleared.
• When Error changes to TRUE.
Busy
When Enable changes to TRUE.
• When Enable changes to FALSE.
• When Error changes to TRUE.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
NY-series Motion Control Instructions Reference Manual (W561)
3-3
3 Axis Command Instructions
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• When Enable changes to TRUE, the axis specified by Axis is made ready to operate.
You can control the axis when it is ready to operate.
• When Enable changes to FALSE, the ready status is cleared for the axis specified by Axis.
You cannot control the axis after the ready status is cleared because it will not acknowledge operation commands. Also, an error occurs if a motion command is executed for an axis for which the
ready status is cleared. You can execute the MC_Power (Power Servo) and MC_Reset (Reset Axis
Error) instructions even for axes that are not ready.
• You can use this instruction to disable the operation of axes while they are in motion. In this case,
CommandAborted will change to TRUE. Output of the operation command will stop and the axis will
not longer be ready for operation.
• If home is not defined for a Servomotor with an absolute encoder, compensation is performed using
the absolute encoder home offset to define home when the axis is ready to operate. For a CPU Unit
with unit version 1.10 or later, home is also defined when EtherCAT process data communications
change from a non-established to an established state.
For details on the absolute encoder home offset, refer to the NJ/NX-series CPU Unit Motion Control
User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control
User’s Manual (Cat. No. W559).
Precautions for Correct Use
• You can use this instruction for servo axes and virtual servo axes. If the instruction is used for
encoder axes or virtual encoder axes, an error will occur.
• The function of this instruction is different when it is executed for an NX-series Pulse Output
Unit. Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for details.
• Executing this Instruction for the Master Axis of Synchronized Control
When master axis operation is disabled for a vertical axis, the position of the master axis may
change rapidly. This may cause the motion of the slave axis to change rapidly. Take suitable
measures to prevent the slave axis from moving rapidly, such as applying a brake to the master axis or leaving master axis operation enabled until after synchronized control is completed.
3-4
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Additional Information
Execution of an execute-type motion control instruction is started when the power flow that is
connected to the Execute input changes to TRUE and continues until the control operation for
the instruction is completed. Even if master control is reset after execution of the instruction is
started, execution of the instruction is continued until the control operation for the instruction is
completed.
Master control started.
MC
MC_On
In
MC_Power
To interlock an execute-type motion control instruction, place the MC_Power (Power Servo)
instruction inside the master control region, as shown in the following figure. That will ensure that
the Servo is turned OFF when MC_On changes to FALSE.
MCNo
0
3
Servo turned ON.
Function
PWR1
MC_Power
Pwr1_En
MC_Axis000
Axis
Axis
Enable
Pwr1_Status
Status
Busy
Pwr1_Bsy
Error
Pwr1_Err
ErrorID
Pwr1_ErrID
Master control ended.
MCR
In
0
MCNo
z Relation to CPU Unit Operating Modes
If an axis is placed in ready status during RUN mode, ready status will continue even if the operating
mode changes to PROGRAM mode.
z Deleting Instruction with Online Editing
If an axis is placed in ready status, ready status will continue even if the instruction is deleted during
online editing.
Timing Charts
• When Enable changes to TRUE, Busy (Executing) changes to TRUE to indicate that the instruction
was acknowledged.
• After the axis becomes ready for operation, Status (Servo ON) changes to TRUE.
• When Enable changes to FALSE, Busy (Executing) changes to FALSE. Status (Servo ON) changes
to FALSE when ready status is cleared. Status (Servo ON) outputs the axis ready status regardless
of whether Enable is TRUE or FALSE.
NY-series Motion Control Instructions Reference Manual (W561)
3-5
3 Axis Command Instructions
Enable
Status
Busy
The specified axis becomes
ready for operation.
Ready status is cleared for the
specified axis.
Precautions for Correct Use
• Status (Servo ON) will not change to TRUE until Enable changes to TRUE and the processing
is finished at the axis. Make sure that Status (Servo ON) changes to TRUE before moving the
axis.
• Write the user program to confirm that EtherCAT communications are established before you
execute motion control instructions. This is particularly important when starting axis operation
immediately after you turn ON the power supply to the Controller. Also, include interlocks in
the user program that detect errors in EtherCAT communications during operation.
Re-execution of Motion Control Instructions
You cannot re-execute motion instructions with enable-type inputs.
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Multi-execution of MC_Power Instructions
Precautions for Correct Use
Do not execute the MC_Power (Power Servo) instruction for an axis that is already enabled for
another instance of the MC_Power (Power Servo) instruction. Normally, use only one MC_Power
(Power Servo) instruction for each axis.
If another MC_Power instruction is executed for the same axis, the last instruction takes priority.
Power A
MC_Power
A
Axis1
Axis
Enable
Multiple MC_Power instructions
executed for the same axis
B
3-6
Axis
Status
Busy
Error
ErrorID
Power B
MC_Power
Axis1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Power A
Enable
Status
Busy
Power B
Enable
MC_Power
Status
Busy
Error
ErrorID
0
3
Function
Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-7
3 Axis Command Instructions
MC_MoveJog
The MC_MoveJog instruction jogs an axis according to the specified target velocity.
Instruction
MC_MoveJog
Name
Jog
FB/FUN
FB
Graphic expression
ST expression
MC_MoveJog_instance
MC_MoveJog_instance (
Axis :=parameter,
PositiveEnable :=parameter,
NegativeEnable
:=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveJog
Axis
Axis
PositiveEnable
Busy
CommandAborted
NegativeEnable
Velocity
Error
Acceleration
ErrorID
Deceleration
Variables
Input Variables
Valid range
Default
PositiveEnable
Name
Positive Direc- BOOL
tion Enable
Meaning
Data type
TRUE or FALSE
FALSE
When this variable changes to TRUE,
the axis starts moving in the positive
direction. When it changes to FALSE,
the axis stops moving.
Description
NegativeEnable
Negative
Direction
Enable
BOOL
TRUE or FALSE
FALSE
When this variable changes to TRUE,
the axis starts moving in the negative
direction. When it changes to FALSE,
the axis stops moving.
Velocity
Target
Velocity
LREAL
Non-negative
number
0
Specify the target velocity. The unit is
command units/s.*
Acceleration
Acceleration
Rate
LREAL
Non-negative
number
0
Specify the acceleration rate. The unit is
command units/s2.*
Deceleration
Deceleration
Rate
LREAL
Non-negative
number
0
Specify the deceleration rate. The unit is
command units/s2.*
* Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series
Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command units.
3-8
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
MC_MoveJog
Busy
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When PositiveEnable or NegativeEnable
changes to TRUE.
• When the axis stops.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When PositiveEnable changes to FALSE.
• When NegativeEnable changes to FALSE.
• After one period when PositiveEnable and
NegativeEnable are FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_MoveJog instruction performs jogging according to the specified Velocity (Target Velocity).
• To jog in the positive direction, change PositiveEnable (Positive Direction Enable) to TRUE. To jog in
the negative direction, change NegativeEnable (Negative Direction Enable) to TRUE.
• If PositiveEnable (Positive Direction Enable) and NegativeEnable (Negative Direction Enable) are
changed to TRUE at the same time, PositiveEnable (Positive Direction Enable) takes priority. As a
result, the axis will jog in the positive direction.
• If the command velocity of the MC_MoveJog (Jog) instruction exceeds the maximum jog velocity that
is set in the axis parameters, the maximum jog velocity is used.
NY-series Motion Control Instructions Reference Manual (W561)
3-9
3
Function
Busy
3 Axis Command Instructions
Precautions for Correct Use
• When creating a ladder diagram program, you must connect the PositiveEnable (Positive
Direction Enable) input variable to the left bus bar and specify a variable for the NegativeEnable (Negative Direction Enable) input variable as shown below.
MC_MoveJog_instance
MC_MoveJog
POS_EN
MC_Axis000
Axis
Axis
NEGA_EN
VEL
NegativeEnable CommandAborted
Error
Velocity
ACC
Acceleration
DEC
Deceleration
J_DONE
Busy
PositiveEnable
ErrorID
J_CA
J_ERR
J_ERRID
To use the master control instructions (MC and MCR) for the MC_MoveJog (Jog) instruction, do
not program the instructions as shown below. If you do, master control is applied only to PositiveEnable (Positive Direction Enable), i.e., it is not applied to NegativeEnable (Negative Direction Enable).
Master control started.
MC
MC_On
In
0
MCNo
MC_MoveJog Instruction
MC_MoveJog_instance
MC_MoveJog
POS_EN
MC_Axis000
Axis
Axis
PositiveEnable
J_DONE
Busy
NegativeEnable CommandAborted
J_CA
VEL
Velocity
J_ERR
ACC
Acceleration
DEC
Deceleration
NEGA_EN
Error
ErrorID
J_ERRID
Master control ended.
MCR
In
0
MCNo
Always use the master control instructions for the MC_Power instruction.
3-10
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Master control started.
MC
MC_On
In
0
MCNo
Servo turned ON.
PWR1
MC_Power
Pwr1_En
MC_Axis000
Axis
Axis
Pwr1_Status
MC_MoveJog
Enable
Status
Busy
Pwr1_Bsy
Error
Pwr1_Err
ErrorID
Pwr1_ErrID
Master control ended.
3
MCR
In
Function
0
MCNo
MC_MoveJog Instruction
MC_MoveJog_instance
MC_MoveJog
POS_EN
MC_Axis000
Axis
PositiveEnable
NEGA_EN
VEL
Axis
J_DONE
Busy
NegativeEnable CommandAborted
J_CA
Velocity
J_ERR
ACC
Acceleration
DEC
Deceleration
NY-series Motion Control Instructions Reference Manual (W561)
Error
ErrorID
J_ERRID
3-11
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE as soon as PositiveEnable (Positive Direction Enable) or NegativeEnable (Negative Direction Enable) changes to TRUE.
• The axis starts deceleration as soon as PositiveEnable (Positive Direction Enable) or NegativeEnable
(Negative Direction Enable) changes to FALSE. Busy (Executing) changes to FALSE when the axis
stops completely.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing) changes to FALSE.
PositiveEnable
NegativeEnable
Busy
CommandAborted
Error
ErrorID
Velocity
16#0000
Target velocity
Acceleration
Deceleration
Time
Decelerates to a stop
when another instruction
causes an error.
You can specify the Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration
(Deceleration Rate) as input variables. Input variables Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration (Deceleration Rate) are updated in the motion only when PositiveEnable
(Positive Direction Enable) or NegativeEnable (Negative Direction Enable) changes to TRUE. Therefore, the axis velocity will not change even if Velocity (Target Velocity) changes while PositiveEnable
(Positive Direction Enable) or NegativeEnable (Negative Direction Enable) remains TRUE.
3-12
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart When Target Velocity Is 0
When the Velocity (Target Velocity) is 0 and you start jogging the axis, the axis will enter continuous
operation without motion.
The following timing chart shows an example when the Velocity (Target Velocity) is 0 and you start
jogging the axis.
PositiveEnable
NegativeEnable
MC_MoveJog
Velocity
0
Busy
CommandAborted
Error
ErrorID
3
16#0000
Function
Velocity
Time
z Timing Chart When Acceleration/Deceleration Rate Is 0
When the Acceleration (Acceleration Rate) or Deceleration (Deceleration Rate) is 0 and you start
jogging the axis, the axis will reach the target velocity without accelerating or decelerating.
The timing chart below shows an example when the Acceleration (Acceleration Rate) and Deceleration (Deceleration Rate) are 0.
PositiveEnable
NegativeEnable
Busy
CommandAborted
Error
ErrorID
16#0000
Velocity
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-13
3 Axis Command Instructions
Re-execution of Motion Control Instructions
z Restarting with Enable in the Same Direction
If you change PositiveEnable (Positive Direction Enable) or NegativeEnable (Negative Direction
Enable) to TRUE when it is FALSE and the axis is decelerating, the axis will begin to accelerate
towards the target velocity. If you change the Velocity (Target Velocity), Acceleration (Acceleration
Rate), or Deceleration (Deceleration Rate) at this time, the new value of the input parameter is used
in operation.
The axis is not stopped, and Busy (Executing) does not change to FALSE.
The following example shows operation when PositiveEnable (Positive Direction Enable) changes to
TRUE during deceleration.
PositiveEnable
NegativeEnable
Velocity
Velocity1
Velocity2
Busy
CommandAborted
Error
ErrorID
16#0000
Velocity
Velocity2
Velocity1
Time
z Restarting with Enable in the Opposite Direction
If you change NegativeEnable (Negative Direction Enable) to TRUE when PositiveEnable (Positive
Direction Enable) is TRUE and the axis is jogging in the positive direction, the axis will reverse its
direction and start jogging in the negative direction. When this happens, you can jog the axis with
the input variables for when NegativeEnable (Negative Direction Enable) changes to TRUE. The
input variables are Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration
(Deceleration Rate).
The deceleration rate before the axis direction is reversed and the acceleration rate after it is
reversed follow the input variables for when NegativeEnable (Negative Direction Enable) changes to
TRUE, regardless of the Operation Selection at Reversing axis parameter. When NegativeEnable
(Negative Direction Enable) is TRUE and the axis is jogging in the negative direction, the same
operation occurs when PositiveEnable (Positive Direction Enable) changes to TRUE.
If NegativeEnable (Negative Direction Enable) changes to TRUE while PositiveEnable (Positive
Direction Enable) is TRUE, the axis starts jogging in the negative direction. In this case, the axis will
not jog in the positive direction even if NegativeEnable (Negative Direction Enable) changes to
FALSE. To jog the axis in the positive direction, change PositiveEnable (Positive Direction Enable) to
FALSE, and then back to TRUE again. The same operation applies to the opposite case.
The following example shows an operation example when NegativeEnable (Negative Direction
Enable) changes to TRUE after PositiveEnable (Positive Direction Enable) changes to TRUE.
3-14
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
PositiveEnable
NegativeEnable
Busy
CommandAborted
Error
MC_MoveJog
ErrorID
16#0000
Velocity
3
Time
Function
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axes will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
PositiveEnable
NegativeEnable
Busy
CommandAborted
Error
ErrorID
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-15
3 Axis Command Instructions
MC_Home
The MC_Home instruction operates the motor to determine home. It uses the limit signals, home proximity signal, and home signal.
Instruction
MC_Home
Name
Home
FB/FUN
Graphic expression
FB
ST expression
MC_Home_instance
MC_Home
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
MC_Home_instance (
Axis :=parameter,
Execute :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
BOOL
Valid range
Default
TRUE or FALSE
FALSE
Description
The instruction is executed when Execute changes to TRUE.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-16
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the instruction is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
3
Function
Error
MC_Home
Done
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• Homing starts when Execute changes to TRUE for the axis specified in Axis.
• Set the parameters used by the home instruction in the axis parameters.
• There are 10 Homing Operation Modes for the home instruction.
Set the desired method in axis parameter Homing Method in the Sysmac Studio.
Precautions for Correct Use
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
z Mapping Data Objects
To use the MC_Home instruction, map the following object data in the Detailed Settings Area of the
Axis Basic Settings Display of the Sysmac Studio. However, setting is not required for Homing Operation Modes 11, 12, and 14.
• Touch probe function (60B8 hex)
• Touch probe status (60B9 hex)
• Touch probe pos1 pos value (60BA hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
NY-series Motion Control Instructions Reference Manual (W561)
3-17
3 Axis Command Instructions
For details on mapping data objects, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Refer to I/O Entry Mappings in the NX-series Position Interface Units User’s Manual (Cat. No. W524)
for information on using the NX-series Position Interface Units.
Settings for OMRON 1S-series Servo Drives
Set the input signals, such as the home proximity signal, that are used by the home instruction in the
OMRON 1S-series Servo Drive.
Refer to the information on connecting to the Servo Drive in the NJ/NX-series CPU Unit Motion Control
User’s Manual (Cat. No. W507) or in the NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559), and information on general input signals in the AC Servomotors/Servo Drives 1S-series with Built-in EtherCAT Communications User’s Manual (Cat. No. I586) for
details on how to set the input signals.
Settings for OMRON G5-series Servo Drives
Set the input signals, such as the home proximity signal, that are used by the home instruction in the
OMRON G5-series Servo Drive.
Refer to the information on connecting to the Servo Drive in the NJ/NX-series CPU Unit Motion Control
User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control
User’s Manual (Cat. No. W559), and information on sequence I/O signals in the AC Servomotors/Servo
Drives G5-series with Built-in EtherCAT Communications User’s Manual (Cat. No. I576) or the AC Servomotors/Servo Drives G5-series with Built-in EtherCAT Communications Linear Motor Type User’s
Manual (Cat. No. I577) for details on how to set the input signals.
Settings for NX-series Position Interface Units
Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for information on setting
the NX-series Position Interface Units.
3-18
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Homing Operation Modes
You can select any of the ten operations to define home. For details on the operations, refer to Function
on page 3-17.
• Proximity reverse turn/home proximity input OFF
• Proximity reverse turn/home proximity input ON
• Home proximity input OFF
• Home proximity input ON
• Limit input OFF
MC_Home
• Proximity reverse turn/home input mask distance
• Limit inputs only
• Proximity reverse turn/holding time
• No home proximity input/holding home input
3
• Zero position preset
(Yes: Parameter is used, No: Parameter is not used.)
Homing parameters
Homing Start Direction
Home Input Detection Direction
Operation Selection at Positive Limit Input
Operation Selection at Negative Limit Input
Homing Velocity
Homing Approach Velocity
Homing Acceleration
Homing Deceleration
Homing Jerk
Home Input Mask Distance
Home Offset
Homing Holding Time
Homing Compensation Value
Homing Compensation Velocity
Proximity reverse turn/home proximity input OFF
Proximity reverse turn/home proximity input ON
Home proximity input OFF
Home proximity input ON
Limit input OFF
Proximity reverse turn/home input
mask distance
Limit inputs only
Proximity reverse turn/holding time
No home proximity input/holding
home input
Zero position preset
Home Input Signal
Homing Operation Mode
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Refer to Homing Definition Operation on page 3-23 for details on operation in the Homing Modes.
NY-series Motion Control Instructions Reference Manual (W561)
3-19
Function
The following tables shows the homing parameters that are used for each Homing Operation Mode.
3 Axis Command Instructions
Additional Information
If you use NX-series Position Interface Units, do not select holding for the Homing Operation
Mode. Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for details.
Operation Selection at Positive Limit Input and Operation Selection
at Negative Limit Input
• Select the operation when the axis reaches a limit input in the operating direction during homing:
reverse the axis and continue with homing, or do not reverse the axis, create an error, and stop the
axis. To reverse the axis, also select the stopping method.
• An error occurs and the axis stops if the axis is set to reverse direction, and the limit signal in the
home input detection direction turns ON when traveling at the homing approach velocity. However, if
the homing operation mode is 13 (no home proximity input/holding home input), which does not use
proximity signals, no error will occur and the axis will not stop.
Home proximity input signal
ON
OFF
Limit in direction opposite ON
to detection direction
OFF
Limit in detection direction
ON
OFF
Home instruction Homing velocity
Homing approach velocity
Stops.
Start
• An error occurs and the axis stops if the axis is set to reverse direction or the limit input operation in
both directions and home cannot be detected after moving from the limit input opposite to the home
input detection direction to the other limit input.
Home proximity input signal
Limit in direction opposite
to detection direction
Limit in detection direction
ON
OFF
ON
OFF
ON
OFF
Home instruction Homing velocity
Homing approach velocity
Start
3-20
Stops.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Homing Start Direction
Select the direction in which the axis starts moving when homing is started. If homing starts while the
home proximity signal is ON in a Homing Operation Mode that includes reversal operation, the axis
starts motion in the direction opposite to the home input detection direction (regardless of the setting of
the homing start direction).
There are four Homing Operation Modes that include reversal operation for a reverse turn. These are
listed below.
• 0: Proximity reverse turn/home proximity input OFF
MC_Home
• 1: Proximity reverse turn/home proximity input ON
• 9: Proximity reverse turn/home input mask distance
• 12: Proximity reverse turn/holding time
Homing start direction: Positive
Home input detection direction: Positive
Home proximity input signal
3
ON
OFF
(1)
Start
Function
Operation command
Negative direction
(3)
Positive direction
Start
(2)
Start
(1), (3):
The home proximity signal is OFF, so the axis starts moving in the homing start direction.
(2):
The home proximity signal is ON, so the axis starts moving in the direction opposite to the
home input detection direction.
Homing start direction: Negative
Home input detection direction: Negative
Home proximity input signal
ON
OFF
Operation command
Start
(2)
Start
Positive direction
Negative direction
(1)
Start
(3)
(1), (3):
The home proximity signal is OFF, so the axis starts moving in the homing start direction.
(2):
The home proximity signal is ON, so the axis starts moving in the direction opposite to the
home input detection direction.
NY-series Motion Control Instructions Reference Manual (W561)
3-21
3 Axis Command Instructions
Home Input Detection Direction
Select the direction when home input is detected.
The following timing chart shows the operation when the home input detection direction is FALSE (positive direction).
Operation Example: Proximity Reverse Turn/Home Proximity Input OFF
ON
Home proximity input signal
OFF
ON
Home input signal
OFF
Homing velocity
Homing approach velocity
Operation command
Negative direction
Start
Stops.
Positive direction
The following timing chart shows the operation when the home input detection direction is TRUE (negative direction).
Operation Example: Proximity Reverse Turn/Home Proximity Input OFF
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
Homing velocity
Operation command
Stops.
Negative direction
Start
Positive direction
Homing approach velocity
Homing velocity
Home Input Mask Distance
Set the feed distance when you set the Homing Operation Mode to 9 (proximity reverse turn/home input
mask distance). For details on the operation, refer to 9: Proximity Reverse Turn/Home Input Mask Distance Operation on page 3-26.
Homing Compensation Value
Set the homing compensation value that is applied after the home is detected. Set the travel velocity in
the Homing Compensation Velocity. For details on the operation, refer to Homing Compensation on
page 3-32.
Home Position Offset
The Home Position Offset is used to preset the actual position after homing is completed. The current
value is the value set for the Home Position Offset.
3-22
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Homing Velocity
This is the high velocity during homing.
Homing Approach Velocity
This is the proximity velocity during homing.
This is the velocity when you set a homing compensation value. For details on the operation, refer to
Homing Compensation on page 3-32.
3
Instruction Details
Function
z Homing Definition Operation
This section describes the 10 Homing Operation Modes.
0: Proximity Reverse Turn/Home Proximity Input OFF Operation
1
2
The axis starts at the homing velocity. When the home proximity input signal turns ON, the axis
starts decelerating to the homing approach velocity.
After the axis reaches the homing approach velocity, the axis stops at the first home input signal
after the home proximity input signal turns OFF. This defines home.
Home input detection direction
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
Homing velocity
Homing approach velocity
Command output
Negative direction
Start
Stops
Positive direction
Homing velocity
• If you start homing while the home proximity input signal is ON, the operation will start at the homing velocity in the direction opposite to the home input detection direction. After the home proximity input turns OFF, the homing operation will start at the homing velocity in the home input
detection direction.
• Homing is started and home is defined when the home input signal turns ON after the home proximity input signal turns ON and OFF while the velocity is below the homing approach velocity.
1: Proximity Reverse Turn/Home Proximity Input ON Operation
1
2
MC_Home
Homing Compensation Velocity
The axis starts at the homing velocity. When the home proximity input signal turns ON, the axis
starts decelerating to the homing approach velocity.
After the axis reaches the homing approach velocity, the axis stops at the first home input signal.
This defines home.
After the home proximity input signal turns ON, its status does not affect operation.
NY-series Motion Control Instructions Reference Manual (W561)
3-23
3 Axis Command Instructions
Home input detection direction
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
Homing velocity
Homing approach velocity
Stops.
Negative direction
Positive direction
Start
Command output
Homing velocity
• If you start homing while the home proximity input signal is ON, the operation will start at the homing velocity in the direction opposite to the home input detection direction. After the home proximity input turns OFF, the homing operation will start at the homing velocity in the home input
detection direction.
• Homing is started and home is defined when the home input signal turns ON after the home proximity input signal turns ON while the velocity is below the homing approach velocity.
4: Operation for Home Proximity Input OFF
1
2
When the home proximity input signal turns ON, the axis starts decelerating to the homing
approach velocity.
After the axis reaches the homing approach velocity, the axis stops at the first home input signal
after the home proximity input signal turns OFF. This defines home.
Home input detection direction
Negative limit input signal
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
ON
OFF
Homing velocity
Homing approach velocity
Negative direction
Positive direction
Stops.
Homing approach velocity
Start
Homing start direction
Negative direction
Homing velocity
Homing start direction
Positive direction
Start
Stops.
Homing approach velocity
Negative direction
Positive direction
Start
Stops.
Homing velocity
• If you start homing while the home proximity input signal is ON, the axis performs the following
operation depending on the setting of the homing start direction.
Homing Start Direction Same as Home Input Detection Direction
The axis does not perform a reverse turn operation and homing starts in the home input detection
direction at the homing approach velocity.
3-24
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Homing Start Direction Different from Home Input Detection Direction
Operation starts in the homing start direction at the homing velocity, regardless of the status of the
home proximity input signal. If you set the operation at the limit input in the homing start direction to
reverse direction, the axis reverses direction when limit input is detected and performs a homing
operation in the home input detection direction.
• Homing is started and home is defined when the home input signal turns ON after the home proximity input signal turns ON and OFF while the velocity is below the homing approach velocity.
5: Home Proximity Input ON Operation
2
When the home proximity input signal turns ON, the axis starts decelerating to the homing
approach velocity.
After the axis reaches the homing approach velocity, the axis stops at the first home input signal.
This defines home.
After the home proximity input signal turns ON, its status does not affect operation.
MC_Home
1
3
Home input detection direction
Function
ON
Negative limit input signal
Positive limit input signal
OFF
ON
OFF
ON
Home proximity input signal
Home input signal
OFF
ON
OFF
Homing velocity
Homing approach velocity
Negative direction
Positive direction
Start
Stop
Homing start direction
Homing approach velocity
Negative direction
Stop Start
Homing velocity
Homing start direction
Negative direction
Positive direction
Homing approach velocity
Positive direction
Start
Stop
Homing velocity
• If you start homing while the home proximity input signal is ON, the axis performs the following
operation depending on the setting of the homing start direction.
Homing Start Direction Same as Home Input Detection Direction
The axis does not perform a reverse turn operation and homing starts in the home input detection
direction at the homing velocity.
Homing Start Direction Different from Home Input Detection Direction
Operation starts in the homing start direction at the homing velocity, regardless of the status of the
home proximity input signal. If you set the operation at the limit input in the homing start direction to
reverse direction, the axis reverses direction when limit input is detected and performs a homing
operation in the home input detection direction.
• Homing is started and home is defined when the home input signal turns ON after the home proximity input signal turns ON while the velocity is below the homing approach velocity.
NY-series Motion Control Instructions Reference Manual (W561)
3-25
3 Axis Command Instructions
8: Operation for Limit input OFF
1
2
The axis starts at the homing velocity. When the limit signal in the direction opposite to the home
input detection direction turns ON, the axis starts decelerating to the homing approach velocity.
After the axis reaches the homing approach velocity, the axis stops at the first home input signal
after the limit signal turns OFF. This defines home.
Home input detection direction
Negative limit input signal
Home input signal
ON
OFF
ON
OFF
Homing velocity
Homing approach velocity
Command output
Positive direction
Stops.
Homing approach velocity
Negative direction
Start
Negative direction
Start
Stops.
Positive direction
• If you perform homing while the limit input on the opposite side of the home input detection direction is ON, the homing operation starts at the home approach velocity in the home input detection
direction.
• Homing is started and home is defined when the home input signal turns ON after the limit signal
in the direction opposite to the home input detection direction turns ON and OFF again while the
velocity is below the homing approach velocity.
9: Proximity Reverse Turn/Home Input Mask Distance Operation
1
2
The axis starts at the homing velocity. When the home proximity input signal turns ON, the axis
starts decelerating to the homing approach velocity.
The axis moves by the home input mask distance after the home proximity input signal turns ON
and stops at the first home input signal. This defines home.
After the home proximity input signal turns ON, its status does not affect operation. If the specified travel distance is too short and travel would be completed before the axis decelerates to the
homing approach velocity, an Invalid Home Input Mask Distance error (error code: 742B hex)
occurs when you start homing.
Home input detection direction
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
Homing velocity
Homing approach velocity
Command output
Positive direction
Negative direction
Start
Stops.
After the proximity input, motion is
according to the home input mask distance.
• If you start homing while the home proximity input signal is ON, the operation will start at the homing velocity in the direction opposite to the home input detection direction. After the home proximity input signal turns OFF, the homing operation will start at the homing approach velocity in the
home input detection direction.
3-26
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• Homing is started and home is defined when the home input signal turns ON after the axis travels
the home input mask distance after the home proximity input signal turns ON while the velocity is
below the homing approach velocity.
11: Operation for Limit Inputs Only
1
2
After the axis stops, the axis moves in the other direction at the homing velocity and decelerates
to a stop when the limit signal turns ON.
After the axis stops, the axis moves in the other direction at the homing approach velocity. The
position where the limit signal turns OFF is defined as home and an immediate stop is performed (i.e., a stop using remaining pulses). The axis does not return to the home position.
Home input detection direction
Negative limit input signal
Range of movement
3
ON
OFF
ON
Function
Positive limit input signal
MC_Home
3
The axis starts at the homing velocity. When the limit signal in the direction opposite to the home
input detection direction turns OFF, the axis decelerates to a stop.
OFF
Homing velocity
Homing approach velocity
Negative direction
Home Stops using
remaining pulses.
Start
Positive direction
Homing approach velocity
Negative direction
Start
Negative direction
Positive direction
Stops using
remaining pulses.
Homing approach velocity
Start
Positive direction
Stops
using
Home
remaining pulses.
Home
Homing velocity
• If you use only the limit signals to perform homing, the point at which the limit signal turns OFF
during operation in the home input detection direction is set as the home detection position.
• If you start homing while the limit signal in the home input detection direction is ON, the operation
will start at the homing velocity in the direction opposite to the home input detection direction.
When the limit signal in the direction opposite to the home input detection direction turns ON, the
axis decelerates to a stop.
• Even if the limit signal turns OFF before the axis decelerates to a stop after the limit signal is
detected, home is not defined and the axis continues to decelerate. In this case, no error will
occur.
• Home is defined if the limit signal turns OFF before the homing approach velocity is reached after
the axis reverses or after starting while the limit signal is input.
Differences between Homing Operation Mode 11 and Other Homing Operation Modes
For Homing Operation Mode 11, the MC Function Module detects when the limit signal turns OFF to
define home. It differs from a Homing Operation Mode that uses the home input as an external latch
signal in the following ways.
Make sure that you understand these differences with other Homing Operation Modes before you
use Homing Operation Mode 11.
NY-series Motion Control Instructions Reference Manual (W561)
3-27
3 Axis Command Instructions
• The MC Function Module detects the limit input without an external latch function, such as one
provided by a Servo Drive. MC Function Module processing is the processing performed at the
primary period interval for the primary periodic task and at the task period of the priority-5 periodic
task for the priority-5 periodic task. Therefore, the precision of the home definition will depend on
the homing approach velocity and the control period of the primary periodic task or priority-5 periodic task.
• The axis does not return to the home position. If the homing compensation value is 0, processing
for homing will end with the axis at a different position (i.e., not at home).
• Homing compensation is not performed if the homing compensation value is set to 0. If the homing compensation value is 0, processing for homing ends with the axis at a different position (i.e.,
not at home), as explained above. If the homing compensation value is not 0, then homing compensation is performed with the homing compensation value as a relative position from home in
the same way as for other homing operation modes.
• The home offset is used to change the position of home. If the stop position is offset from home by
distance D, as shown in the following figure, the position after the completion of processing for
homing will be L + D if the home offset is L and the homing compensation value is 0.
Range where negative
limit signal is ON
D
Before home offset: 0
After home offset: L
Range of stopping for remaining pulses
D
L+D
Precautions for Correct Use
• After the OFF limit signal is detected, the limit signal in the opposite direction from the home
input detection direction is ignored while stopping for the remaining pulses until homing compensation is started.
• If the homing compensation value is 0 and the limit input signal in the home input detection
direction turns ON immediately after home is defined, set a homing compensation value to
return past the limit signal input position.
Application Example for Homing Operation Mode 11
If, as shown below, there is not sufficient space to install both a negative limit signal and home signal, you can use the negative limit signal to perform the functions of both the limit signal and home
signal.
Negative limit signal
(home)
Workpiece
Operating direction
Positive limit signal
3-28
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
12: Proximity Reverse Turn/Holding Time Operation
1
The axis starts at the homing velocity. When the home proximity input signal turns ON, the axis
starts decelerating to the homing approach velocity.
Decelerating the axis and monitoring time are started at the same time. The torque limit at the
start of holding differs between OMRON 1S-series as well as G5-series Servo Drives and other
Servo Drives as shown below.
1S-series, G5-series:
Automatically applies torque limits.
Other Servo Drives:
Apply torque limits according to a setting.
2
MC_Home
Refer to Holding Operation for OMRON 1S-series Servo Drives on page 3-32 or Holding Operation for OMRON G5-series Servo Drives on page 3-33 for information on the holding operation.
Home is defined when the set time elapses.
After the home proximity input signal turns ON, its status does not affect operation.
3
Home input detection direction
Function
ON
Home proximity input signal
OFF
Home is defined upon elapse of the set time.
Homing velocity
Homing approach velocity
Command output
Negative direction
Start
Positive direction
Stops.
Homing velocity
Homing approach velocity
Positive direction
Negative direction
Start
Stops.
Homing velocity
Torque limit
Torque limit is continued even after the set time elapses.
Command torque from previous operation
• If you start homing while the home proximity input signal is ON, the operation will start at the homing velocity in the direction opposite to the home input detection direction. After the home proximity input signal turns OFF, the homing operation will start at the homing approach velocity in the
home input detection direction.
• Releasing the torque limit also differs between OMRON 1S-series as well as G5-series Servo
Drives and other Servo Drives.
1S-series, G5-series:
Automatically released when the axis moves in the direction
opposite to homing for the first time after homing.
Other Servo Drives:
If a torque limit is used, release the torque limit when the axis
moves in the direction opposite to homing for the first time after
homing. Use the EC_CoESDOWrite (CoE SDO Write) instruction to change the torque limit.
• An error will not occur and home is defined even if the holding time elapses after the home proximity input signal is detected and before velocity reaches the homing approach velocity.
• Home is also defined if the holding time elapses after the home proximity input signal turns ON
before the homing approach velocity is reached.
NY-series Motion Control Instructions Reference Manual (W561)
3-29
3 Axis Command Instructions
13: No Home Proximity Input/Holding Home Input Operation
1
The axis starts at the homing approach velocity.
The torque limit at the start of holding differs between OMRON 1S-series as well as G5-series
Servo Drives and other Servo Drives as shown below.
1S-series, G5-series:
Automatically applies torque limits.
Other Servo Drives:
A torque limit imposed as required.
Refer to Holding Operation for OMRON 1S-series Servo Drives on page 3-32 or Holding Operation for OMRON G5-series Servo Drives on page 3-33 for information on the holding operation.
2
Home is defined when the home input turns ON.
Home input detection direction
Home input signal
ON
OFF
Command output
Negative direction
Homing approach velocity
Start
Stops.
Positive direction
Torque limit
Command torque from previous operation
• Releasing the torque limit also differs between OMRON 1S-series as well as G5-series Servo
Drives and other Servo Drives.
1S-series, G5-series:
Automatically released when the axis moves in the direction
opposite to homing for the first time after homing.
Other Servo Drives:
If a torque limit is used, release the torque limit when the axis
moves in the direction opposite to homing for the first time after
homing. Use the EC_CoESDOWrite (CoE SDO Write) instruction to change the torque limit.
• Home is also defined if the home input signal turns ON before the homing approach velocity is
reached after homing starts.
Precautions for Correct Use
For an OMRON G5-series Linear Motor Type Servo Drive with built-in EtherCAT communications, the Z-phase input cannot be mapped to a PDO. Therefore, if you use Homing Operation
Mode 13 (no home proximity input/holding home input), which can use a Z-phase input mapped
to a PDO, do not select the Z-phase input for the home input signal.
3-30
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
14: Zero Position Preset Operation
The command current position is set to the home position offset to define home. Also, the following
error between the command current position and the actual position is retained.
Execute
Busy
Done
CommandAborted
MC_Home
Error
ErrorID
16#0000
Homing
3
Homed (Home Defined)
5
0
Actual current position
3
-2
Function
Command current position
z Axis Stopping Method and In-position Check When Homing
The axis is stopped with the following procedure when homing.
1
2
The actual position where the home input signal was detected is latched and the axis stops
immediately.
After the immediate stop, the axis moves with absolute travel in the reverse direction to the position that was latched in step 1.
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
Velocity
Homing velocity
Actual position latch
Immediate stop
Homing approach velocity
Stops.
Homing
compensation
velocity
Homing
compensation value
Start
Absolute travel to position where
home input signal was detected
In-position check applied.
• Waiting for the in-position state is always performed for this instruction regardless of the setting of
the In-position Check Time axis parameter.
Be particularly careful when performing absolute travel to the home input signal detection position
if the In-position Check Time is set to 0 because the instruction will continue waiting for the inposition status. Make sure that the signal is received within the in-position range. In-position waiting is not performed for the homing compensation value operation even if the in-position check
time is set to 0. The status of in-position waiting can be checked with the InPosWaiting (In-position
Waiting) system-defined variable for motion control.
NY-series Motion Control Instructions Reference Manual (W561)
3-31
3 Axis Command Instructions
z Homing Compensation
When you set a homing compensation value, the axis will move by the homing compensation value
after the home input is detected to define home. Adjusting the workpiece is sometimes difficult after
home has been defined in the mechanical system. You can use the homing compensation to finetune the position of home after it is defined. The travel velocity at this time is the homing compensation velocity. The axis starts moving 500 ms after it stopped when the home input was detected.
The sign of the homing compensation value indicates the direction relative to the coordinate axis. If
it is negative, the axis moves in the negative direction.
Home proximity input signal
Home input signal
ON
OFF
ON
OFF
Velocity
Homing
compensation
velocity
Homing velocity
Homing approach velocity
500 ms
Start
Homing
compensation
value
Stops.
z Override Factors
Overrides are disabled for this instruction.
z Automatic Control of Torque Limit
If you are using an OMRON 1S-series Servo Drive or G5-series Servo Drive, and you select either
Proximity Reverse Turn/Holding Time Operation (12) or No Home Proximity Input/Holding Home
Input Operation (13) for the homing operation, the torque limit will be automatically started in the
holding direction.
The torque limit is released when the axis moves in the direction opposite to the home input detection direction.
The torque limit is automatically released at the following times.
• When the Servo is turned OFF (Servo Unlock)
• When the Cyclic Synchronous Position (CSP) Control Mode is changed to another control mode.
During the homing operation, torque limits are released for operation in the direction opposite to the
home input detection direction. For example, if the reversal operation direction at a limit input is in
the direction opposite to the home input detection direction, the torque limit is released when the
reversal operation is completed. If the operation direction reverses again and becomes the home
input detection direction, the torque limit will be enabled again.
z Holding Operation for OMRON 1S-series Servo Drives
Torque limits that are set in the Servo Drive in advance are used for the Proximity Reverse
Turn/Holding Time (12) or No Home Proximity Input/Holding Home Input (13) Homing Operation
Modes to automatically start torque control in the home input detection direction.
Precautions for Correct Use
The automatic torque limit function of the MC_Home instruction is not used for servo drives from
other manufacturers.
Use the MC_SetTorqueLimit instruction, SDO communications, or support software to set suitable values.
3-32
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Additional Information
• The torque limits are continued even after a normal completion of homing.
• The torque limits are automatically released when an instruction that moves the axis in the
opposite direction is executed.
Settings for OMRON 1S-series Servo Drives
• Set the Torque Limit - Switch Selection to 2 to apply a torque limit in the home input detection
direction during the holding operation for homing and to use the torque limit directions and values
that are set with the MC_SetTorqueLimit instruction for other operation.
In that case, the values of the input variables to the MC_SetTorqueLimit instruction are ignored
during the holding operation for homing.
Torque Limit - Switch Selection (3330-01 hex)
2
Positive
Torque Limit
Negative
Torque Limit
Homing
The Torque Limit - Positive Torque
Limit Value 2 (3330-05 hex) for the
Servo Drive is used.
Operations
other than
Homing
The PositiveValue (Positive Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
Homing
The Torque Limit - Negative Torque
Limit Value 2 (3330-06 hex) for the
Servo Drive is used.
Operations
other than
Homing
The NegativeValue (Negative Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
0
The PositiveValue (Positive Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
The NegativeValue (Negative Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
For details on torque limits, refer to MC_SetTorqueLimit on page 3-323.
Also, for details on the settings of 1S-series Servo Drives, refer to the AC Servomotors/Servo Drives
1S-series with Built-in EtherCAT Communications User’s Manual (Cat. No. I586).
z Holding Operation for OMRON G5-series Servo Drives
Torque limits that are set in the Servo Drive in advance are used for the Proximity Reverse
Turn/Holding Time (12) or No Home Proximity Input/Holding Home Input (13) Homing Operation
Modes to automatically start torque control in the home input detection direction.
Precautions for Correct Use
The automatic torque limit function of the MC_Home instruction is not used for servo drives from
other manufacturers. Use the MC_SetTorqueLimit instruction, SDO communications, or support
software to set suitable values.
NY-series Motion Control Instructions Reference Manual (W561)
3-33
3
Function
• If the Torque Limit - Switch Selection is set to 0, the values of the input variables to the MC_SetTorqueLimit instruction are always used. You must set torque limits that are suitable for both for
the holding operation during homing and for other operations.
MC_Home
To use the holding operation, you must set the Torque Limit - Switch Selection (3330-01 hex) for the
1S-series Servo Drive with the Sysmac Studio.
3 Axis Command Instructions
Additional Information
• The torque limits are continued even after a normal completion of homing.
• The torque limits are automatically released when an instruction that moves the axis in the
opposite direction is executed.
Settings for OMRON G5-series Servo Drives
To use the holding operation, you must use the support software of the Servo Drive to set the Torque
Limit Selection (3521 hex) in the G5-series Servo Drive.
• Set the Torque Limit Selection to 6 to apply a torque limit in the home input detection direction
during the holding operation for homing and to use the torque limit directions and values that are
set with the MC_SetTorqueLimit instruction for other operation. In that case, the values of the
input variables to the MC_SetTorqueLimit instruction are ignored during the holding operation for
homing.
• If the Torque Limit Selection is set to 4, the values of the input variables to the MC_SetTorqueLimit
instruction are always used. You must set torque limits that are suitable for both for the holding
operation during homing and for other operations.
Torque Limit Selection (3521 hex)
6 (recommended)
4
Positive Torque
Limit
Homing
Torque Limit 3 (3525 hex) is used.
Operations other
than Homing
The smaller of the PositiveValue
(Positive Torque Limit) for the MC_The smaller of the PositiveValue
(Positive Torque Limit) for the MC_- SetTorqueLimit instruction and
Torque Limit 1 (3013 hex) is used.
SetTorqueLimit instruction and
Torque Limit 1 (3013 hex) is used.
Negative Torque
Limit
Homing
Torque Limit 4 (3526 hex) is used.
Operations other
than Homing
The smaller of the NegativeValue
(Negative Torque Limit) for the
MC_SetTorqueLimit instruction and
Torque Limit 2 (3522 hex) is used.
The smaller of the NegativeValue
(Negative Torque Limit) for the
MC_SetTorqueLimit instruction and
Torque Limit 2 (3522 hex) is used.
For details on torque limits, refer to MC_SetTorqueLimit on page 3-323. For the settings for the G5series Servo Drive, refer to the AC Servomotors/Servo Drives G5-series with Built-in EtherCAT
Communications User’s Manual (Cat. No. I576) or the AC Servomotors/Servo Drives G5-series with
Built-in EtherCAT Communications Linear Motor Type User’s Manual (Cat. No. I577).
z Monitoring Following Error during Holding Operation
The following error is not monitored during the holding operation for homing.
For details on monitoring the following error, refer to the NJ/NX-series CPU Unit Motion Control
User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control
User’s Manual (Cat. No. W559).
3-34
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
The following charts show the timing of homing.
z No Homing Compensation
Execute
Busy
MC_Home
Done
CommandAborted
Error
ErrorID
3
16#0000
Function
Homing
Homed (Home Defined)
Velocity
Time
z With Homing Compensation
Execute
Busy
Done
CommandAborted
Error
ErrorID
16#0000
Homing
Homed (Home Defined)
Velocity
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-35
3 Axis Command Instructions
z Execution When Home Is Defined
Execute
Busy
Done
CommandAborted
Error
ErrorID
16#0000
Homing
Homed (Home Defined)
Velocity
Time
z Execution with Incorrect Parameters or When Motion Control Instructions Are
Disabled
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Error code
Homing
Homed (Home Defined)
Velocity
Time
3-36
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Control Instructions
MC_Home
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Error Codes
3
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
Function
NY-series Motion Control Instructions Reference Manual (W561)
3-37
3 Axis Command Instructions
MC_HomeWithParameter
The MC_HomeWithParameter instruction sets the homing parameter and operates the motor to determine
home. It uses the limit signals, home proximity signal, and home signal.
Instruction
Name
MC_HomeWith Home with
Parameters
Parameter
FB/
FUN
FB
Graphic expression
ST expression
MC_HomeWithParameter_instance
MC_HomeWithParameter
Axis
Axis
HomingParameter
HomingParameter
Done
Execute
Busy
CommandAborted
Error
ErrorID
MC_HomeWithParameter
_instance (
Axis :=parameter,
HomingParameter :=parameter,
Execute :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter,
);
Version Information
A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required
to use this instruction.
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
BOOL
Valid range
TRUE or FALSE
Default
FALSE
Description
The instruction is executed when Execute changes to TRUE.
Output Variables
Name
Done
Busy
CommandAborted
Error
ErrorID
Meaning
Done
Executing
Instruction
Aborted
Error
Error Code
Data type
BOOL
BOOL
BOOL
Valid range
TRUE or FALSE
TRUE or FALSE
TRUE or FALSE
Description
TRUE when the instruction is completed.
TRUE when the instruction is acknowledged.
TRUE when the instruction is aborted.
BOOL
WORD
TRUE or FALSE
*
TRUE while there is an error.
Contains the error code when an error occurs. A
value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-38
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
When the instruction is completed.
Busy
When Execute changes to TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
When there is an error in the execution conditions or
input parameters for the instruction.
Error
Timing for changing to FALSE
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
3
When the error is cleared.
Variables
In-Out Variables
Name
Axis
Axis
Data type
_sAXIS_REF
HomingParameter
Homing Parameter
_sHOMING_REF
Meaning
Valid range
-----
Description
Specify the axis. *1
Set the homing parameter. *2
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Define a user-defined variable with a data type of _sHOMING_REF.
z _sHOMING_REF
Name
Homing
Mode
Meaning
Homing
Method
Data type
_eMC_
HOMING_
MODE
Valid range
0: _mcHomeSwTurn
HomeSwOff
Function
Specify the new setting of the Homing
Method.
1: _mcHomeSwTurn
HomeSwOn
0: Proximity reverse turn/home proximity
input OFF
4:_mcHomeSwOff
5:_mcHomeSwOn
1: Proximity reverse turn/home proximity
input ON
8:_mcLimitInputOff
4: Home proximity input OFF
9:_mcHomeSwTurn
HomeMask
5: Home proximity input ON
11:_mcLimitInputOnly
9: Proximity reverse turn/home input mask
distance
12:_mcHomeSwTurn
HoldingTime
13:_mcNoHomeSw
HoldingHomeInput
14:_mcHomePreset
HomeInput
Home Input
Signal
MC_HomeWithParameter
Done
_eMC_
HOME_
INPUT
0:_mcZPhase
1:_mcExternalSignal
8: Limit input OFF
11: Limit inputs only
12: Proximity reverse turn/holding time
13: No home proximity input/holding home
input
14: Zero position preset
Select the input to use for the home input signal.
0: Use the Z-phase input as home.
1: Use external home input. *1
NY-series Motion Control Instructions Reference Manual (W561)
3-39
3 Axis Command Instructions
Name
StartDir
Meaning
Homing Start
Direction
Data type
_eMC_
DIRECTION
Valid range
0:_mcPositiveDirection
2:_mcNegativeDirection
Function
Set the start direction for when homing is
started.
0:
HomeDir
PosiLmt
Mode
NegaLmt
Mode
Vel
ApproachVel
Acc
Dec
Jerk
Home Input
Detection
Direction
_eMC_
DIRECTION
Operation
Selection at
Positive Limit
Input
_eMC_
LIMIT_
REVERSE_
MODE
Operation
Selection at
Negative
Limit Input
Homing
Velocity
Homing
Approach
Velocity
Homing
Acceleration
0:_mcPositiveDirection
2:_mcNegativeDirection
2: Negative direction
Set the home input detection direction for
homing.
0:
_eMC_
LIMIT_
REVERSE_
MODE
LREAL
0:_mcErrorStop
1:_mcRevImmediateStop
2:_mcRevDeceleration
Stop
0:_mcErrorStop
1:_mcRevImmediateStop
2:_mcRevDeceleration
Stop
Positive number
Positive direction
Positive direction
2: Negative direction
Set the stopping method when the positive
limit input turns ON during homing.
0:
No reverse turn/minor fault stop (Stop
according to Limit Input Stop Method
parameter.)
1:
Reverse turn/immediate stop
2: Reverse turn/deceleration stop
Set the stopping method when the negative
limit input turns ON during homing.
0:
No reverse turn/minor fault stop (Stop
according to Limit Input Stop Method
parameter.)
1:
Reverse turn/immediate stop
2: Reverse turn/deceleration stop
Set the homing velocity.
Set the homing velocity to a value that is less
than the maximum velocity and greater than
or equal to the homing approach velocity.
LREAL
Positive number
The unit is command units/s.*2
Set the velocity to use after the home proximity input turns ON.
Set the homing velocity to a value that is less
than the maximum velocity and greater than
or equal to the homing approach velocity.
LREAL
Non-negative number
The unit is command units/s.*2
Set the acceleration rate for homing.
Set 0 for no acceleration.
Homing
Deceleration
LREAL
Homing Jerk
LREAL
Non-negative number
The unit is command units/s2.*2
Set the deceleration rate for homing.
Set 0 for no deceleration.
Non-negative number
The unit is command units/s2.*2
Set the jerk for homing.
Set 0 for no jerk.
Set the value to within the range of 40-bit
data for pulses.
Mask
Home Input
Mask Distance
LREAL
Non-negative number
The unit is command units/s3.*2
Set the home input mask distance when you
set the Homing Operation Mode to the proximity reverse turn and home input mask distance specification.
The unit is command units.*2
3-40
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Offset
Meaning
Home Offset
Data type
LREAL
Valid range
Negative number, positive
number, or 0
Function
Preset the actual position for the value that is
set after homing.
PushTime
Homing
Holding Time
Compensation Homing
Compensation Value
Homing
Compensation Velocity
LREAL
0 to 10,000
Negative number, positive
number, or 0
The unit is milliseconds.
Set the homing compensation value that is
applied after the home is defined.
In Rotary Mode, set the homing compensation value so that the absolute value of the
homing compensation value is less than the
absolute value of the difference between the
modulo maximum position and modulo minimum position. Also set the value to within the
range of 40-bit data for pulses.
LREAL
Positive number
The unit is command units.*2
Set the velocity to use for homing compensation.
Set the value to less than the maximum
velocity.
The unit is command units/s.*2
*1 This setting can be used for an OMRON 1S-series Servo Drive and G5-series Servo Drive. The input allocated to latch 1
for the Servo Drive is used as the external home input. In the default setting of the OMRON 1S-series Servo Drives and
G5-series Servo Drives, the external latch input 1 is allocated to latch 1.
For details, refer to the AC Servomotors/Servo Drives 1S-series with Built-in EtherCAT Communications User’s Manual
(Cat. No. I586), AC Servomotors/Servo Drives G5-series with Built-in EtherCAT Communications User’s Manual (Cat. No.
I576) or the AC Servomotors/Servo Drives G5-series with Built-in EtherCAT Communications Linear Motor Type User’s
Manual (Cat. No. I577).
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
Function
• Homing starts when Execute changes to TRUE for the axis specified in Axis.
• Set the parameters used by the HomeWithParameter instruction in the HomingParameter in-out variable.
• The axis parameters are not changed when this instruction is executed.
• The only difference between this instruction and the MC_Home instruction is how the parameters are
set. For this instruction, the parameters are set in the HomingParameter in-out variable. For the
MC_Home instruction, the parameters are set in the Homing Settings of the axis parameters in the
Sysmac Studio.
Refer to MC_Home on page 3-16 for all instruction specifications except for how to set the parameters.
Precautions for Correct Use
The homing parameters that are set in this instruction are valid only when this instruction is executed. If you execute the MC_Home instruction after this instruction, operation will be based on
the homing parameters that are set in the axis parameters.
NY-series Motion Control Instructions Reference Manual (W561)
3-41
3
Function
CompensationVel
UINT
The unit is command units.*2
Set the holding time when you set the Homing Operation Mode to the proximity reverse
turn/holding time.
MC_HomeWithParameter
In Rotary Mode, set the Home Offset parameter so that it is greater than or equal to the
modulo minimum position and less than the
modulo maximum position. Also set the value
to within the range of 40-bit data for pulses.
3 Axis Command Instructions
Relationship between the Homing Method and Homing Parameters
Some of the homing parameters are not used depending on the setting of the homing method. Range
and consistency checks are not performed for the parameters that are not used. Range and consistency checks are performed when the instruction is executed.
The following table shows the homing parameters that are used for each homing method.
(Yes: Parameter is used, No: Parameter is not used.)
Homing parameter
Home Input Signal
Homing Start Direction
Home Input Detection Direction
Operation Selection at Positive Limit Input
Operation Selection at Negative Limit Input
Homing Velocity
Homing Approach Velocity
Homing Acceleration
Homing Deceleration
Homing Jerk
Home Input Mask Distance
Home Offset
Homing Holding Time
Homing Compensation Value
Homing Compensation Velocity
Proximity reverse turn/home
proximity input OFF
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Proximity reverse turn/home
proximity input ON
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Home proximity input OFF
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Home proximity input ON
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Limit input OFF
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Proximity reverse turn/home
input mask distance
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Limit inputs only
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Proximity reverse turn/holding time
No
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
Yes
Yes
Yes
No home proximity
input/holding home input
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
Yes
No
Yes
Yes
Zero position preset
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
Homing method
Additional Information
If you use NX-series Position Interface Units, do not select holding for the Homing Operation
Mode. Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for details.
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
3-42
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Multi-execution of Motion Control Instructions
For details on multi-execution of instructions, refer to the NJ/NX-series CPU Unit Motion Control User’s
Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s
Manual (Cat. No. W559).
MC_HomeWithParameter
Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3
Function
NY-series Motion Control Instructions Reference Manual (W561)
3-43
3 Axis Command Instructions
MC_Move
The MC_Move instruction performs absolute positioning or relative positioning.
Instruction
MC_Move
Name
FB/FUN
Positioning
FB
Graphic expression
ST expression
MC_Move_instance
MC_Move
Axis
Execute
Position
Velocity
Acceleration
Deceleration
Jerk
Direction
BufferMode
MoveMode
Axis
Done
Busy
Active
Command Aborted
Error
ErrorID
MC_Move_instance (
Axis :=parameter,
Execute :=parameter,
Position :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
Direction :=parameter,
BufferMode :=parameter,
MoveMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Position
Target Position
LREAL
Negative number, positive number, or 0
0
Specify the target position in
absolute coordinates when
you specify absolute positioning as the Travel Mode.
Specify the relative position
when you specify relative
positioning as the Travel
Mode. The unit is command
units.*1
Velocity
Target Veloc- LREAL
ity
Positive number
0
Specify the target velocity.*2
The unit is command
units/s.*1
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command
units/s2.*1
Deceleration
Deceleration Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command
units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is
command units/s3.*1
3-44
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Direction
Meaning
Direction
Data type
Valid range
_eMC_DIRECTION
0: _mcPositiveDirection
1: _mcShortestWay
2: _mcNegativeDirection
3: _mcCurrentDirection
4: _mcNoDirection
Default
0*3
Description
Specify the direction of rotation when MoveMode is set
to absolute positioning*4 and
when the Count Mode is
Rotary Mode.
0: Positive direction
1: Shortest way
2: Negative direction
3: Current direction
4: No direction specified
Travel Mode
_eMC_BUFFER
_ MODE
_eMC_MOVE_
MODE
0: _mcAborting
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
4: _mcBlendingNext
5: _mcBlendingHigh
0*3
0: _mcAbsolute
1: _mcRelative
0*3
Specifies the operation when
executing more than one
motion instruction.
0: Aborting
1: Buffered
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
3
Select the travel method.
0: Absolute positioning
1: Relative positioning
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Always set the target velocity. A Target Velocity Setting Out of Range error (error code: 5422 hex) occurs when the
instruction is executed if the target velocity is not set.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
*4 When MoveMode is set to relative positioning, the travel direction is determined by the sign of the position.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-45
Variables
MoveMode
Buffer Mode
Selection
MC_Move
BufferMode
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When the axis decelerates to a stop and the
velocity reaches 0.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• You can use the MC_Move instruction to perform absolute positioning or relative positioning.
• If you specify absolute positioning for MoveMode (Travel Mode), the operation is the same as for the
MC_MoveAbsolute (Absolute Positioning) instruction. If you specify relative positioning for MoveMode (Travel Mode), the operation is the same as the MC_MoveRelative (Relative Positioning)
instruction.
• If relative positioning is used, Direction is not used.
• For details, refer to MC_MoveAbsolute on page 3-49 or MC_MoveRelative on page 3-76.
Instruction Details
This section describes the instruction in detail.
3-46
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
When you perform absolute positioning, set the target position so that the settings of the Modulo
Maximum Position Setting Value and Modulo Minimum Position Setting Value axis parameters
are not exceeded. If the target position is set outside of the settings of the Modulo Maximum
Position Setting Value and Modulo Minimum Position Setting Value axis parameters, a Target
Position Setting Out of Range error (error code 5478 hex) will occur.
z In-position Check
MC_Move
An in-position check is performed for this instruction according to the settings in In-position Range
and In-position Check Time axis parameters.
Re-execution of Motion Control Instructions
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis. Specify the operation of this instruction
with BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion will be
reversed according to the Operation Selection at Reversing axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current instruction is
completed.
Blending
Starts the buffered instruction at the velocity (transit velocity) at which the current
instruction reaches the target position. The operation of the current instruction is
changed so that the axes reach the target position at the transit velocity. There are
four methods to specify the transit velocity. These are described below.
Blending low
The lower of the target velocities of the current instruction and the buffered instruction is used as the transit velocity.
Blending previous
The target velocity of the current instruction is used as the transit velocity.
Blending next
The target velocity of the buffered instruction is used as the transit velocity.
Blending high
The higher of the target velocities of the current instruction and the buffered instruction is used as the transit velocity.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
NY-series Motion Control Instructions Reference Manual (W561)
3-47
3
Function
You can change the operation of the instruction if you change an input variable during positioning and
change Execute to TRUE again. Input variables Position (Target Position), Velocity (Target Velocity),
Acceleration (Acceleration Rate), and Deceleration (Deceleration Rate) can be changed by re-executing the motion control instruction. For details on re-execution of motion control instructions, refer to the
NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC
/ Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
3 Axis Command Instructions
z Execution of Other Instructions during Instruction Execution
If you execute another instruction during execution of this instruction, you can specify aborting, buffering, or blending.
Errors
z Timing Chart When Error Occurs
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-48
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_MoveAbsolute
The MC_MoveAbsolute instruction moves the axis to a specified absolute target position.
Instruction
FB/
FUN
Name
Absolute
Positioning
FB
MC_MoveAbsolute_instance
MC_MoveAbsolute_instance (
Axis :=parameter,
Execute :=parameter,
Position :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
Direction :=parameter,
BufferMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveAbsolute
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
CommandAborted
Acceleration
Error
Deceleration
Jerk
ErrorID
Direction
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Position
Target
Position
LREAL
Negative number, positive number, or 0
0
Specify the absolute target position. The unit is command
units.*1
Velocity
Target
Velocity
LREAL
Positive number
0
Specify the target velocity.*2 The
unit is command units/s.*1
Acceleration
Acceleration Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command units/s2.*1
Deceleration
Deceleration Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is command units/s3.*1
NY-series Motion Control Instructions Reference Manual (W561)
3-49
3
Variables
ST expression
MC_MoveAbsolute
MC_MoveAbsolute
Graphic expression
3 Axis Command Instructions
Name
Direction
Meaning
Direction
BufferMode
Data type
_eMC_
DIRECTION
Buffer Mode
Selection
_eMC_BUFFER_
MODE
Valid range
Default
0: _mcPositiveDirection
1: _mcShortestWay
2: _mcNegativeDirection
3: _mcCurrentDirection
4: _mcNoDirection
0*3
0: _mcAborting
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
4: _mcBlendingNext
5: _mcBlendingHigh
0*3
Description
Specify the direction of rotation
when the Count Mode is Rotary
Mode.
0: Positive direction
1: Shortest way
2: Negative direction
3: Current direction
4: No direction specified
Specify the behavior when executing more than one motion
instruction.
0: Aborting
1: Buffered
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Always set the target velocity. If the axis is moved without setting a target velocity, an error will occur.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
3-50
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Timing for changing to TRUE
Timing for changing to FALSE
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
MC_MoveAbsolute
CommandAborted
In-Out Variables
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Function
Name
3
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The absolute target position is specified to perform positioning.
• Absolute positioning starts when Execute changes to TRUE.
• You can execute this instruction even if home is not defined.
• You can specify the Velocity (Target Velocity), Acceleration (Acceleration Rate), Deceleration (Deceleration Rate), and Jerk as input variables.
The following chart shows an operation example of absolute positioning.
Velocity
Target
velocity Acceleration
0 Command current
position
Deceleration
Target distance
Time
When the Acceleration (Acceleration Rate) or Deceleration (Deceleration Rate) is 0 and the instruction
is executed, the axis will reach the target velocity without accelerating or decelerating.
The following chart shows an operation example of when the acceleration rate is 0.
Velocity
Target
velocity
0
Deceleration
Command current
position
Target position
NY-series Motion Control Instructions Reference Manual (W561)
Time
3-51
3 Axis Command Instructions
Specify Jerk when you want to accelerate or decelerate smoothly. The following chart shows an operation example when Jerk is specified.
Velocity
Target
velocity
0 Command current
position
Time
Target position
For details on Jerk, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507)
or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
When the positioning is started with Position (Target Position) set to the command current position, the
axis will not move but Done will change to TRUE.
Instruction Details
This section describes the instruction in detail.
z Direction
Direction specifies the direction for starting positioning when the Count Mode is Rotary Mode. Direction is not used if the Count Mode is Linear Mode. Positioning starts in the positive direction towards
the target position when the positive direction is specified for Direction. The following chart shows an
operation example when positioning starts with a command position of 50 and moves toward −20.
Modulo maximum
position setting
value: 100
0
Modulo minimum
position setting
value: −70
3-52
Command current
position: 50
Target position:
−20
Target position:
−20
Moves in positive direction.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Positioning starts in the negative direction towards the target position when the negative direction is
specified for Direction. The following chart shows an operation example when positioning starts with
a command position of 50 and moves toward −20.
Modulo maximum
position setting
value: 100
Command current
position: 50
MC_MoveAbsolute
Target position:
−20
Target position:
−20
0
Modulo minimum
position setting
value: −70
Moves in negative direction.
3
The following chart shows an operation example when positioning starts with a command position of
50 and moves toward −20.
Modulo maximum
position setting
value: 100
0
Modulo minimum
position setting
value: −70
Command current
position: 50
Target position:
−20
Target position:
−20
Moves towards the ring
counter range.
NY-series Motion Control Instructions Reference Manual (W561)
3-53
Function
Positioning starts towards the target position within the ring counter range when No direction is
specified for Direction. Therefore, the size relationship between the command current position and
the target position determines the direction of travel.
3 Axis Command Instructions
When No direction is specified for Direction, you can specify a Position (Target Position) outside the
range specified by the modulo maximum position and modulo minimum position setting values.
When Position (Target Position) is outside the range specified by the modulo maximum position and
modulo minimum position setting values, positioning is performed using the travel distance exceeding the modulo maximum position setting value as a relative distance. This allows positioning of multiple ring rotations. Positioning is the same when Position (Target Position) is below the modulo
minimum position setting value as well. The following chart shows an operation example for when
the command current position is −20 and Position (Target Position) is 290.
Modulo maximum
position setting
value: 100
0
Command
current position:
−20
Position after
positioning: −50
Modulo minimum
position setting
value: −70
190
Performs relative positioning with the target distance as
(290 (Target position) − 100 (Upper limit)) = 190.
When the shortest way is specified for Direction, positioning starts in the direction with the shortest
distance between the command current position and the target position. The following chart shows
an operation example when positioning starts with a command position of 50 and moves toward
−20.
Modulo maximum
position setting
value: 100
0
Modulo minimum
position setting
value: −70
Command current
position: 50
Target position:
−20
Target position:
−20
Moves in the direction with
the shortest travel distance.
Movement is in the same direction as the current direction if the travel distance is the same in the
positive and the negative direction.
3-54
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
• If the current direction is specified for Direction, operation is in the same command direction as
the previous motion. Therefore, depending on the instructions that are used together, the
direction may not be the same as the direction that was specified with the input to the motion
control instruction for the previous motion. When you specify the current direction, check the
current direction with Dir.Posi (Positive Direction) and Dir.Nega (Negative Direction) in the Axis
Variable.
An in-position check is performed for this instruction according to the settings in In-position Range
and In-position Check Time axis parameters.
NY-series Motion Control Instructions Reference Manual (W561)
3-55
3
Function
z In-position Check
MC_MoveAbsolute
• When you perform absolute positioning, set the target position so that it is less than the Modulo Maximum Position Setting Value axis parameter and greater than or equal to the Modulo
Minimum Position Setting Value axis parameter. If the target position is greater than or equal to
the setting of the Modulo Maximum Position Setting Value axis parameter or less than the setting of the Modulo Minimum Position Setting Value axis parameter, a Target Position Setting
Out of Range error (error code 5478 hex) will occur. However, when No direction is specified
for Direction, you can specify a Position (Target Position) outside the range specified by the
modulo maximum position and modulo minimum position setting values.
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• Done changes to TRUE when Position (Target Position) is reached and positioning is completed.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing) and Active (Controlling) change to FALSE.
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Multi-execution of
another instruction
Velocity
Time
Re-execution of Motion Control Instructions
You can change the operation of the instruction if you change an input variable during positioning and
change Execute to TRUE again. Input variables Position (Target Position), Velocity (Target Velocity),
Acceleration (Acceleration Rate), and Deceleration (Deceleration Rate) can be changed by re-executing the motion control instruction. For details on re-execution of motion control instructions, refer to the
NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC
/ Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
3-56
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis. Specify the operation of this instruction
using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the
motion will be reversed according to the Operation Selection at Reversing
axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current
instruction is completed.
Blending
Starts the buffered instruction at the velocity (transit velocity) at which the
current instruction reaches the target position. The operation of the current
instruction is changed so that the axes reach the target position at the transit velocity. There are four methods to specify the transit velocity. These are
described below.
The lower of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
Blending previous
The target velocity of the current instruction is used as the transit velocity.
Blending next
The target velocity of the buffered instruction is used as the transit velocity.
Blending high
The higher of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
If you execute another instruction during execution of this instruction, you can specify aborting, buffering, or blending.
NY-series Motion Control Instructions Reference Manual (W561)
3-57
3
Function
Blending low
MC_MoveAbsolute
Aborting
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-58
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Sample Programming 1
This section shows sample programming for positioning by periodic multi-execution of instructions.
Parameter Settings
MC_MoveAbsolute
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Type
Axis
Axis Type
Axis 1
Servo axis
3
Count Mode
Sample Programming 1
Axis
Count Mode
Axis 1
Linear Mode
Unit of Display
Axis
Unit of Display
Axis 1
mm
Operation Example
In this sample, BufferMode (Buffer Mode Selection) is set to Buffered for MC_MoveAbsolute (Absolute
Positioning) instructions and the axis is moved to the final target position by executing multiple instructions.
When the axis reaches the final target position, it is returned to home with the MC_ZeroPosition (Highspeed Home) instruction.
Multi-execution of instructions is performed when the Active (Controlling) output variable from the previous instruction is TRUE. For single-axis operation, multi-execution is possible for only one instruction.
z Operation Pattern
Multi-execution of
instructions
Operation started.
Multi-execution of
instructions
Operation started.
Multi-execution of
instructions
Operation started.
Operation started.
Velocity (mm/s)
30.00
20.00
10.00
0
(3)
(2)
(1)
50.00
100.00
Positive direction
200.00 Axis 1 (mm)
(4)
250.00
High-speed Home instruction executed.
NY-series Motion Control Instructions Reference Manual (W561)
3-59
3 Axis Command Instructions
1
Turning ON the Operation Start Switch
When you turn ON the operation start switch at home, axis 1 is positioned to 50.00 mm in the
positive direction.
2
Turning ON the Operation Start Switch Again
Thereafter, axis 1 is positioned to 100.00 mm and 200.00 mm, and then returns to home and
stops. The operation start switch must be turned ON once for each of these motions.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
StartPg
BOOL
FALSE
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
z Timing Chart
Pwr_Status
Hm_D
Hm_Bsy
Mv_Abs1_D
Mv_Abs1_Bsy
Mv_Abs1_Act
Mv_Abs2_D
Mv_Abs2_Bsy
Mv_Abs2_Act
Mv_Abs3_D
Mv_Abs3_Bsy
Mv_Abs3_Act
Mv_Zero_D
Mv_Zero_Bsy
Mv_Zero_Act
3-60
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
If process data communications are active, the Servo is turned ON.
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
3
If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
EN
FaultHandler
FaultHandler
If the Servo is ON and home is not defined, the Home instruction is executed.
HM
MC_Home
Pwr_Status MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm_D
Hm_Bsy
Hm_Ca
Hm_Err
Hm_ErrID
After home is defined, absolute positioning 1 is started.
MV_ABS1
MC_MoveAbsolute
Hm_D
MC_Axis000
LREAL#50.0
LREAL#10.0
LREAL#1000.0
LREAL#1000.0
_eMC_DIRECTION#_mcNoDirection
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
Jerk
ErrorID
Direction
BufferMode
Mv_Abs1_D
Mv_Abs1_Bsy
Mv_Abs1_Act
Mv_Abs1_Ca
Mv_Abs1_Err
Mv_Abs1_ErrID
After absolute positioning 1 is started, absolute positioning 2 is started with multi-execution of instructions.
MV_ABS2
Mv_Abs1_Act
MC_Axis000
LREAL#100.0
LREAL#20.0
LREAL#1000.0
LREAL#1000.0
_eMC_DIRECTION#_mcNoDirection
_eMC_BUFFER_MODE#_mcBuffered
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveAbsolute
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
Jerk
ErrorID
Direction
BufferMode
Mv_Abs2_D
Mv_Abs2_Bsy
Mv_Abs2_Act
Mv_Abs2_Ca
Mv_Abs2_Err
Mv_Abs2_ErrID
3-61
Sample Programming 1
MC_Axis000.MFaultLvl.Active
MC_MoveAbsolute
PWR
MC_Power
3 Axis Command Instructions
After absolute positioning 2 is started, absolute positioning 3 is started with multi-execution of instructions.
MV_ABS3
MC_MoveAbsolute
MC_Axis000
Mv_Abs2_Act
LREAL#200.0
LREAL#30.0
LREAL#1000.0
LREAL#1000.0
_eMC_DIRECTION#_mcNoDirection
_eMC_BUFFER_MODE#_mcBuffered
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
ErrorID
Jerk
Direction
BufferMode
Mv_Abs3_D
Mv_Abs3_Bsy
Mv_Abs3_Act
Mv_Abs3_Ca
Mv_Abs3_Err
Mv_Abs3_ErrID
After absolute positioning 3 is started, the High-speed Home instruction is executed.
MV_ZERO
MC_MoveZeroPosition
MC_Axis000
Mv_Abs3_Act
LREAL#250.0
LREAL#1000.0
LREAL#1000.0
_eMC_BUFFER_MODE#_mcBuffered
Axis
Axis
Execute
Done
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Error
Jerk
BufferMode
ErrorID
Mv_Zero_D
Mv_Zero_Bsy
Mv_Zero_Act
Mv_Zero_Ca
Mv_Zero_Err
Mv_Zero_ErrID
Structured Text (ST)
z Main Variables
Name
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
StartPg
BOOL
FALSE
Hm_Ex
BOOL
FALSE
Mv_Abs1_Ex
BOOL
FALSE
Mv_Abs2_Ex
BOOL
FALSE
Mv_Abs3_Ex
BOOL
FALSE
Mv_Zero_Ex
BOOL
FALSE
InitFlag
BOOL
FALSE
MC_Axis000
MC_Axis000.MFaultLvl.Active
3-62
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
The HM instance of MC_Home is executed when
this variable changes to TRUE.
The MV_ABS1 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ABS2 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ABS3 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ZERO instance of MC_MoveZeroPosition is executed when this variable changes to
TRUE.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Pwr_Status
Hm_Ex
Hm_D
Hm_Bsy
Mv_Abs1_Ex
MC_MoveAbsolute
Mv_Abs1_D
Mv_Abs1_Bsy
Mv_Abs1_Act
Mv_Abs2_Ex
Mv_Abs2_D
Mv_Abs2_Bsy
3
Mv_Abs2_Act
Sample Programming 1
Mv_Abs3_Ex
Mv_Abs3_D
Mv_Abs3_Bsy
Mv_Abs3_Act
Mv_Zero_Ex
Mv_Zero_D
Mv_Zero_Bsy
Mv_Zero_Act
z Sample Programming
// Processing when input parameters are not set
IF InitFlag = FALSE THEN
// MV_ABS1 parameters
Mv_Abs1_Pos := LREAL#50.0;
Mv_Abs1_Vel
:= LREAL#10.0;
Mv_Abs1_Acc := LREAL#1000.0;
Mv_Abs1_Dec := LREAL#1000.0;
Mv_Abs1_Dir
:= _eMC_DIRECTION#_mcNoDirection;
// MV_ABS2 parameters
Mv_Abs2_Pos := LREAL#100.0;
Mv_Abs2_Vel
:= LREAL#20.0;
Mv_Abs2_Acc := LREAL#1000.0;
Mv_Abs2_Dec := LREAL#1000.0;
Mv_Abs2_Dir
:= _eMC_DIRECTION#_mcNoDirection;
Mv_Abs2_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
// MV_ABS3 parameters
Mv_Abs3_Pos := LREAL#200.0;
Mv_Abs3_Vel
:= LREAL#30.0;
Mv_Abs3_Acc := LREAL#1000.0;
Mv_Abs3_Dec := LREAL#1000.0;
Mv_Abs3_Dir
:= _eMC_DIRECTION#_mcNoDirection;
Mv_Abs3_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
// MV_ZERO parameters
Mv_Zero_Vel
:= LREAL#250;
Mv_Zero_Acc
:= LREAL#1000.0;
NY-series Motion Control Instructions Reference Manual (W561)
3-63
3 Axis Command Instructions
Mv_Zero_Dec
Mv_Zero_Bm
:= LREAL#1000.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo is turned ON.
// If EtherCAT communications are not normal, 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
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
// If the Servo is ON and home is not defined, the Home instruction is executed.
IF (Pwr_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm_Ex:=TRUE;
END_IF;
// After home is defined, MV_ABS1 is executed.
IF Hm_D=TRUE THEN
Mv_Abs1_Ex:=TRUE;
END_IF;
// After MV_ABS1 is started, MV_ABS2 is executed with multi-execution of instructions.
IF Mv_Abs1_Act=TRUE THEN
Mv_Abs2_Ex:=TRUE;
END_IF;
// After MV_ABS2 is started, MV_ABS3 is executed with multi-execution of instructions.
IF Mv_Abs2_Act=TRUE THEN
Mv_Abs3_Ex:=TRUE;
END_IF;
// After MV_ABS3 is started, MV_ZERO is executed with multi-execution of instructions.
IF Mv_Abs3_Act=TRUE THEN
Mv_Zero_Ex:=TRUE;
END_IF;
3-64
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
//MC_Power
PWR(
Axis
Enable
Status
Busy
Error
ErrorID
);
:= MC_Axis000,
:= Pwr_En,
=> Pwr_Status,
=> Pwr_Bsy,
=> Pwr_Err,
=> Pwr_ErrID
MV_ABS2(
Axis
Execute
Position
Velocity
Acceleration
Deceleration
Direction
BufferMode
Done
Busy
Active
CommandAborted
Error
ErrorID
);
MV_ABS3(
Axis
Execute
Position
Velocity
Acceleration
:= MC_Axis000,
:= Hm_Ex,
=> Hm_D,
=> Hm_Bsy,
=> Hm_Ca,
=> Hm_Err,
=> Hm_ErrID
3
Sample Programming 1
//MC_MoveAbsolute
MV_ABS1(
Axis
Execute
Position
Velocity
Acceleration
Deceleration
Direction
Done
Busy
Active
CommandAborted
Error
ErrorID
);
MC_MoveAbsolute
//MC_Home
HM(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= Mv_Abs1_Ex,
:= Mv_Abs1_Pos,
:= Mv_Abs1_Vel,
:= Mv_Abs1_Acc,
:= Mv_Abs1_Dec,
:= Mv_Abs1_Dir,
=> Mv_Abs1_D,
=> Mv_Abs1_Bsy,
=> Mv_Abs1_Act,
=> Mv_Abs1_Ca,
=> Mv_Abs1_Err,
=> Mv_Abs1_ErrID
:= MC_Axis000,
:= Mv_Abs2_Ex,
:= Mv_Abs2_Pos,
:= Mv_Abs2_Vel,
:= Mv_Abs2_Acc,
:= Mv_Abs2_Dec,
:= Mv_Abs2_Dir,
:= Mv_Abs2_Bm,
=> Mv_Abs2_D,
=> Mv_Abs2_Bsy,
=> Mv_Abs2_Act,
=> Mv_Abs2_Ca,
=> Mv_Abs2_Err,
=> Mv_Abs2_ErrID
:= MC_Axis000,
:= Mv_Abs3_Ex,
:= Mv_Abs3_Pos,
:= Mv_Abs3_Vel,
:= Mv_Abs3_Acc,
NY-series Motion Control Instructions Reference Manual (W561)
3-65
3 Axis Command Instructions
Deceleration
Direction
BufferMode
Done
Busy
Active
CommandAborted
Error
ErrorID
:= Mv_Abs3_Dec,
:= Mv_Abs3_Dir,
:= Mv_Abs3_Bm,
=> Mv_Abs3_D,
=> Mv_Abs3_Bsy,
=> Mv_Abs3_Act,
=> Mv_Abs3_Ca,
=> Mv_Abs3_Err,
=> Mv_Abs3_ErrID
);
//MC_MoveZeroPosition
MV_ZERO(
Axis
Execute
Velocity
Acceleration
Deceleration
BufferMode
Done
Busy
Active
CommandAborted
Error
ErrorID
);
3-66
:= MC_Axis000,
:= Mv_Zero_Ex,
:= Mv_Zero_Vel,
:= Mv_Zero_Acc,
:= Mv_Zero_Dec,
:= Mv_Zero_Bm,
=> Mv_Zero_D,
=> Mv_Zero_Bsy,
=> Mv_Zero_Act,
=> Mv_Zero_Ca,
=> Mv_Zero_Err,
=> Mv_Zero_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Sample Programming 2
In this sample, when the Count Mode is set to Rotary Mode and positioning is performed toward the target position, the shortest direction, clockwise or counterclockwise, is automatically determined and
positioning is performed.
This section shows sample programming for shortest-way control of the rotation direction of a tool
changer.
MC_MoveAbsolute
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Type
3
Axis
Axis Type
Servo axis
Sample Programming 2
Axis 1
Count Mode
Axis
Count Mode
Axis 1
Rotary Mode
Ring Counter
Modulo maximum
position
Axis
Axis 1
360
Modulo minimum
position
0
Unit of Display
Axis
Axis 1
Unit of Display
degree
Operation Example
In this sample, multi-execution of absolute positioning instructions is used to position in a range of 0° to
360°. The actual position returns to 0° once it exceeds the range of 0° to 360°.
Multi-execution of instructions is performed when the Active (Controlling) output variable from the previous instruction is TRUE. For single-axis operation, multi-execution is possible for only one instruction.
In this sample, multi-execution of instructions is executed with BufferMode (Buffer Mode Selection) set
to Buffered.
290° 300°
0°
360°
90°
180°
120°
Shortest-way positioning is performed.
NY-series Motion Control Instructions Reference Manual (W561)
3-67
3 Axis Command Instructions
If you specify 0° (home), 90°, 120°, or 290°, the axis will move to that position. The rotation direction
in this instance is in the shorter rotation direction. The travel velocity is 250°/s.
The sample programming performs positioning with a shortest way specification from 290° to 90° to
120° and then to home (0°).
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
StartPg
BOOL
FALSE
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
z Timing Chart
Pwr_Status
Hm_D
Hm_Bsy
Mv_Abs1_D
Mv_Abs1_Bsy
Mv_Abs1_Act
Mv_Abs2_D
Mv_Abs2_Bsy
Mv_Abs2_Act
Mv_Abs3_D
Mv_Abs3_Bsy
Mv_Abs3_Act
Mv_Abs4_D
Mv_Abs4_Bsy
Mv_Abs4_Act
Command velocity
MC_Axis000
Time
3-68
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
If process data communications are active, the Servo is turned ON.
Lock1
MC_Axis000
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
3
If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
EN
NY-series Motion Control Instructions Reference Manual (W561)
FaultHandler
FaultHandler
Sample Programming 2
MC_Axis000.MFaultLvl.Active
MC_MoveAbsolute
PWR
MC_Power
3-69
3 Axis Command Instructions
If the Servo is ON and home is not defined, the Home instruction is executed.
HM
MC_Home
Pwr_Status MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm_D
Hm_Bsy
Hm_Ca
Hm_Err
Hm_ErrID
After home is defined, absolute positioning 1 is executed to move to 290.0°.
The shortest way is specified for the motion direction.
MV_ABS1
Hm_D
MC_Axis000
LREAL#290.0
LREAL#250.0
LREAL#1000.0
LREAL#1000.0
_eMC_DIRECTION#_mcShortestWay
MC_MoveAbsolute
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
Jerk
ErrorID
Direction
BufferMode
Mv_Abs1_D
Mv_Abs1_Bsy
Mv_Abs1_Act
Mv_Abs1_Ca
Mv_Abs1_Err
Mv_Abs1_ErrID
Absolute positioning 2 is executed with multi-execution of instructions to move from 290.0° to 90.0°.
The shortest way is used for the motion direction.
MV_ABS2
MC_MoveAbsolute
Mv_Abs1_Act
MC_Axis000
LREAL#90.0
LREAL#250.0
LREAL#1000.0
LREAL#1000.0
_eMC_DIRECTION#_mcShortestWay
_eMC_BUFFER_MODE#_mcBuffered
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
ErrorID
Jerk
Direction
BufferMode
Mv_Abs2_D
Mv_Abs2_Bsy
Mv_Abs2_Act
Mv_Abs2_Ca
Mv_Abs2_Err
Mv_Abs2_ErrID
Absolute positioning 3 is executed with multi-execution of instructions to move from 90.0° to 120.0°.
The shortest way is used for the motion direction.
MV_ABS3
MC_MoveAbsolute
Mv_Abs2_Act
MC_Axis000
LREAL#120.0
LREAL#250.0
LREAL#1000.0
LREAL#1000.0
_eMC_DIRECTION#_mcShortestWay
_eMC_BUFFER_MODE#_mcBuffered
3-70
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
Jerk
ErrorID
Direction
BufferMode
Mv_Abs3_D
Mv_Abs3_Bsy
Mv_Abs3_Act
Mv_Abs3_Ca
Mv_Abs3_Err
Mv_Abs3_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Absolute positioning 4 is executed with multi-execution of instructions to move from 120.0° to 0.0°.
The shortest way is used for the motion direction.
MV_ABS4
MC_MoveAbsolute
MC_Axis000
Mv_Abs3_Act
_eMC_DIRECTION#_mcShortestWay
_eMC_BUFFER_MODE#_mcBuffered
Mv_Abs4_D
Mv_Abs4_Bsy
Mv_Abs4_Act
Mv_Abs4_Ca
Mv_Abs4_Err
Mv_Abs4_ErrID
MC_MoveAbsolute
LREAL#0.0
LREAL#250.0
LREAL#1000.0
LREAL#1000.0
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
ErrorID
Jerk
Direction
BufferMode
Structured Text (ST)
3
z Main Variables
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
StartPg
BOOL
FALSE
Hm_Ex
BOOL
FALSE
Mv_Abs1_Ex
BOOL
FALSE
Mv_Abs2_Ex
BOOL
FALSE
Mv_Abs3_Ex
BOOL
FALSE
Mv_Abs4_Ex
BOOL
FALSE
InitFlag
BOOL
FALSE
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
The HM instance of MC_Home is executed when
this variable changes to TRUE.
The MV_ABS1 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ABS2 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ABS3 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ABS4 instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
3-71
Sample Programming 2
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
3 Axis Command Instructions
z Timing Chart
Pwr_Status
Hm_Ex
Hm_D
Hm_Bsy
Mv_Abs1_Ex
Mv_Abs1_D
Mv_Abs1_Bsy
Mv_Abs1_Act
Mv_Abs2_Ex
Mv_Abs2_D
Mv_Abs2_Bsy
Mv_Abs2_Act
Mv_Abs3_Ex
Mv_Abs3_D
Mv_Abs3_Bsy
Mv_Abs3_Act
Mv_Abs4_Ex
Mv_Abs4_D
Mv_Abs4_Bsy
Mv_Abs4_Act
Command velocity
MC_Axis000
Time
z Sample Programming
// Processing when input parameters are not set
IF InitFlag = FALSE THEN
// MV_ABS1 parameters
Mv_Abs1_Pos := LREAL#290.0;
Mv_Abs1_Vel
:= LREAL#250.0;
Mv_Abs1_Acc := LREAL#1000.0;
Mv_Abs1_Dec := LREAL#1000.0;
Mv_Abs1_Dir
:= _eMC_DIRECTION#_mcShortestWay;
// MV_ABS2 parameters
Mv_Abs2_Pos := LREAL#90.0;
Mv_Abs2_Vel
:= LREAL#250.0;
Mv_Abs2_Acc := LREAL#1000.0;
Mv_Abs2_Dec := LREAL#1000.0;
Mv_Abs2_Dir
:= _eMC_DIRECTION#_mcShortestWay;
Mv_Abs2_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
// MV_ABS3 parameters
3-72
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Mv_Abs3_Pos
Mv_Abs3_Vel
Mv_Abs3_Acc
Mv_Abs3_Dec
Mv_Abs3_Dir
Mv_Abs3_Bm
:= LREAL#120.0;
:= LREAL#250.0;
:= LREAL#1000.0;
:= LREAL#1000.0;
:= _eMC_DIRECTION#_mcShortestWay;
:= _eMC_BUFFER_MODE#_mcBuffered;
MC_MoveAbsolute
// MV_ABS4 parameters
Mv_Abs4_Pos := LREAL#0.0;
Mv_Abs4_Vel
:= LREAL#250.0;
Mv_Abs4_Acc := LREAL#1000.0;
Mv_Abs4_Dec := LREAL#1000.0;
Mv_Abs4_Dir
:= _eMC_DIRECTION#_mcShortestWay;
Mv_Abs4_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
3
END_IF;
Sample Programming 2
// If StartPg is TRUE and EtherCAT communications are normal, the Servo is turned ON.
// If EtherCAT communications are not normal, 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
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
// If the Servo is ON and home is not defined, the Home instruction is executed.
IF (Pwr_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm_Ex:=TRUE;
END_IF;
// After home is defined, MV_ABS1 is executed.
IF Hm_D=TRUE THEN
Mv_Abs1_Ex:=TRUE;
END_IF;
// After MV_ABS1 is started, MV_ABS2 is executed with multi-execution of instructions.
IF Mv_Abs1_Act=TRUE THEN
Mv_Abs2_Ex:=TRUE;
END_IF;
// After MV_ABS2 is started, MV_ABS3 is executed with multi-execution of instructions.
IF Mv_Abs2_Act=TRUE THEN
Mv_Abs3_Ex:=TRUE;
END_IF;
// After MV_ABS3 is started, MV_ABS4 is executed with multi-execution of instructions.
IF Mv_Abs3_Act=TRUE THEN
Mv_Abs4_Ex:=TRUE;
END_IF;
// MC_Power
PWR(
Axis
:= MC_Axis000,
NY-series Motion Control Instructions Reference Manual (W561)
3-73
3 Axis Command Instructions
Enable
Status
Busy
Error
ErrorID
:= Pwr_En,
=> Pwr_Status,
=> Pwr_Bsy,
=> Pwr_Err,
=> Pwr_ErrID
);
// MC_Home
HM(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= Hm_Ex,
=> Hm_D,
=> Hm_Bsy,
=> Hm_Ca,
=> Hm_Err,
=> Hm_ErrID
// Absolute positioning (1)
MV_ABS1(
Axis
:= MC_Axis000,
Execute
:= Mv_Abs1_Ex,
Position
:= Mv_Abs1_Pos,
Velocity
:= Mv_Abs1_Vel,
Acceleration
:= Mv_Abs1_Acc,
Deceleration
:= Mv_Abs1_Dec,
Direction
:= Mv_Abs1_Dir,
Done
=> Mv_Abs1_D,
Busy
=> Mv_Abs1_Bsy,
Active
=> Mv_Abs1_Act,
CommandAborted => Mv_Abs1_Ca,
Error
=> Mv_Abs1_Err,
ErrorID
=> Mv_Abs1_ErrID
);
// Absolute positioning (2)
MV_ABS2(
Axis
:= MC_Axis000,
Execute
:= Mv_Abs2_Ex,
Position
:= Mv_Abs2_Pos,
Velocity
:= Mv_Abs2_Vel,
Acceleration
:= Mv_Abs2_Acc,
Deceleration
:= Mv_Abs2_Dec,
Direction
:= Mv_Abs2_Dir,
BufferMode
:= Mv_Abs2_Bm,
Done
=> Mv_Abs2_D,
Busy
=> Mv_Abs2_Bsy,
Active
=> Mv_Abs2_Act,
CommandAborted => Mv_Abs2_Ca,
Error
=> Mv_Abs2_Err,
ErrorID
=> Mv_Abs2_ErrID
);
// Absolute positioning (3)
MV_ABS3(
Axis
:= MC_Axis000,
Execute
:= Mv_Abs3_Ex,
Position
:= Mv_Abs3_Pos,
Velocity
:= Mv_Abs3_Vel,
Acceleration
:= Mv_Abs3_Acc,
Deceleration
:= Mv_Abs3_Dec,
Direction
:= Mv_Abs3_Dir,
BufferMode
:= Mv_Abs3_Bm,
3-74
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Done
Busy
Active
CommandAborted
Error
ErrorID
=> Mv_Abs3_D,
=> Mv_Abs3_Bsy,
=> Mv_Abs3_Act,
=> Mv_Abs3_Ca,
=> Mv_Abs3_Err,
=> Mv_Abs3_ErrID
);
3
Sample Programming 2
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveAbsolute
// Absolute positioning (4)
MV_ABS4(
Axis
:= MC_Axis000,
Execute
:= Mv_Abs4_Ex,
Position
:= Mv_Abs4_Pos,
Velocity
:= Mv_Abs4_Vel,
Acceleration
:= Mv_Abs4_Acc,
Deceleration
:= Mv_Abs4_Dec,
Direction
:= Mv_Abs4_Dir,
BufferMode
:= Mv_Abs4_Bm,
Done
=> Mv_Abs4_D,
Busy
=> Mv_Abs4_Bsy,
Active
=> Mv_Abs4_Act,
CommandAborted => Mv_Abs4_Ca,
Error
=> Mv_Abs4_Err,
ErrorID
=> Mv_Abs4_ErrID
);
3-75
3 Axis Command Instructions
MC_MoveRelative
The MC_MoveRelative instruction moves the axis the specified travel distance from the command current position.
Instruction
MC_MoveRelative
Name
Relative
Positioning
FB/
FUN
FB
Graphic expression
ST expression
MC_MoveRelative_instance
MC_MoveRelative_instance (
Axis :=parameter,
Execute :=parameter,
Distance :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
BufferMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveRelative
Axis
Axis
Execute
Done
Distance
Busy
Velocity
Active
CommandAborted
Acceleration
Error
Deceleration
ErrorID
Jerk
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Distance
Travel
Distance
LREAL
Negative number, positive number, or 0
0
Specify the travel distance
from the command current
position. The unit is command
units.*1
Velocity
Target
Velocity
LREAL
Positive number
0
Specify the target velocity.*2
The unit is command
units/s.*1
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command
units/s2.*1
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command
units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is
command units/s3.*1
3-76
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Meaning
BufferMode
Buffer Mode
Selection
Data type
Valid range
_eMC_BUFFER_
MODE
0: _mcAborting
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
4: _mcBlendingNext
5: _mcBlendingHigh
Default
0*3
Description
Specify the behavior when
executing more than one
motion instruction.
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Always set the target velocity. If the axis is moved without setting a target velocity, an error will occur.
MC_MoveRelative
0: Aborting
1: Buffered
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
3
Output Variables
Meaning
Data type
Valid range
Variables
Name
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error.
• When this instruction is executed while there is
an error.
• When you start this instruction during MC_Stop
instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions
or input parameters for the instruction.
When the error is cleared.
NY-series Motion Control Instructions Reference Manual (W561)
3-77
3 Axis Command Instructions
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid Ranges
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The travel distance from the command current position is specified to perform positioning.
• Relative positioning starts when Execute changes to TRUE.
• You can specify the Velocity (Target Velocity), Acceleration (Acceleration Rate), Deceleration (Deceleration Rate), and Jerk as input variables.
The following chart shows an operation example of relative positioning.
Velocity
Target
velocity Acceleration
Deceleration
Time
0 Command current position
Travel distance
When the acceleration rate or deceleration rate is 0 and the instruction is executed, it will reach the target velocity without accelerating or decelerating.
The following chart shows an operation example of when the acceleration rate is 0.
Velocity
Target
velocity Acceleration
Time
0 Command current position
Travel distance
Specify Jerk when you want to accelerate or decelerate smoothly. The following chart shows an operation example when Jerk is specified.
Velocity
Target
velocity
Time
0
Command current position
Travel distance
3-78
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
For details on Jerk, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507)
or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Instruction Details
Modulo maximum
position setting
value: 100
Command
current
position: −20
MC_MoveRelative
When the Count Mode is Rotary Mode, you can specify a Distance (Travel Distance) that exceeds the
relative distance range from the Modulo Minimum Position Setting Value axis parameter to the Modulo
Maximum Position Setting Value axis parameter so that you can perform multiple ring rotation positioning. The following chart shows an operation example when the command current position is −20 and
Distance (Travel Distance) is 300.
3
Position after
positioning: −60
0
Function
Modulo minimum
position setting
value: −70
300
Performs relative positioning with travel distance of 300.
When Distance (Travel Distance) is 0 and the instruction is executed, the axis will not move, but Done
will change to TRUE.
Precautions for Correct Use
Observe the following precautions if you re-execute relative positioning just before the completion of positioning. If positioning is completed before the MC Function Module re-executes the
instruction, normal instruction execution is performed.
• For normal instruction execution, positioning is performed to the relative value that is based on
the position of the axis when the instruction is executed.
• For re-execution of an instruction, positioning is performed to the relative value that is based
on the position of the axis when original instruction was executed.
Normal Instruction Execution
Instruction re-executed.
elocity
Re-execution of Instruction
Velocity
First position
of original
instruction
First position
of original
instruction
Relative position Relative position
specified for
specified for
original instruction instruction
Instruction re-executed.
Time
Time
Relative position specified
for re-execution of instruction
z In-position Check
An in-position check is performed for this instruction according to the settings in In-position Range
and In-position Check Time axis parameters.
NY-series Motion Control Instructions Reference Manual (W561)
3-79
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• Done changes to TRUE when Distance (Target Distance) is reached and positioning is completed.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing) and Active (Controlling) change to FALSE.
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Multi-execution of
instructions
Velocity
Time
Re-execution of Motion Control Instructions
You can change the operation of the instruction if you change an input variable during positioning and
change Execute to TRUE again.
Input variables Distance (Travel Distance), Velocity (Target Velocity), Acceleration (Acceleration Rate),
and Deceleration (Deceleration Rate) can be changed by re-executing the motion control instruction.
The starting point for Distance (Travel Distance) when the instruction is re-executed is not the command
current position for the first execution, but rather it is the command current position when the instruction
was first executed. The following chart shows an operation example when a motion control instruction is
re-executed twice with different values for Distance (Travel Distance) and Velocity (Target Velocity).
Velocity
Instruction re-executed.
Instruction re-executed.
Time
0 Command current position
First travel
distance
Second travel
distance
Third travel
distance
3-80
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
To change any input parameter other than Distance (Travel Distance), re-execute the instruction
with Distance (Travel Distance) assigned to the same value as the original instruction.
For example, if Distance (Travel Distance) is changed to 0 when the instruction is re-executed,
the re-executed instruction will use a Distance (Travel Distance) of 0 from the first time it is executed. This will cause the axis to return to the original first position, as shown below.
MC_MoveRelative
Instruction re-executed.
Velocity
Changed target velocity
First position
of original
instruction
Target position
Time
3
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis.
The starting point for Distance (Travel Distance) for multi-execution of the motion instruction is the
command current position when Active (Controlling) changes to TRUE after the start of instruction
execution.
Specify the operation of this instruction using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the
motion will be reversed according to the Operation Selection at Reversing
axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current
instruction is completed.
Blending
Starts the buffered instruction at the velocity (transit velocity) at which the
current instruction reaches the target position. The operation of the current
instruction is changed so that the axes reach the target position at the transit velocity. There are four methods to specify the transit velocity. These are
described below.
Blending low
The lower of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
Blending previous
The target velocity of the current instruction is used as the transit velocity.
Blending next
The target velocity of the buffered instruction is used as the transit velocity.
Blending high
The higher of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
NY-series Motion Control Instructions Reference Manual (W561)
3-81
Function
For details on re-execution of motion control instructions, refer to PDO Mapping on page 2-34 and to
the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel
PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
3 Axis Command Instructions
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
If you execute another instruction during execution of this instruction, you can specify aborting, buffering, or blending.
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error code
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-82
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_MoveVelocity
The MC_MoveVelocity instruction performs velocity control with the Position Control Mode of the Servo
Drive.
Instruction
Name
Velocity
Control
FB/FUN
FB
ST expression
MC_MoveVelocity_instance
MC_MoveVelocity_instance (
Axis :=parameter,
Execute :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
Direction :=parameter,
Continuous :=parameter,
BufferMode :=parameter,
InVelocity =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
CommandAborted
Deceleration
Error
Jerk
Direction
ErrorID
Continuous
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Velocity
Target Velocity
LREAL
Non-negative number
0
Set the target velocity. The unit
is command units/s.*1
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command
units/s2.*1
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command
units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is
command units/s3.*1
Direction
Direction
_eMC_
DIRECTION
0: _mcPositiveDirection 0*2
2: _mcNegativeDirection
3: _mcCurrentDirection
Specify the rotation direction.
e_MC_BUFFER_
MODE
0: _mcAborting
1: _mcBuffered
Specify the behavior when executing more than one motion
instruction.
BufferMode
Buffer Mode
Selection
0*2
0: Positive direction
2: Negative direction
3: Current direction
0: Aborting
1: Buffered
NY-series Motion Control Instructions Reference Manual (W561)
3-83
3
Variables
Graphic expression
MC_MoveVelocity
MC_MoveVelocity
3 Axis Command Instructions
Name
Continuous
(Reserved)
Meaning
Data type
Continuation
Mode Selection
Valid range
BOOL
TRUE or FALSE
Default
FALSE
Description
Reserved
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
InVelocity
Target
Velocity
Reached
BOOL
TRUE or FALSE
TRUE when the target velocity is reached.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
InVelocity
When the target velocity is reached.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
• When the instruction is re-executed and the
target velocity is changed.
Busy
When Execute changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting or
Buffered.
• When this instruction is canceled due to an
error.
• When this instruction is executed while there
is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
3-84
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
MC_MoveVelocity
Function
• Pseudo velocity control is performed with position control.
• The velocity control operation starts when Execute changes to TRUE.
3
Instruction Details
Function
This section describes the instruction in detail.
z Direction
Specify the travel direction with Direction. When Direction specifies the positive direction, the axis
moves in the positive direction. When it specifies the negative direction, the axis moves in the negative direction. When it specifies the current direction, the axis motion depends on whether the axis is
stopped or not. If the axis is stopped, it will move in the direction in which it was traveling previously.
If the power was turned ON or after restarting, the axis moves in the positive direction. If you execute
this instruction during multi-execution of motion control instructions for the axis, the axis will move in
the direction that it is currently traveling.
Precautions for Correct Use
If the current direction is specified for Direction, operation is in the same command direction as
the previous motion. Therefore, depending on the instructions that are used together, the direction may not be the same as the direction that was specified with the input to the motion control
instruction for the previous motion. When you specify the current direction, check the current
direction with Dir.Posi (Positive Direction) and Dir.Nega (Negative Direction) in the Axis Variable.
NY-series Motion Control Instructions Reference Manual (W561)
3-85
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• InVelocity (Target Velocity Reached) changes to TRUE when Velocity (Target Velocity) is reached.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing), Active (Controlling), and InVelocity (Target Velocity Reached) change to FALSE.
Execute
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Velocity
Decelerates to a stop
when another instruction
causes an error.
Target velocity
Time
The InVelocity (Target Velocity Reached) output variable indicates when the velocity has reached
the same velocity for this instruction and the re-executed motion control instruction. Therefore, after
InVelocity (Target Velocity Reached) changes to TRUE, even if the velocity is changed by the override factor, InVelocity (Target Velocity Reached) will not change to FALSE. If the override factor
changes before InVelocity (Target Velocity Reached) changes to TRUE, InVelocity (Target Velocity
Reached) will change to TRUE when the new target velocity is reached.
3-86
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
You can specify Acceleration (Acceleration Rate), Deceleration (Deceleration Rate) and Jerk as
input variables. When the Velocity (Target Velocity) is 0 and the instruction is executed, the axis will
enter continuous operation without motion.
The following chart shows an operation example of when Velocity (Target Velocity) is 0.
Execute
Busy
MC_MoveVelocity
Active
InVelocity
CommandAborted
Error
ErrorID
3
16#0000
Function
Velocity
Target velocity
Time
When the Acceleration (Acceleration Rate) or Deceleration (Deceleration Rate) is 0 and the instruction is executed, the axis will reach the target velocity without accelerating or decelerating.
The following chart shows an operation example of when the acceleration rate is 0.
Velocity
Target
velocity
Time
0
Specify Jerk when you want to accelerate or decelerate smoothly. The following chart shows an
operation example when Jerk is specified.
Velocity
Target
velocity
0
Time
For details on Jerk, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No.
W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No.
W559).
NY-series Motion Control Instructions Reference Manual (W561)
3-87
3 Axis Command Instructions
Re-execution of Motion Control Instructions
You can change the operation of the instruction if you change an input parameter during continuous
operation and then change Execute to TRUE again. Input variables Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration (Deceleration Rate) can be changed by re-executing the
motion control instruction. When changing the Velocity (Target Velocity) by re-executing a motion control instruction, InVelocity (Target Velocity Reached) changes to FALSE when Execute changes to
FALSE.
When the motion control instruction is re-executed to change Velocity (Target Velocity), InVelocity (Target Velocity Reached) operates for the new target velocity that was set at re-execution.
For details on re-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis. Specify the operation of this instruction
using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion will
be reversed according to the Operation Selection at Reversing axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current instruction is
completed.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
If another instruction is executed during execution of this instruction, the BufferMode input variable
to the other instruction must be set to Aborting or Buffered.
If you specify Buffered, the buffered instruction is executed when the InVelocity (Target Velocity
Reached) output variable from this instruction changes to TRUE.
3-88
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Error
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
MC_MoveVelocity
InVelocity
Busy
Active
CommandAborted
3
Error
16#0000
Function
ErrorID
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-89
3 Axis Command Instructions
Sample Programming
This section shows sample programming for velocity control, such as for a spinner or centrifuge.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Type
Axis
Axis Type
Axis 1
Servo axis
Operation Example
Sensor 1
z Operation Pattern
Velocity
Second velocity
Third velocity
First velocity
Time
Sensor2
Sensor3
Stop command
1
Starting Velocity Control
Sensor 1 detects the insertion of liquid chemical. When it turns ON, velocity control starts for
axis 1.
2
3-90
Changing to the Second Velocity
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
When the Sensor2 bit changes to TRUE, the override factor is set to 500% and the velocity is
changed.
3
Changing to the Third Velocity
When the Sensor3 bit changes to TRUE, the override factor is set to 200% and the velocity is
changed. If both Sensor2 and Sensor3 are TRUE at the same time, the override factor is 200%.
4
Stopping Velocity Control
MC_MoveVelocity
When the stop command (StopTrig) changes to TRUE, the axis decelerates to a stop.
Ladder Diagram
z Main Variables
Name
Default
--FALSE
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
StartPg
BOOL
FALSE
Vel_Act
BOOL
FALSE
Set_Ov_Velfct
StopTrig
LREAL
BOOL
0
FALSE
Sensor1
BOOL
FALSE
Sensor2
BOOL
FALSE
Sensor3
BOOL
FALSE
MC_Axis000
MC_Axis000.MFaultLvl.Active
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
This variable is assigned to the Active output variable from the VEL instance of the MC_MoveVelocity instruction. It is TRUE during velocity
control by the VEL instance.
This is the velocity override factor.
When this variable is TRUE, MC_Stop is executed.
TRUE when chemical solution supply is detected.
If the Servo is ON for axis 1, the MC_MoveVelocity (Velocity Control) instruction is executed.
If this variable is TRUE, the override factor is set
to 500%. After this variable changes to TRUE, it
remains TRUE until Sensor3 changes to TRUE,
at which time it changes to FALSE.
If this variable is TRUE, the override factor is set
to 200%. After this variable changes to TRUE, it
remains TRUE.
3-91
3
Sample Programming
Data type
_sAXIS_REF
BOOL
3 Axis Command Instructions
z Timing Chart
Pwr_Status
Sensor1
Vel_Bsy
Vel_Act
Set_Ov_Bsy
Set_Ov_End
Sensor2
Sensor3
StopTrig
Stp_D
Stp_Act
Command velocity
MC_Axis000
Time
z Sample Programming
If StartPg is TRUE, EtherCAT communications are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
If process data communications are active, the Servo is turned ON.
PWR
MC_Power
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
When Sensor1 changes to TRUE, the MC_MoveVelocity (Velocity Control) instruction is executed.
VEL
MC_MoveVelocity
Pwr_Status
Sensor1
MC_Axis000
LREAL#1048576.0
LREAL#1048576.0
LREAL#1048576.0
_eMC_DIRECTION#_mcPositiveDirection
3-92
Axis
Axis
Execute
InVelocity
Velocity
Busy
Active
Acceleration
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
During execution of the MC_MoveVelocity (Velocity Control) instruction, the override factor is changed
according to the status of the Sensor2 and Sensor3 bits.
Vel_Act
Note: The contents of the inline ST are given below.
SET_OV
Vel_Act
MC_Axis000
Set_Ov_Velfct
MC_SetOverride
Axis
Axis
Enable
Enabled
VelFactor
Busy
AccFactor
Error
JerkFactor
ErrorID
Set_Ov_End
Set_Ov_Bsy
Set_Ov_Err
Set_Ov_ErrID
3
STP
MC_Stop
MC_Axis000
LREAL#524288.0
Axis
Axis
Execute
Done
Deceleration
Busy
Jerk
Active
BufferMode CommandAborted
Error
ErrorID
Stp_D
Stp_Bsy
Stp_Act
Stp_Ca
Stp_Err
Stp_ErrID
Contents of Inline ST
IF (Sensor2=FALSE) AND (Sensor3=FALSE) THEN
Set_Ov_Velfct := LREAL#100.0;
ELSIF (Sensor2=TRUE) AND (Sensor3=FALSE) THEN
Set_Ov_Velfct := LREAL#500.0;
ELSIF (Sensor2=FALSE) AND (Sensor3=TRUE) THEN
Set_Ov_Velfct := LREAL#200.0;
ELSE
Set_Ov_Velfct := LREAL#200.0;
END_IF;
Structured Text (ST)
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
MC_Axis000.Details.Homed
Pwr_Status
Data type
_sAXIS_REF
BOOL
Default
--FALSE
BOOL
BOOL
FALSE
FALSE
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
3-93
Sample Programming
When the stop command (StopTrig) changes to TRUE, the MC_Stop instruction is executed.
StopTrig
MC_MoveVelocity
The MC_SetOverride (Set Override Factors) instruction is executed during execution of the
MC_MoveVelocity (Velocity Control) instruction.
3 Axis Command Instructions
Name
3-94
StartPg
Data type
BOOL
Default
FALSE
Vel_Act
BOOL
FALSE
Set_Ov_Velfct
StopTrig
LREAL
BOOL
0
FALSE
Sensor1
BOOL
FALSE
Sensor2
BOOL
FALSE
Sensor3
BOOL
FALSE
Vel_Ex
BOOL
FALSE
Set_Ov_En
BOOL
FALSE
Stp_Ex
BOOL
FALSE
InitFlag
BOOL
FALSE
Comment
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
This variable is assigned to the Active output variable from the VEL instance of the MC_MoveVelocity instruction. It is TRUE during velocity
control by the VEL instance.
This is the velocity override factor.
When this variable is TRUE, MC_Stop is executed.
TRUE when chemical solution supply is detected.
If the Servo is ON for axis 1, the MC_MoveVelocity (Velocity Control) instruction is executed.
If this variable is TRUE, the override factor is set
to 500%. After this variable changes to TRUE, it
remains TRUE until Sensor3 changes to TRUE,
at which time it changes to FALSE.
If this variable is TRUE, the override factor is set
to 200%. After this variable changes to TRUE, it
remains TRUE.
The VEL instance of MC_MoveVelocity is executed when this variable changes to TRUE.
The SET_OV instance of MC_SetOverride is executed while this variable is TRUE.
The STP instance of MC_Stop is executed when
this variable changes to TRUE.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Pwr_Status
Sensor1
Vel_Ex
Vel_Act
Set_Ov_En
MC_MoveVelocity
Set_Ov_End
Sensor2
Sensor3
StopTrig
Stp_Ex
Stp_D
3
Stp_Act
MC_Axis000
Time
z Sample Programming
// Processing when input parameters are not set
IF InitFlag = FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1048576.0;
Vel_Acc := LREAL#1048576.0;
Vel_Dec := LREAL#1048576.0;
Vel_Dir := _eMC_DIRECTION#_mcPositiveDirection;
// MC_SetOverride parameters
Set_Ov_Velfct := LREAL#100.0;
// MC_Stop parameters
Stp_Dec := LREAL#524288.0;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
// If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
NY-series Motion Control Instructions Reference Manual (W561)
3-95
Sample Programming
Command velocity
3 Axis Command Instructions
END_IF;
// If the Servo is ON for axis 1 and the Sensor1 bit is TRUE, the MC_MoveVelocity instruction is executed.
IF (Pwr_Status=TRUE) AND (Sensor1=TRUE) THEN
Vel_Ex := TRUE;
END_IF;
// During execution of the MC_MoveVelocity instruction, the override factor is changed according to the status of
the Sensor2 and Sensor3 bits.
IF Vel_Act=TRUE THEN
IF (Sensor2=FALSE) AND (Sensor3=FALSE) THEN
Set_Ov_Velfct := LREAL#100.0;
ELSIF (Sensor2=TRUE) AND (Sensor3=FALSE) THEN
Set_Ov_Velfct := LREAL#500.0;
ELSIF (Sensor2=FALSE) AND (Sensor3=TRUE) THEN
Set_Ov_Velfct := LREAL#200.0;
ELSE
Set_Ov_Velfct := LREAL#200.0;
END_IF;
END_IF;
// The MC_SetOverride instruction is executed during velocity control for the MC_MoveVelocity instruction.
IF Vel_Act=TRUE THEN
Set_Ov_En := TRUE;
END_IF;
// The MC_Stop instruction is executed when StopTrig is TRUE.
IF StopTrig=TRUE THEN
Stp_Ex := TRUE;
END_IF;
//MC_Power
PWR(
Axis
Enable
Status
Busy
Error
ErrorID
);
:= MC_Axis000,
:= Pwr_En,
=> Pwr_Status,
=> Pwr_Bsy,
=> Pwr_Err,
=> Pwr_ErrID
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Direction
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
3-96
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Dir,
=> Vel_Invel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
:= MC_Axis000,
:= Set_Ov_En,
:= Set_Ov_Velfct,
:= Set_Ov_Accfct,
:= Set_Ov_Jfct,
=> Set_Ov_Bsy,
=> Set_Ov_End,
=> Set_Ov_Err,
=> Set_Ov_ErrID
:= MC_Axis000,
:= Stp_Ex,
:= Stp_Dec,
=> Stp_D,
=> Stp_Bsy,
=> Stp_Act,
=> Stp_Ca,
=> Stp_Err,
=> Stp_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3
Sample Programming
//MC_Stop
STP(
Axis
Execute
Deceleration
Done
Busy
Active
CommandAborted
Error
ErrorID
);
MC_MoveVelocity
//MC_SetOverride
SET_OV(
Axis
Enable
VelFactor
AccFactor
JerkFactor
Busy
Enabled
Error
ErrorID
);
3-97
3 Axis Command Instructions
MC_MoveZeroPosition
The MC_MoveZeroPosition instruction performs positioning with an absolute position of 0 as the target
position to return to home.
Instruction
Name
MC_MoveZeroPosition Highspeed
Home
FB/
FUN
FB
Graphic expression
ST expression
MC_MoveZeroPosition_instance
MC_MoveZeroPosition_instance (
Axis :=parameter,
Execute :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
BufferMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveZeroPosition
Axis
Axis
Execute
Done
Velocity
Busy
Acceleration
Active
CommandAborted
Deceleration
Error
Jerk
ErrorID
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Velocity
Target
Variable
LREAL
Positive number
0
Specify the target velocity.*1
The unit is command
units/s.*2
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command
units/s2.*2
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command
units/s2.*2
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is
command units/s3.*2
BufferMode
Buffer Mode
Selection
_eMC_BUFFER_
MODE
0: _mcAborting
1: _mcBuffered
0*3
Specify the behavior when
executing more than one
motion instruction.
0: Aborting
1: Buffered
*1 Always set the target velocity. If the axis is moved without setting a target velocity, an error will occur.
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
3-98
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
3
Timing for changing to FALSE
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the axis starts moving.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
Variables
Done
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveZeroPosition
Done
3-99
3 Axis Command Instructions
Function
• The axis moves to home.
• You can specify the Velocity (Target Velocity), Acceleration (Acceleration Rate), Deceleration (Deceleration Rate), and Jerk as input variables.
Precautions for Correct Use
Execute the MC_MoveZeroPosition (High-speed Home) instruction only after defining home. If
home is not defined, an Instruction Execution Error with Undefined Home (error code: 5466 hex)
occurs.
Instruction Details
This section describes the instruction in detail.
z Direction Designation
When the Count Mode is set to Rotary Mode, positioning is performed in the direction with the shortest distance to home (shortest-way positioning). The following chart shows an operation example of
this instruction according to the command current position.
Modulo maximum
position setting
value: 100
Command current position: 90
Command
current
position: −30
0
Home: 0
0
Modulo minimum
position setting
value: −50
Moves in positive direction.
Shortest-way positioning is performed.
Precautions for Correct Use
If this instruction is executed when home is outside of the settings of the Modulo Maximum Position Setting Value and Modulo Minimum Position Setting Value axis parameters, a Target Position Ring Counter Out of Range error (error code: 549C hex) will occur.
z Override Factors
Override factors are enabled for this instruction.
z In-position Check
An in-position check is performed for this instruction according to the settings in In-position Range
and In-position Check Time axis parameters.
3-100
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Operation Example
Velocity
Target velocity
Deceleration
Command current position
0
Time
When the acceleration rate or deceleration rate is 0 and the instruction is executed, it will reach the
target velocity without accelerating or decelerating.
The following chart shows an operation example of when the acceleration rate is 0.
3
Velocity
Function
Target velocity
Deceleration
Time
Command current position
0
Specify Jerk when you want to accelerate or decelerate smoothly. The following chart shows an
operation example when Jerk is specified.
Velocity
Target velocity
Command current position
0
MC_MoveZeroPosition
Acceleration
Time
For details on Jerk, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No.
W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No.
W559).
NY-series Motion Control Instructions Reference Manual (W561)
3-101
3 Axis Command Instructions
Timing Charts
A timing chart for execution of the MC_MoveZeroPosition (High-speed Home) instruction is shown
below.
Execute
Busy
Active
Done
CommandAborted
Error
ErrorID
16#0000
Velocity
Time
Aborting the Instruction
Home will not become undefined even if this instruction is aborted and CommandAborted changes to
TRUE.
Re-execution of Motion Control Instructions
You can change the operation of the instruction if you change an input variable during positioning and
change Execute to TRUE again. Input variables Velocity (Target Velocity), Acceleration (Acceleration
Rate), and Deceleration (Deceleration Rate) can be changed by re-executing the motion control instruction. For details on re-execution of motion control instructions, refer to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
3-102
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis. Specify the operation of this instruction
using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction. a
If the direction of axis motion is reversed by switching instructions, the motion will be
reversed according to the Operation Selection at Reversing axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current instruction is
completed.
z Execution of Other Instructions during Instruction Execution
If you execute another instruction during execution of this instruction, you can specify either aborting
or buffering. You cannot specify blending.
MC_SetPosition Execution during Instruction Execution
Home becomes undefined for the MC_SetPosition instruction. Therefore an error will occur if you
attempt to execute it during execution of this instruction, and it will not be executed. If attempting to
execute the MC_SetPosition instruction causes an error, the current instruction decelerates the axis
to a stop and CommandAborted changes to TRUE. In this case, the output variable Error changes to
TRUE for the MC_SetPosition instruction.
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
Velocity
16#0000
Execution of MC_Set Position
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-103
3
Function
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
MC_MoveZeroPosition
z Execution during Execution of Other Instructions
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-104
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_MoveFeed
The MC_MoveFeed instruction performs positioning for the specified travel distance from the position
where an external device triggers an interrupt input. Interrupt feeding is possible for absolute positioning, relative positioning, and velocity control.
Instruction
Name
Interrupt
Feeding
FB/FUN
FB
Graphic expression
ST expression
MC_MoveFeed_instance
MC_MoveFeed_instance (
Axis :=parameter,
TriggerInput :=parameter,
TriggerVariable :=parameter,
Execute :=parameter,
WindowOnly :=parameter,
FirstPosition :=parameter,
LastPosition :=parameter,
ReferenceType
:=parameter,
Position :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
Direction :=parameter,
MoveMode :=parameter,
FeedDistance :=parameter,
FeedVelocity :=parameter,
BufferMode :=parameter,
ErrorDetect :=parameter,
Done =>parameter,
InFeed =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveFeed
Axis
Axis
TriggerInput
TriggerInput
TriggerVariable
TriggerVariable
Execute
Done
InFeed
WindowOnly
Busy
FirstPosition
LastPosition
Active
ReferenceType
CommandAborted
Error
Position
ErrorID
Velocity
Acceleration
Deceleration
Jerk
Direction
MoveMode
FeedDistance
FeedVelocity
BufferMode
ErrorDetect
NY-series Motion Control Instructions Reference Manual (W561)
3-105
MC_MoveFeed
MC_MoveFeed
3
3 Axis Command Instructions
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
WindowOnly
Window Only
BOOL
TRUE or FALSE
FALSE
Specify whether to enable or
disable the window.
FirstPosition
First Position
LREAL
Negative number, positive number, or 0
0
Specify the position where
latching is enabled. The unit is
command units.*1
LastPosition
Last Position
LREAL
Negative number, positive number, or 0
0
Specify the position where
latching is disabled. The unit
is command units.*1
ReferenceType Position Type
Selection
_eMC_
REFERENCE_
TYPE
1: _mcFeedback
1*2
Specify the position type.
Position
LREAL
Negative number, positive number, or 0
Target
Position
1: Actual position (value
obtained in the same task
period*3)
0
If MoveMode is set to Absolute positioning, specify the
absolute target positions on
the absolute coordinate. If
MoveMode is set to Relative
positioning, specify the travel
distance.
If MoveMode is set to Velocity
control, specification is not
necessary.
The unit is command units.*1
Velocity
Target
Velocity
LREAL
Positive number*4
0
Specify the target velocity.
The unit is command
units/s.*1
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command
units/s2.*1
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command
units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is
command units/s3.*1
Direction
Direction
_eMC_
DIRECTION
0: _mcPositiveDirection
1: _mcShortestWay
2: _mcNegativeDirection
3: _mcCurrentDirection
4: _mcNoDirection
0*2
Specify the direction of rotation when MoveMode is set to
absolute positioning*5 and
when the Count Mode is
Rotary Mode.
0: Positive direction
1: Shortest way
2: Negative direction
3: Current direction
4: No direction specified
3-106
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
MoveMode
Meaning
Travel Mode
Data type
Valid range
_eMC_MOVE_
MODE
Default
0: _mcAbsolute
1: _mcRelative
2: _mcVelocity
0*2
Description
Select the travel method.
0: Absolute positioning
1: Relative positioning
2: Velocity control
Feed Distance LREAL
Negative number, positive number, or 0
0
Specify the travel distance
after the interrupt feed input.
Specify a positive value to
feed in the same direction as
the axis was moving before
the interrupt input and specify
a negative value to feed in the
opposite direction. The unit is
command units.*1
FeedVelocity
Feed Velocity
Positive number
0
Specify the target travel velocity after the interrupt feed
input. The unit is command
units/s.*1
Buffer Mode
Selection
_eMC_BUFFER_
MODE
0: _mcAborting
1: _mcBuffered
0*2
Specify the behavior when
executing more than one
motion instruction.
0: Aborting
1: Buffered
ErrorDetect
Error
Detection
Selection
BOOL
TRUE or FALSE
FALSE
Specify whether to detect an
error when there is no interrupt feed input.
TRUE: Detect errors.
FALSE: Do not detect errors.
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
*3 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
*4 A value of 0 can be set if MoveMode is set to velocity control.
*5 The axis moves to the specified position when MoveMode is set to absolute positioning and when the Count Mode is Linear Mode.
When MoveMode is set to relative positioning, the travel direction is determined by the sign of the position.
_mcShortestWay and _mcNoDirection cannot be selected when MoveMode is set to velocity control, regardless of the
Counter Mode.
Output Variables
Name
Done
Meaning
Done
Data type
BOOL
Valid range
TRUE or FALSE
Description
TRUE when the instruction is completed.
InFeed
Feeding
BOOL
TRUE or FALSE
TRUE while feeding after receiving a latch input.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-107
3
Variables
BufferMode
LREAL
MC_MoveFeed
FeedDistance
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When the instruction is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
InFeed
When feeding is started by the interrupt
input.*
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
* There may be a delay of up to several task periods from when the interrupt input turns ON until InFeed changes to TRUE.
The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic task
if the task is the priority-5 periodic task.
In-Out Variables
Name
Meaning
Data type
Valid range
Description
Axis
Axis
_sAXIS_REF
---
Specify the axis.*1
TriggerInput
Trigger Input
Condition
_sTRIGGER_REF
---
Set the trigger condition.*2
TriggerVariable
Trigger
Variable
BOOL
TRUE or FALSE
Specify a trigger input variable when the
Controller Mode is specified for the trigger
mode.
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Define a user-defined variable with a data type of _sTRIGGER_REF..
3-108
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z _sTRIGGER_REF
Name
Mode
Meaning
Mode
Data type
_eMC_TRIGGER_ MODE
Valid range
0: _mcDrive
1: _mcController
Function
Specify the trigger mode.
0: Drive Mode
1: Controller Mode
LatchID
Latch ID
Selection
_eMC_TRIGGER_ LATCHID
0: _mcLatch1
1: _mcLatch2
Specify which of the two latch functions
to use in Drive Mode.
InputDrive
Trigger Input
Signal
_eMC_TRIGGER_
INPUT_DRIVE
0: _mcEncoderMark
1: _mcEXT
Specify the Servo Drive trigger signal
to use in Drive Mode.
0: Z-phase signal
1: External input
MC_MoveFeed
0: Latch 1
1: Latch 2
3
Function
• The target position is set in Position (Target Position) for absolute travel. The target distance is set in
Position (Target Distance) for relative travel.
Both travel methods use Velocity (Target Velocity) for travel operation.
• Relative positioning is performed with FeedVelocity from the actual position where the external input
turned ON during travel for the feed distance that is specified with FeedDistance.
• If no interrupt signal is input before the axis reaches the default target position during interrupt feeding in absolute or relative travel mode, the axis stops at the target position. You can specify whether
there is an error output when the axis stops for ErrorDetect (i.e., when there is no interrupt input.) If
you specify an error output, CommandAborted changes to TRUE, and Busy (Executing) and Active
(Controlling) change to FALSE.
• To use interrupt masks, change WindowOnly to TRUE, then specify FirstPosition and LastPosition.
Interrupt feeding is performed for the first interrupt signal generated by the actual position between
the FirstPosition and the LastPosition.
Precautions for Correct Use
• Feeding after the interrupt is performed as a relative movement for the distance that is specified with FeedDistance. If a positive value is specified for FeedDistance, feeding is performed
in the same direction as before the interrupt input, and if a negative value is specified, feeding
is performed in the opposite direction.
• The setting of the Operation Selection at Reversing axis parameter is used for the acceleration
and deceleration rates when reversing to feed.
• If an underflow or overflow would occur for the position after interrupt feeding, an error occurs
when the interrupt input is received. If an interrupt input is received after there is an overflow or
underflow, an axis error will still occur.
Additional Information
Refer to MC_MoveAbsolute on page 3-49 for absolute travel, MC_MoveRelative on page 3-76
for relative travel, MC_MoveVelocity on page 3-83 for velocity control, and WindowOnly on page
3-112 for WindowOnly.
NY-series Motion Control Instructions Reference Manual (W561)
3-109
Function
• When Execute changes to TRUE, the axis travels with absolute travel, relative travel, or velocity control depending on the MoveMode setting.
3 Axis Command Instructions
z Mapping Data Objects
You must map the following object data when the MC_MoveFeed (Interrupt Feeding) instruction is
executed with Mode set to Drive Mode. Mapping is performed in the Detailed Setting Area of the
Axis Basic Settings Display of the Sysmac Studio.
• Touch probe function (60B8 hex)
• Touch probe status (60B9 hex)
• Touch probe pos1 pos value (60BA hex)
• Touch probe pos2 pos value (60BC hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
For details on mapping data objects, refer to 2-3 PDO Mapping and to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
Refer to I/O Entry Mappings in the NX-series Position Interface Units User’s Manual (Cat. No. W524)
for information on using the NX-series Position Interface Units.
Instruction Details
This section describes the instruction in detail.
z Specifying Axis
• Axis specifies the axis for which to latch the position.
z Trigger Input Condition
Select the trigger conditions with Mode, LatchID, and InputDrive of the TriggerInput (Trigger Input
Conditions) variable.
Mode
• The mode can be set to Drive Mode to specify a signal from the Servo Drive or NX-series Pulse
Output Unit as the trigger, or to Controller Mode to specify a trigger with TriggerVariable.
• The trigger occurs on the rising edge of the trigger signal. The axis position is latched on the first
trigger (FALSE to TRUE) after the MC_TouchProbe instruction is executed.
• While this instruction is Busy (Executing), a change in TriggerVariable is taken as a trigger even if
Execute is FALSE.
Drive Mode
For trigger detection and latching of the actual position, the latched actual position is more precise in Drive Mode (which is a Servo Drive function) than it is in Controller Mode.
Input signal to Servo Drive
Trigger detection
Axis position
Input filter delay
Position (latched position)
Position when trigger signal is input
Time
3-110
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
• When using Drive Mode, make sure that you connect the latch signal to the LatchID that you
are going to use.
• The width of the latch signal depends on the performance of the Servo Drive or NX-series
Pulse Output Unit and other factors.
• You must map the following object data when the MC_MoveFeed (Interrupt Feeding) instruction is executed with InputDrive set to Drive Mode.
If even one of the required objects is not set, a Process Data Object Setting Missing error
(error code 3461 hex) occurs. For details on mapping object data, refer to 2-3 PDO Mapping
and to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series
Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
MC_MoveFeed
Touch probe function (60B8 hex), Touch probe status (60B9 hex), Touch probe pos1 pos
value (60BA hex), and Touch probe pos2 pos value (60BC hex)
3
Controller Mode
• Use TriggerVariable to specify the BOOL variable that you want to use as a trigger.
• The Controller Mode causes a longer delay compared to the Drive Mode. This is due to the
I/O refresh delay that occurs when the trigger input signal is updated in the BOOL variable.
Input signal to Input Unit
BOOL variable assigned to input signal
Axis position
Input filter delay + I/O
refresh delay
Position (latched position)
Position when trigger signal is input
Time
Precautions for Correct Use
If you use Controller Mode, the latch is performed each task period. Therefore, the trigger variable must remain TRUE for at least one task period.
Also, one task period is required between when the trigger variable changes to TRUE and the
MC Function Module processes the latch.
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task.
LatchID
• Specify which of the two to use with LatchID. You can use only one of the latches with any one
axis.
• LatchIDs indicate latch circuit 1 and latch circuit 2 in the Servo Drive or NX-series Pulse Output
Unit.
For information on latch IDs, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat.
No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat.
No. W559).
InputDrive
• You can select _mcEncoderMark (Z Phase) or _mcEXT (External Input) as triggers.
NY-series Motion Control Instructions Reference Manual (W561)
3-111
Function
• You can specify a BOOL variable in the Controller Mode.
3 Axis Command Instructions
• Select _mcEncoderMark (Z phase) to use the Z phase of the Servo Drive or NX-series Pulse Output Unit as the trigger.
Select _mcEXT (external input) to use the external trigger signal of the Servo Drive or NX-series
Pulse Output Unit as the trigger.
• For an OMRON 1S-series Servo Drive, there are two options for _mcEXT: Ext1, and Ext2. For an
OMRON G5-series Servo Drive, there are three options for _mcEXT: Ext1, Ext2, and Ext3. Use
Sysmac Studio to make the setting.
The two triggers set in the Servo Drive can have the same setting.
• Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for information on
using the NX-series Pulse Output Unit.
z WindowOnly
• WindowOnly specifies whether the window is enabled or disabled.
• If you specify Disable, triggers are detected for all axis positions.
• If you specify Enable, triggers are detected only when the axis position is within the range specified by FirstPosition and LastPosition.
The following timing chart shows the difference in operation depending on the WindowOnly setting.
WindowOnly Set to Disable
The axis position when the first trigger occurs after Execute changes to TRUE is used as the reference position for the feed distance.
TriggerInput
Execute
WindowOnly
Done
Busy
RecordedPosition
0
Position
CommandAborted
Error
ErrorID
16#0000
Axis position
LastPosition
FirstPosition
Position
3-112
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
WindowOnly Set to Enable
Only trigger inputs within the window are detected to latch the axis position.
Trigger enabled range
TriggerInput
Execute
WindowOnly
MC_MoveFeed
Done
Busy
RecordedPosition
0
Position
3
CommandAborted
Error
Function
ErrorID
16#0000
Axis position
LastPosition
Position
FirstPosition
Precautions for Correct Use
• Latching is not possible at the moment that WindowOnly changes to TRUE and until the latch
function is activated.
• Time is needed until the latch function is activated. If the effective range for WindowOnly is too
small, latching is not possible. The range in which latching is possible depends on the performance of the Servo Drive, Encoder Input Terminal, or Position Interface Unit, and on EtherCAT
communications.
The range that is defined by FirstPosition and LastPosition depends on the Count Mode, as given
below.
Linear Mode
• FirstPosition must be less than or equal to the window range and the window range must be less
than or equal to LastPosition.
• An error will occur if the FirstPosition is greater than the LastPosition.
• An error will also occur if a position beyond the position range of Linear Mode is specified.
• FirstPosition and LastPosition are LREAL variables. Do not set them to the same values.
Refer to Treatment of REAL and LREAL Data on page 1-12 for information on LREAL data.
The window only range in Linear Mode is shown below.
FirstPosition
LastPosition
0x8000000000
0x7fffffffff
Window
Window only range
NY-series Motion Control Instructions Reference Manual (W561)
3-113
3 Axis Command Instructions
Note The window only range can include the FirstPosition and LastPosition.
Rotary Mode
• The FirstPosition can be less than, equal to, or greater than the LastPosition.
• If the FirstPosition is greater than the LastPosition, the setting range includes the modulo maximum position and modulo minimum position setting values.
• An error will occur if you specify a value beyond the modulo maximum position and modulo minimum position setting values.
FirstPosition <
= LastPosition
−
LastPosition
+
0
LastPosition
−
+
0
FirstPosition
Window only range
: The positions indicated with
filled dots are included.
FirstPosition
Window only range
FirstPosition > LastPosition
FirstPosition
−
0
+
FirstPosition
−
0
+ Window only range
LastPosition
: The positions indicated with
open dots are not included.
LastPosition
Window only range
z ReferenceType (Position Type Selection)
The position type is as follows:
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task.
z FeedDistance
Specify a positive value for FeedDistance to perform feed in the same direction as the motion before
the interrupt input. Specify a negative value for FeedDistance to perform feed in the opposite direction as the motion before the interrupt input.
For example, if you specify a positive value for FeedDistance when the motion was in the negative
direction before the interrupt input, feeding is performed in the negative direction. If you specify a
negative value for FeedDistance, feeding is performed in the positive direction.
3-114
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• After an interrupt input, InFeed changes to TRUE and when FeedDistance is reached and positioning
is completed, Done changes to TRUE.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing) and Active (Controlling) change to FALSE.
MC_MoveFeed
z When MoveMode (Travel Mode) is _mcAbsolute or _mcRelative
Execute
Done
3
InFeed
Busy
Function
Active
CommandAborted
Error
ErrorID
16#0000
Interrupt input*
Velocity
Time
* There may be a delay of up to several control periods from when the interrupt input turns ON until InFeed
changes to TRUE.
Additional Information
Acceleration or deceleration to interrupt feeding is performed according to the Acceleration
(Acceleration Rate) or Deceleration (Deceleration Rate) input variable.
NY-series Motion Control Instructions Reference Manual (W561)
3-115
3 Axis Command Instructions
z When MoveMode (Travel Mode) is _mcVelocity
Execute
Done
InFeed
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Interrupt input
Velocity
Time
z Operation Selection at Reversing Axis Parameter
When feeding reverses its direction after the interrupt input, operation follows the Operation Selection at Reversing axis parameter
When Motion Variable Is 0 (Decelerate to a Stop After Reversing)
Execute
Done
InFeed
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Interrupt input
Velocity
Time
3-116
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Additional Information
The deceleration rate when the axis reverses after an interrupt input follows the Deceleration
(Deceleration Rate) input variable.
When Motion Variable Is 1 (Stop Immediately After Reversing)
Execute
MC_MoveFeed
Done
InFeed
Busy
Active
3
CommandAborted
Function
Error
ErrorID
16#0000
Interrupt input
Velocity
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-117
3 Axis Command Instructions
z When MoveMode (Travel Mode) is _mcAbsolute and an Interrupt Input Is Not
Received
When ErrorDetect (Error Detection Selection) Is Set to Not Detect Errors
Execute
Done
InFeed
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Interrupt input
Velocity
Time
When ErrorDetect (Error Detection Selection) Is Set to Detect Errors
Execute
Done
InFeed
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Interrupt input
Velocity
Time
3-118
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z When WindowOnly Is Enabled
Execute
Done
InFeed
Busy
MC_MoveFeed
Active
CommandAborted
Error
ErrorID
16#0000
3
Interrupt input
Function
Position
LastPosition
FirstPosition
Time
Velocity
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-119
3 Axis Command Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis. Specify the operation of this instruction
using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion will be
reversed according to the Operation Selection at Reversing axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current instruction is
completed.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
You can execute another instruction with the Buffer Mode set to Aborting during execution of this
instruction.
The following will occur if another instruction with the Buffer Mode set to Buffered or a blending
mode is executed.
• Error changes to TRUE in the other instruction. A Motion Control Instruction Multi-execution Disabled error (error code: 543C hex) is output to ErrorID (Error Code).
• The MC_MoveFeed instruction is aborted and CommandAborted changes to TRUE.
3-120
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
When there is an error, the latch used for the interrupt input for this instruction is disabled.
MC_MoveFeed
Execute
Done
Busy
Active
3
CommandAborted
ErrorID
16#0000
Function
Error
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-121
3 Axis Command Instructions
Sample Programming
This section shows sample programming where control changes from velocity control to interrupt feeding.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Types
Axis
Axis Type
Axis 1
Servo axis
Axis 2
Servo axis
Count Modes
Axis
Count Mode
Axis 1
Rotary Mode
Axis 2
Linear Mode
Ring Counters
Axis
Axis 1
Modulo maximum
position
360
Modulo minimum position
0
Units of Display
Axis
Unit of Display
Axis 1
degree
Axis 2
mm
Operation Example
Axis 2
Sensor 1
Axis 1
3-122
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Operation Pattern
Velocity
Velocity control
Position control
Time
MC_MoveFeed
Sensor operation
Stamp
1
Conveyor Operation
Axis 1, which moves the conveyer belt, performs velocity control before interrupt feeding.
2
3
Feeding
3
Pressing the Stamp
When positioning is finished, axis 2 of the stamp moves perpendicularly down at the position
determined by absolute positioning to press the stamp.
After stamping is performed, axis 2 returns to home.
When the absolute positioning is completed, the axis is immediately returned to home. To enable
this, BufferMode (Buffer Mode Selection) of the MC_MoveZeroPosition (High-speed Home) instruction is set to Buffered. Multi-execution of instructions is performed if the Active output from the previous instruction is TRUE.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
MC_Axis001
MC_Axis001.MFaultLvl.Active
BOOL
_sAXIS_REF
BOOL
FALSE
--FALSE
BOOL
_sTRIGGER_REF
FALSE
---
BOOL
FALSE
MC_Axis001.Details.Homed
TrigRef
StartPg
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
Axis Variable for axis 2.
TRUE while there is a minor fault level error for
axis 2.
TRUE when home is defined for axis 2.
This is the specified variable for the interrupt
input. Latch 1 of the Servo Drive is used in this
sample. When the rising edge of the external
input for sensor 1 is detected, interrupt feeding is
executed.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
3-123
Sample Programming
Sensor 1 is connected to latch 1.
When Sensor1 turns ON, operation changes to feeding and the axis stops at the specified position.
3 Axis Command Instructions
Name
Data type
BOOL
InitFlag
Default
FALSE
Comment
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
z Timing Chart
Sensor 1
Hm1_D
Hm2_D
Mv_Feed_D
Mv_Feed_InFeed
Mv_Feed_Bsy
Mv_Feed_Act
Mv_Abs_D
Mv_Abs_Bsy
Mv_Abs_Act
Mv_Zero_D
Mv_Zero_Bsy
Mv_Zero_Act
Velocity
MC_Axis000
command current velocity
Velocity
MC_Axis001
command current velocity
Time
Time
3-124
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data communications
are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
PWR1
MC_Power
Lock1
MC_Axis000
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
MC_MoveFeed
If process data communications are active, the Servo is turned ON.
3
Sample Programming
NY-series Motion Control Instructions Reference Manual (W561)
3-125
3 Axis Command Instructions
PWR2
MC_Power
MC_Axis001
Lock2
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed.
HM1
MC_Home
Pwr1_Status
MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed.
HM2
MC_Home
Pwr2_Status
MC_Axis001.Details.Homed
MC_Axis001
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
The parameters are set for interrupt feeding, absolute positioning, and high-speed homing.
InitFlag
Note: The contents of the inline ST are given below.
3-126
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
If home is defined for axis 1, interrupt feeding is executed for axis 1.
MV_FEED
MC_Axis000
Mv_Feed_TrigRef
Mv_Feed_TrigVar
MC_Axis000.Details.Homed
Mv_Feed_InFeed
Mv_Feed_Bsy
Mv_Feed_Act
Mv_Feed_Ca
Mv_Feed_Err
Mv_Feed_ErrID
3
If home is defined for axis 2 and interrupt feeding is completed for axis 1, absolute positioning is performed for axis 2.
MV_ABS
MC_Axis001.Details.Homed Mv_Feed_D
MC_Axis001
Mv_Abs_Pos
Mv_Abs_Vel
Mv_Abs_Acc
Mv_Abs_Dec
Mv_Abs_Jrk
MC_MoveAbsolute
Axis
Axis
Execute
Done
Position
Busy
Velocity
Active
Acceleration CommandAborted
Error
Deceleration
Jerk
ErrorID
Direction
BufferMode
Mv_Abs_D
Mv_Abs_Bsy
Mv_Abs_Act
Mv_Abs_Ca
Mv_Abs_Err
Mv_Abs_ErrID
After absolute positioning is completed, the High-speed Home instruction is executed to move to home.
MV_ZERO
MC_MoveZeroPosition
Mv_Abs_Act
MC_Axis001
Mv_Zero_Vel
Mv_Zero_Acc
Mv_Zero_Dec
Mv_Zero_Jrk
Mv_Zero_Bm
Axis
Axis
Execute
Done
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Error
Jerk
BufferMode
ErrorID
Mv_Zero_D
Mv_Zero_Bsy
Mv_Zero_Act
Mv_Zero_Ca
Mv_Zero_Err
Mv_Zero_ErrID
Contents of Inline ST
// MV_FEED parameters
Mv_Feed_TrigRef.Mode
Mv_Feed_TrigRef.LatchID
Mv_Feed_TrigRef.InputDrive
Mv_Feed_TrigVar
Mv_Feed_Pos
Mv_Feed_Vel
Mv_Feed_Acc
Mv_Feed_Dec
Mv_Feed_Mm
Mv_Feed_FeedDis
:= _eMC_TRIGGER_MODE#_mcDrive;
:= _eMC_TRIGGER_LATCH_ID#_mcLatch1;
:= _eMC_TRIGGER_INPUT_DRIVE#_mcEXT;
:= FALSE;
:= LREAL#2000.0;
:= LREAL#1000.0;
:= LREAL#10000.0;
:= LREAL#10000.0;
:= _eMC_MOVE_MODE#_mcVelocity;
:= LREAL#500.0;
NY-series Motion Control Instructions Reference Manual (W561)
3-127
Sample Programming
Mv_Feed_Mm
Mv_Feed_FeedDis
Mv_Feed_FeedVel
Mv_Feed_D
MC_MoveFeed
Mv_Feed_Pos
Mv_Feed_Vel
Mv_Feed_Acc
Mv_Feed_Dec
MC_MoveFeed
Axis
Axis
TriggerInput
TriggerInput
TriggerVariable
TriggerVariable
Execute
Done
WindowOnly
InFeed
FirstPosition
Busy
LastPosition
Active
ReferenceType CommandAborted
Error
Position
Velocity
ErrorID
Acceleration
Deceleration
Jerk
Direction
MoveMode
FeedDistance
FeedVelocity
BufferMode
ErrorDetect
3 Axis Command Instructions
Mv_Feed_FeedVel
:= LREAL#500.0;
// MV_ABS parameters
Mv_Abs_Pos
:= LREAL#1000.0;
Mv_Abs_Vel
:= LREAL#500.0;
Mv_Abs_Acc
:= LREAL#10000.0;
Mv_Abs_Dec
:= LREAL#10000.0;
Mv_Abs_Jrk
:= LREAL#10000.0;
// MV_ZERO parameters
Mv_Zero_Vel
:= LREAL#500.0;
Mv_Zero_Acc
:= LREAL#10000.0;
Mv_Zero_Dec
:= LREAL#10000.0;
Mv_Zero_Jrk
:= LREAL#10000.0;
Mv_Zero_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
Structured Text (ST)
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
MC_Axis001
MC_Axis001.MFaultLvl.Active
BOOL
_sAXIS_REF
BOOL
FALSE
--FALSE
BOOL
_sTRIGGER_REF
FALSE
---
StartPg
BOOL
FALSE
InitFlag
BOOL
FALSE
Hm1_Ex
BOOL
FALSE
Hm2_Ex
BOOL
FALSE
Mv_Feed_Ex
BOOL
FALSE
Mv_Abs_Ex
BOOL
FALSE
Mv_Zero_Ex
BOOL
FALSE
MC_Axis001.Details.Homed
TrigRef
3-128
Comment
Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
Axis Variable for axis 2.
TRUE while there is a minor fault level error for
axis 2.
TRUE when home is defined for axis 2.
This is the specified variable for the interrupt
input. Latch 1 of the Servo Drive is used in this
sample. When the rising edge of the external
input for sensor 1 is detected, interrupt feeding is
executed.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
The HM1 instance of MC_Home is executed
when this variable changes to TRUE.
The HM2 instance of MC_Home is executed
when this variable changes to TRUE.
The MV_FEED instance of MC_MoveFeed is
executed when this variable changes to TRUE.
The MV_ABS instance of MC_MoveAbsolute is
executed when this variable changes to TRUE.
The MV_ZERO instance of MC_MoveZeroPosition is executed when this variable changes to
TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Sensor 1
Hm1_D
Hm2_D
Mv_Feed_Ex
Mv_Feed_D
Mv_Feed_InFeed
MC_MoveFeed
Mv_Feed_Bsy
Mv_Feed_Act
Mv_Abs_Ex
Mv_Abs_D
Mv_Abs_Bsy
3
Mv_Abs_Act
Sample Programming
Mv_Zero_Ex
Mv_Zero_D
Mv_Zero_Bsy
Mv_Zero_Act
Velocity
MC_Axis000
command current velocity
Time
Velocity
MC_Axis001
command current velocity
Time
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MV_FEED parameters
Mv_Feed_TrigRef.Mode
Mv_Feed_TrigRef.LatchID
Mv_Feed_TrigRef.InputDrive
Mv_Feed_TrigVar
Mv_Feed_Pos
Mv_Feed_Vel
Mv_Feed_Acc
Mv_Feed_Dec
Mv_Feed_Mm
Mv_Feed_FeedDis
Mv_Feed_FeedVel
:= _eMC_TRIGGER_MODE#_mcDrive;
:= _eMC_TRIGGER_LATCH_ID#_mcLatch1;
:= _eMC_TRIGGER_INPUT_DRIVE#_mcEXT;
:= FALSE;
:= LREAL#2000.0;
:= LREAL#1000.0;
:= LREAL#10000.0;
:= LREAL#10000.0;
:= _eMC_MOVE_MODE#_mcVelocity;
:= LREAL#500.0;
:= LREAL#500.0;
NY-series Motion Control Instructions Reference Manual (W561)
3-129
3 Axis Command Instructions
// MV_ABS parameters
Mv_Abs_Pos
:= LREAL#1000.0;
Mv_Abs_Vel
:= LREAL#500.0;
Mv_Abs_Acc
:= LREAL#10000.0;
Mv_Abs_Dec
:= LREAL#10000.0;
Mv_Abs_Jrk
:= LREAL#10000.0;
// MV_ZERO parameters
Mv_Zero_Vel
:= LREAL#500.0;
Mv_Zero_Acc
:= LREAL#10000.0;
Mv_Zero_Dec
:= LREAL#10000.0;
Mv_Zero_Jrk
:= LREAL#10000.0;
Mv_Zero_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo.
ELSE
Pwr1_En:=FALSE;
// Turn OFF the Servo.
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo for axis 2.
ELSE
Pwr2_En:=FALSE;
// Turn OFF the Servo for axis 2.
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF (MC_Axis000.MFaultLvl.Active=TRUE) OR (MC_Axis001.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed for axis 1.
IF (Pwr1_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed for axis 2.
IF (Pwr2_Status=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// After home is defined for axis 1, MC_MoveFeed is executed.
IF MC_Axis000.Details.Homed=TRUE THEN
Mv_Feed_Ex:=TRUE;
END_IF;
3-130
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
// If home is defined for axis 2 and interrupt feeding is completed for axis 1, absolute positioning is performed for
axis 2.
IF (MC_Axis001.Details.Homed=TRUE) AND (Mv_Feed_D=TRUE) THEN
Mv_Abs_Ex := TRUE;
END_IF;
// After MC_MoveAbsolute is started, MC_MoveZeroPosition is executed with multi-execution of instructions.
IF Mv_Abs_Act=TRUE THEN
Mv_Zero_Ex := TRUE;
END_IF;
MC_MoveFeed
// MC_Power for axis 1
PWR1(
Axis
Enable
Status
Busy
Error
ErrorID
:= MC_Axis000,
:= Pwr1_En,
=> Pwr1_Status,
=> Pwr1_Bsy,
=> Pwr1_Err,
=> Pwr1_ErrID
3
Sample Programming
);
// MC_Power for axis 2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_Status,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
// MC_Home for axis 1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home for axis 2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_MoveFeed
MV_FEED(
Axis
TriggerInput
TriggerVariable
Execute
Position
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
:= MC_Axis000,
:= Mv_Feed_TrigRef,
:= Mv_Feed_TrigVar,
:= Mv_Feed_Ex,
:= Mv_Feed_Pos,
NY-series Motion Control Instructions Reference Manual (W561)
3-131
3 Axis Command Instructions
Velocity
Acceleration
Deceleration
MoveMode
FeedDistance
FeedVelocity
Done
InFeed
Busy
Active
CommandAborted
Error
ErrorID
:= Mv_Feed_Vel,
:= Mv_Feed_Acc,
:= Mv_Feed_Dec,
:= Mv_Feed_Mm,
:= Mv_Feed_FeedDis,
:= Mv_Feed_FeedVel,
=> Mv_Feed_D,
=> Mv_Feed_InFeed,
=> Mv_Feed_Bsy,
=> Mv_Feed_Act,
=> Mv_Feed_Ca,
=> Mv_Feed_Err,
=> Mv_Feed_ErrID
);
// MC_MoveAbsolute
MV_ABS(
Axis
Execute
Position
Velocity
Acceleration
Deceleration
Jerk
Done
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis001,
:= Mv_Abs_Ex,
:= Mv_Abs_Pos,
:= Mv_Abs_Vel,
:= Mv_Abs_Acc,
:= Mv_Abs_Dec,
:= Mv_Abs_Jrk,
=> Mv_Abs_D,
=> Mv_Abs_Bsy,
=> Mv_Abs_Act,
=> Mv_Abs_Ca,
=> Mv_Abs_Err,
=> Mv_Abs_ErrID
// MC_MoveZeroPosition
MV_ZERO(
Axis
:= MC_Axis001,
Execute
:= Mv_Zero_Ex,
Velocity
:= Mv_Zero_Vel,
Acceleration
:= Mv_Zero_Acc,
Deceleration
:= Mv_Zero_Dec,
Jerk
:= Mv_Zero_Jrk,
BufferMode
:= Mv_Zero_Bm,
Done
=> Mv_Zero_D,
Busy
=> Mv_Zero_Bsy,
Active
=> Mv_Zero_Act,
CommandAborted => Mv_Zero_Ca,
Error
=> Mv_Zero_Err,
ErrorID
=> Mv_Zero_ErrID
);
3-132
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_Stop
The MC_Stop instruction decelerates an axis to a stop.
Instruction
MC_Stop
Name
Stop
FB/FUN
Graphic expression
FB
ST expression
MC_Stop_instance
MC_Stop
Axis
Done
Busy
Active
CommandAborted
Error
ErrorID
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or
FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Deceleration
Deceleration
Rate
LREAL
Non-negative
number
0
Specify the deceleration rate. The
unit is command units/s2.*1
Jerk
Jerk
LREAL
Non-negative
number
0
Specify the jerk. The unit is command units/s3.*1
BufferMode
Buffer Mode
Selection
_eMC_BUFFER_
MODE
0: _mcAborting
0*2
Specify the behavior when executing
more than one motion instruction.
0: Aborting
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-133
3
Variables
Variables
MC_Stop
Axis
Execute
Deceleration
Jerk
BufferMode
MC_Stop_instance (
Axis :=parameter,
Execute :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
BufferMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When the axis decelerates to a stop and the velocity
reaches 0.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Active
When the instruction is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
MC_Stop instruction was executed with the Buffer
Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_Stop instruction decelerates an axis from the current velocity to a velocity of 0.
• The deceleration stop operation starts when Execute changes to TRUE.
• CommandAborted for the instruction that is currently in operation will change to TRUE when
MC_Stop is executed.
Precautions for Correct Use
You cannot execute this instruction if the Status.ErrorStop (Error Deceleration Stopping) variable
that gives the status of this axis is TRUE.
Use the MC_ImmediateStop instruction to stop the motion of an axis that is decelerating to a
stop for an error.
3-134
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Instruction Details
This section describes the instruction in detail.
z Specifying Deceleration and Jerk
Set the input variables Deceleration and Jerk to set the deceleration rate and jerk when decelerating
to a stop.
The relationship between the deceleration and velocity when Jerk is set to 0 and when it is set to any
other value is shown below.
MC_Stop
Jerk Set to 0
The command value for the velocity is created with deceleration rate Dt.
Velocity
3
Vt
Function
Velocity
Time
Deceleration rate
Time
-Dt
Jt = 0
Jerk
Time
Vt: Velocity when deceleration starts, Dt: Specified deceleration rate, Jt: Specified jerk
Jerk Set to Any Value Other Than 0
The command value for the velocity is created based on the current velocity with Dt as the upper
limit to the deceleration rate.
Velocity
Vt
Velocity
Time
Deceleration rate
Time
-Dt
Jt
Jerk
Time
-Jt
Vt: Velocity when deceleration starts, Dt: Specified deceleration rate, Jt: Specified jerk
NY-series Motion Control Instructions Reference Manual (W561)
3-135
3 Axis Command Instructions
Additional Information
If you set the deceleration to 0, an Immediate Stop instruction is executed. This will stop the axis
immediately without decelerating. An immediate stop occurs regardless of the setting of the
Acceleration/Deceleration Over Limit Selection only when the deceleration rate is set to 0.
z Specifying BufferMode (Buffer Mode Selection)
BufferMode specifies how to join the axis motions for this instruction and the previous instruction.
BufferMode (Buffer Mode Selection) of this instruction is a reserved parameter for future expansion.
There is currently only the following setting.
Buffer Mode Selection
Aborting
Description
Aborts the instruction being executed and executes this instruction.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z In-position Check
An in-position check is not performed when stopping for this instruction.
3-136
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• Done changes to TRUE when a velocity of 0 is reached.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing) and Active (Controlling) change to FALSE.
Executing an Axis Instruction
Execute
MC_Stop
Done
Busy
3
Active
CommandAborted
Function
Error
ErrorID
16#0000
Executing MC_Stop Instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Velocity
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-137
3 Axis Command Instructions
Re-execution of Motion Instructions
Deceleration (Deceleration Rate) changes if Execute is changed to TRUE again while this instruction is
in execution. The Jerk setting is not changed when a motion control instruction is re-executed.
z Jerk Set to Any Value Other Than 0
The command value for the velocity is created based on the current velocity and deceleration rate,
with Dt2 as the upper limit to the deceleration rate after it is changed.
Velocity
Vt
Executed.
Re-executed.
Velocity
Time
Deceleration rate
-Dt2
-Dt1
Jt
Time
Jerk
Time
-Jt
Vt: Velocity when deceleration starts, Dt: Specified deceleration rate, Jt: Specified jerk
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
Axes Group Moving
If the MC-Stop instruction is executed for an axis that is in an axes group motion, an error will occur
for the axis. An error will occur also for the axes group, and the axes group motion will stop.
When the Status.ErrorStop (Error Deceleration Stop) Axis Variable Is TRUE
Status.ErrorStop (Error Deceleration Stopping) in the Axis Variable is TRUE while there is an error
for the axis. If the MC_Stop instruction is not executed normally for an axis that is decelerating to a
stop for an error. CommandAborted changes to TRUE. Use the MC_ImmediateStop instruction to
stop the motion of an axis for which an error occurred.
During Execution of the MC_ResetFollowingError (Reset Following Error
Counter) Instruction
If the MC_Stop instruction is executed during the MC_ResetFollowingError (Reset Following Error
Counter) instruction, CommandAborted from the MC_ResetFollowingError instruction changes to
TRUE. The MC_Stop instruction is executed. However, Deceleration (Deceleration Rate) to the
MC_Stop instruction is not used and an immediate stop is performed.
3-138
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Execution of Other Instructions during Instruction Execution
• If any of the following is executed while the axis is not decelerating to a stop for an MC_Stop
instruction, Status.Stopping in the Axis Variable changes to TRUE.
MC_ResetFollowingError (Reset Following Error Counter) instruction
An immediate stop for the MC_TouchProbe (Enable External Latch) instruction
When Execute is TRUE for any other MC_Stop instruction
• Operation is as follows for an axis for which Status.Stopping (Deceleration Stopping) is TRUE.
• If single-axis positioning, continuous positioning, synchronized operation, or manual operation
is performed, CommandAborted from the instruction changes to TRUE.
• Multi-execution of more than one MC_Stop Instruction is possible. Done from the first
MC_Stop instruction changes to TRUE.
• Done of the MC_Stop instruction changes to TRUE when one of the following conditions is met
after the MC_Stop instruction is executed.
• When _mcImmediateStop is selected for the StopMode input variable to the MC_TouchProbe
(Enable External Latch) instruction, the trigger condition is met, and the OMRON 1S-series
Servo Drive or G5-series Servo Drive stops immediately
NY-series Motion Control Instructions Reference Manual (W561)
3-139
3
Function
• When the Enable input variable for the MC_Power instruction changes to FALSE (when the
Servo is turned OFF)
MC_Stop
• If the MC_ResetFollowingError (Reset Following Error Counter) instruction is executed during
MC_Stop instruction execution, Done from the MC_Stop instruction changes to TRUE and the
MC_ResetFollowingError instruction is executed.
3 Axis Command Instructions
Errors
Operation will stop if an error (e.g., axis error) occurs during instruction execution.
Specify the stopping method in the axis parameters. The stopping method can be immediate stop,
deceleration stop, or Servo OFF. If you specify a deceleration stop, the axis will continue decelerating
until it stops.
For details on setting the Stop Mode in the axis parameters, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Timing Chart When Error Occurs
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
MC_MoveVelocity
Execute
Busy
Active
CommandAborted
Error
ErrorID
16#0000
MC_Stop
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
Velocity
The current instruction is stopped for an
error if an axis error occurs.
Time
3-140
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Version Information
Operation when an error is reset depends on the unit version of the CPU Unit as follows:
Note that you must reset errors only after the axis has stopped. Do not reset errors during axis
motion.
• A CPU Unit with unit version 1.10 or later:
If you clear the error for this instruction, the instruction will not start until Execute changes to
TRUE again.
Ver. 1.10 or Later
MC_Stop
Execute
Done
Busy
3
Active
Error reset.
Error
ErrorID
Function
CommandAborted
Error code
16#0000
• A CPU Unit with unit version 1.09 or earlier:
If an error occurs for this instruction and the error is reset while Execute is TRUE, operation
will be performed as follows.
• If the cause of the error has already been removed, Error changes to FALSE and Done
changes to TRUE. Status.Stopping (Deceleration Stopping) in the Axis Variable changes
to TRUE in the same way as for normal execution of the deceleration stop.
• If the cause of the error has not been removed, Error changes to TRUE again for this
instruction and an axis error occurs.
In the following timing chart, the cause of the error is removed.
Ver. 1.09 or Earlier
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
16#0000
Error reset.
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-141
3 Axis Command Instructions
MC_ImmediateStop
The MC_ImmediateStop instruction stops an axis according to the stopping mode that is set with the
StopMode (Stopping Mode Selection) input variable regardless of the status of the axis.
Instruction
Name
MC_ImmediateStop Immediate
Stop
FB/
FUN
FB
Graphic expression
ST expression
MC_ImmediateStop_instance
MC_ImmediateStop_instance (
Axis :=parameter,
Execute :=parameter,
StopMode :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_ImmediateStop
Axis
Execute
StopMode
Axis
Done
Busy
CommandAborted
Error
ErrorID
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
StopMode
Stopping
Mode
Selection
_eMC_
STOP_MODE
1: _mcImmediateStop
1*
Select the stopping mode.
2: _mcImmediateStopFEReset
3: _mcFreeRunStop
1: Perform an immediate stop.
2: Perform an immediate stop and
reset the following error counter.
3: Perform an immediate stop and
turn OFF the Servo.
* The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-142
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the axis has decelerated to a stop.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is canceled because
another MC_Stop instruction was executed with
the Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
3
Axis
Meaning
Axis
Function
In-Out Variables
Name
MC_ImmediateStop
Done
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• You can execute the MC_ImmediateStop instruction under any conditions.
For example, you can use this instruction to stop an axis immediately even if it is decelerating to a
stop for an error.
You cannot execute the MC_Stop while Status.ErrorStop (Error Deceleration Stopping) is TRUE, but
you can execute the MC_ImmediateStop.
• When this instruction is executed, the axis stops immediately according to StopMode (Stopping Mode
Selection). CommandAborted changes to TRUE for the instruction that is currently in operation.
• Status.ErrorStop (Error Deceleration Stopping) in the axis status changes to TRUE when this instruction is executed and an Immediate Stop Instruction Executed error (error code: 5485 hex) occurs.
Precautions for Correct Use
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
NY-series Motion Control Instructions Reference Manual (W561)
3-143
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE when Execute changes to TRUE.
• Done changes to TRUE when processing of the Immediate Stop instruction is completed.
MC_Move Instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
MC_ImmediateStop Instruction
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Velocity
Time
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
3-144
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
If the instruction is executed for an axis that is in an axes group motion, an error will occur for the
axis and an immediate stop is performed. An error will also occur for the axis group, and the axis
group motion will stop.
MC_ImmediateStop
Axes Group Moving
When the Status.Stopping (Deceleration Stopping) Axis Variable Is TRUE
Status.Stopping (Deceleration Stopping) in the Axis Variable changes to TRUE in the following
cases.
3
• While the axis is decelerating for the MC_Stop Instruction
• During an immediate stop for the MC_TouchProbe (Enable External Latch) instruction
• While Execute is TRUE for one or more MC_Stop instructions
You can execute this instruction for an axis for which Status.Stopping (Deceleration Stopping) is
TRUE.
When this instruction is executed, CommandAborted from the following instructions changes to
TRUE.
• MC_Stop instruction
• MC_ResetFollowingError (Reset Following Error Counter) instruction
• MC_TouchProbe (Enable External Latch) instruction (during the immediate stop)
When the Status.ErrorStop (Error Deceleration Stop) Axis Variable Is TRUE
Status.ErrorStop (Error Deceleration Stopping) in the axis status is TRUE while there is an error for
the axis.
You can execute this instruction even for an axis that is decelerating to a stop for an error.
NY-series Motion Control Instructions Reference Manual (W561)
3-145
Function
• During execution of the MC_ResetFollowingError (Reset Following Error Counter) instruction
3 Axis Command Instructions
Error
The axis will stop immediately even if an error (e.g., axis error) occurs during instruction execution.
For details on setting the Stop Mode in the axis parameters, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Timing Chart When Error Occurs
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-146
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SetPosition
The MC_SetPosition instruction changes the command current position or the actual current position of
an axis as required.
Instruction
Name
Set Position
FB/FUN
FB
ST expression
MC_SetPosition_instance
MC_SetPosition_instance (
Axis :=parameter,
Execute :=parameter,
Position :=parameter,
ReferenceType
:=parameter,
Relative :=parameter,
ExcutionMode :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_SetPosition
Axis
Axis
Execute
Done
Position
Busy
ReferenceType
CommandAborted
Relative
Error
ExecutionMode
ErrorID
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Position
Target Position
LREAL
Negative number,
positive number, or
0
0
Specify the absolute target
position. The unit is command units.*1
ReferecneType
Position Type
Selection
_eMC_REFERENCE_
TYPE
0: _mcCommand
0*2
Specifies the position type.
1: _mcFeedback
0: Command position (servo
axis or virtual servo axis)
1: Actual position (encoder
axis or virtual encoder
axis)
Relative
(Reserved)
Relative Position Selection
BOOL
TRUE or FALSE
FALSE
(Reserved)
MC_Execution
Mode
(Reserved)
Execution
Mode
_eMC_EXECUTION_
MODE
0: _mcImmediately
0*2
(Reserved)
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
NY-series Motion Control Instructions Reference Manual (W561)
3-147
3
Variables
Graphic expression
MC_SetPosition
MC_SetPosition
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When changing the command current position and
the actual current position are completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
CommandAborted
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• This instruction changes the command current position of the Servo axis to the specified target position. If you execute this instruction on an encoder axis, the actual current position will change to the
specified target position.
• Specify the target position in absolute coordinates.
• The actual current position changes at the same time as the command current position changes. The
following error is kept the same before and after the change. If you execute this instruction on a command servo axis, the difference between the actual position and the actual current position will
remain the same before and after the change. Because of this, after you execute this instruction, the
actual current position of the axis takes the value calculated by the following equation.
Actual current position after change = Target position − Following error before change
• If you specify the actual position for a servo axis or the command position for an encoder axis, a position type error will occur.
3-148
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• When the Count Mode is set to Rotary Mode, set the target position to a value that is equal to or
greater than the modulo minimum position and less than the modulo maximum position. A ring
counter error will occur if the target position is outside this range.
• When the Count Mode is set to Linear Mode, you can set the target position to a value outside the
range defined by the software limits.
• You can use this instruction for an axis that is stopped or in motion.
Precautions for Correct Use
• Software limits
• MC_MoveZeroPosition (High-speed Home) instruction
• Multi-axes coordinated control instructions (linear or circular interpolation)
3
z ReferenceType (Position Type Selection)
Function
• Set ReferenceType to the command position to use a servo axis or virtual servo axis.
• Set ReferenceType to the actual position to use an encoder axis or virtual encoder axis.
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
Axis Type
Servo axis
Encoder axis
Virtual servo axis
Virtual encoder axis
ReferenceType
_mcCommand
OK
No*
OK
No*
_mcFeedback
No
OK
OK
OK
* A Position Type Selection Out of Range error (error code 5430 hex) occurs when the instruction is executed.
Timing Charts
z Execution While Axis Is Stopped
The actual position starts changing when Execute changes to TRUE. Busy (Executing) changes to
TRUE when Execute changes to TRUE. Done changes to TRUE after the actual position is
changed.
Execute
Done
Busy
NY-series Motion Control Instructions Reference Manual (W561)
MC_SetPosition
Home is undefined for the specified axis after this instruction ends. Because of this, you cannot
execute following functions or instructions after this instruction ends.
3-149
3 Axis Command Instructions
z Execution While Axis Is in Motion
If you execute this instruction while positioning to an absolute position, the target value will change
according to the change in position.
As an example, the axis operation and timing chart are shown below for a situation where the actual
position is changed from 200 mm to 800 mm while the axis is moved to 400 mm for an MC_MoveAbsolute (Absolute Positioning) instruction. The axis will move in the negative direction because the
actual value is 800 mm and the target value is 400 mm. As shown in the following figure, even if the
actual position is changed, the MC_MoveAbsolute (Absolute Positioning) instruction will move the
axis from the new actual position to the specified target position. When the specified target position
is reached, Done changes to TRUE.
Previous Instruction (Example MC_MoveAbsolute)
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Point where actual position is 200 mm
Current Instruction (MC_SetPosition)
Execute
Done
Busy
Velocity
The actual position changes to
800 mm and reverse operation
is performed to move to a
position of 400 mm.
Time
Additional Information
• If you execute this instruction while the MC_MoveRelative (Relative Positioning) or
MC_MoveVelocity (Velocity Control) instruction is in execution, the actual position will change.
However, if you execute this instruction while the MC_MoveRelative (Relative Positioning) or
MC_MoveVelocity (Velocity Control) instruction is in execution, the positioning operation is not
affected.
• If there is a buffered instruction, positioning is performed for the position after the change
when the buffer is switched.
3-150
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Instructions
z Execution during Execution of Other Instructions
You cannot use the MC_SetPosition instruction on an axis for which any of the following instructions
is being executed. A multi-execution of instructions error will occur if it is executed.
MC_MoveLink (Synchronous Positioning) instruction
MC_Home (Home) instruction
MC_CombineAxes (Combine Axes) instruction
MC_HomeWithParameter (Home with Parameters)
instruction
MC_MoveZeroPosition (High-speed Home) instruction
MC_CamIn (Start Cam Operation) Instruction
MC_TorqueControl (Torque Control) Instruction
MC_GearIn (Start Gear Operation) Instruction
MC_SyncMoveVelocity (Cyclic Synchronous Velocity
Control) instruction
MC_GearInPos (Positioning Gear Operation) instruction
Precautions for Correct Use
CPU Units with Unit Version 1.09 or Earlier
Do not use the MC_SetPosition instruction for Master (Master Axis) that is in synchronized operation for instructions such as MC_GearIn (Start Gear Operation). If it is used for a Master (Master Axis), as soon as the command current position and the actual current position of the Master
(Master Axis) are changed, the Slave (Slave Axis) will detect that the Master (Master Axis) has
moved. It will then begin moving corresponding to the Master (Master Axis) travel distance. For
this reason, the Slave (Slave Axis) may change suddenly or the cam motion may end suddenly.
If you want to use the MC_SetPosition instruction for the Master (Master Axis), disable the relationship between the Master (Master Axis) and slave axes before executing the instruction. Execute an instruction such as the MC_GearOut (End Gear Operation) instruction to disable the
relationship between the Master (Master Axis) and Slave (Slave Axis).
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
z Execution of Other Instructions during Instruction Execution
If another MC_SetPosition instruction is executed while there is one already in execution, the last
instruction takes priority.
In this case, Done for the first MC_SetPosition instruction will change to TRUE, but the change to
the set position for the first instruction is not completed.
NY-series Motion Control Instructions Reference Manual (W561)
3-151
3
Function
MC_MoveJog (Jog) instruction
MC_SetPosition
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
Additional Information
If you execute this instruction while the axis is in motion, the instruction of the axis currently in
motion will be restarted and the data required for positioning will be recalculated. If an error
occurs, it will be for the instruction of the axis currently in motion rather than for this instruction.
z Timing Chart When Error Occurs
Execute
Busy
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-152
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SetOverride
The MC_SetOverride instruction changes the target velocity for an axis.
Instruction
MC_SetOverride
Name
FB/FUN
FB
Graphic expression
ST expression
MC_SetOverride_instance
MC_SetOverride_instance (
Axis :=parameter,
Enable :=parameter,
VelFactor :=parameter,
AccFactor :=parameter,
JerkFactor :=parameter,
Enabled =>parameter,
Busy =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_SetOverride
Axis
Enable
VelFactor
AccFactor
JerkFactor
Axis
Enabled
Busy
Error
ErrorID
Input Variables
Meaning
Data type
Valid range
Default
Description
Enable
Enable
BOOL
TRUE or FALSE
FALSE
The override factors are enabled when
Enable is TRUE. The override factors
return to 100% when Enable changes to
FALSE.
VelFactor
Velocity Override Factor
LREAL
0 to 500
100
Specify the velocity override factor. The
valid range of the override factors is
between 0.01and 500.00. Values above
500.00 are treated as 500 and values
less then 0.01 (including negative values) are treated as 0.01. The override
factor will be 0 only when 0 is specified.
The unit is %.
AccFactor
(Reserved)
Acceleration/Deceleration Override
Factor
LREAL
0 to 500
100
(Reserved)
JerkFactor
(Reserved)
Jerk Override
Factor
LREAL
0 to 500
100
(Reserved)
Output Variables
Name
3
Variables
Variables
Name
MC_SetOverride
Set Override
Factors
Meaning
Data type
Valid range
Description
Enabled
Enable
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-153
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Enabled
When this instruction is started.
• After one period when Enable is FALSE.
• When Error changes to TRUE.
Busy
When Enable changes to TRUE.
• When Enable changes to FALSE.
• When Error changes to TRUE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_SetOverride instruction changes override factors related to the target velocity of the axis.
Changes the target velocity of the axes in operation by changing the override.
• The override factors apply only to the following instructions.
MC_Move (Positioning) instruction
MC_MoveJog (Jog) instruction
MC_MoveAbsolute (Absolute Positioning) instruction
MC_MoveFeed (Interrupt Feeding) instruction
MC_MoveRelative (Relative Positioning) instruction
MC_MoveZeroPosition (High-speed Home) instruction
MC_MoveVelocity (Velocity Control) instruction
• The new target velocity is found with the following equation.
The target velocity after the change = Target velocity of the current instruction × Override factor
• The unit for override factors is %. A setting of 100 indicates 100%.
• If the target velocity that results from the override exceeds the maximum velocity set in the axis
parameters, the maximum velocity is used.
• The axis will accelerate or decelerate to the target velocity that results from the override.
• If the velocity override factor is set to 0, the target velocity will be 0. Axis operation will decelerate to a
velocity of 0, and operation will continue. If you want to pause the axis motion while maintaining the
operation status, set the override factor to 0.
Status.Discrete and Status.Continuous in the Axis Variable do not change at this time.
• The override factors are always updated when the instruction is executed as long as Enable remains
TRUE.
• The override factors apply to operation commands for new target velocities, e.g., when you start a
stopped axis, re-execute a motion instruction, or perform multi-execution of motion control instructions.
• The override factors will return to 100% when Enable changes to FALSE.
• If an axis error occurs during MC_SetOverride instruction execution, the value of Enabled for the
MC_SetOverride instruction remains TRUE.
3-154
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
When Enable to this instruction changes to FALSE, Enabled and Busy from this instruction
change to FALSE.
The axis will accelerate or decelerate to a velocity with a 100% override factor.
Additional Information
Use this instruction to temporarily change the target velocities of other instructions.
This instruction has no affect on instructions to which a target velocity is not input or instructions
for which the target velocity is updated every period, such the Cyclic Synchronous Velocity Control instruction. However, Enabled remains TRUE even if the MC_SetOverride (Set Override
Factors) instruction is executed for an instruction to which it does not apply.
MC_SetOverride
Influence on Other Instructions
3
Function
Timing Charts
z Overriding the MC_MoveAbsolute Instruction
An example of a time chart for using the Set Override Factors instruction for the MC_MoveAbsolute
(Absolute Positioning) instruction is given below.
Previous Instruction: MC_MoveAbsolute
Execute
Done
Busy
Active
CommandAborted
Current Instruction
Enable
VelFactor
100
200
50
Enabled
Busy
Velocity
Override factor: 200%
Override factor: 100%
Override factor: 50%
Time
If the MC_SetOverride instruction is disabled, the target velocity returns to an override factor of
100%.
NY-series Motion Control Instructions Reference Manual (W561)
3-155
3 Axis Command Instructions
z Overrides for the MC_MoveVelocity (Velocity Control) Instruction
An example of a time chart for using the Set Override Factors instruction for the MC_MoveVelocity
(Velocity Control) instruction is given below. After InVelocity (Target Velocity Reached) changes to
TRUE, it will stay TRUE even if the velocity changes.
Previous Instruction: MC_MoveVelocity
Execute
InVelocity
Busy
Active
Current Instruction
Enable
VelFactor
100
200
50
Enabled
Busy
Velocity
Override factor: 200%
Override factor: 100%
Override factor: 50%
Time
Re-execution of Motion Instructions
You cannot re-execute enable-type motion control instructions.
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Multi-execution of MC_SetOverride Instructions
If another instance of MC_SetOverride is executed for the same axis during MC_SetOverride
instruction execution, the last MC_SetOverride instance that is executed takes priority in processing.
Enable will be TRUE for both instructions.
Concretely, the override values of the instance that was executed last are valid. If Enable to the
instance that was executed last changes to FALSE, the overrides are disabled.
3-156
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE. If a minor fault occurs, the
axis will stop.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code). If you
remove the cause of error, Error will change to FALSE.
z Timing Chart When Error Occurs
MC_SetOverride
Enable
VelFactor
200
Enabled
Busy
3
Error
16#0000
Function
ErrorID
Error code
Velocity
Override factor: 200%
Override factor: 100%
Time
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-157
3 Axis Command Instructions
MC_ResetFollowingError
The MC_ResetFollowingError instruction resets the following error between the command current position and the actual current position.
FB/
FUN
Instruction
Name
MC_ResetFollowingError
Reset
Following
Error Counter
FB
Graphic expression
ST expression
MC_ResetFollowingError_instance
MC_ResetFollowingError_
instance (
Axis :=parameter,
Execute :=parameter,
BufferMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_ResetFollowingError
Axis
Execute
BufferMode
Axis
Done
Busy
Active
CommandAborted
Error
ErrorID
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when Execute changes to TRUE.
BufferMode
Buffer Mode
Selection
_eMC_
BUFFER_
MODE
0: _mcAborting
0*
Specify the behavior when executing
more than one motion instruction.
0: Aborting
* The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-158
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Active
When the instruction is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When the MC_ResetFollowingError instruction is
aborted because another motion control instruction was executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
Error
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_ResetFollowingError instruction resets the following error between the command current
position and the actual current position in the MC Function Module to 0 in Cyclic Synchronous Position (CSP) Control Mode.
• When Execute changes to TRUE, the actual current position at that point is used as the command
position (i.e., the target position).
For example, when a following error occurs in the holding operation shown below, you can execute
this instruction to implement a position command in the reverse direction and therefore set the following error to 0.
CommandAborted for the instruction for which the following error occurred changes to TRUE and
instruction execution is aborted.
NY-series Motion Control Instructions Reference Manual (W561)
3
Function
When resetting the following error counter is completed.
MC_ResetFollowingError
Done
3-159
3 Axis Command Instructions
Position
Target position in the holding
direction (position command value)
Command position
Holding stop position
Actual position
(actual position of motor)
Time
Velocity
Command
velocity
Target velocity in the holding direction
(velocity command value)
Time
Command sent to set
the following error to 0.
Actual velocity
(actual velocity
of motor)
Following error
Start
Holding
Time
Reset Following
Error Counter executed.
• When the following error is set to 0, the maximum velocity that is set in the axis parameters is used to
implement a position command. The maximum acceleration and deceleration rates are not used.
• When the command to the new target position is completed, the Done output variable changed to
TRUE.
• This instruction implements a command position in the reverse direction to the direction in which the
following error occurred, but the Operation Selection at Reversing axis parameter is not used.
Precautions for Correct Use
• Execute this instruction only when the axis velocity is low.
This instruction implements a command value in the opposite direction to the previous instruction (e.g., in the opposite direction to the holding direction). If the axis speed is too high when
this instruction is executed, the controlled system may be subjected to shock.
• Before you execute this instruction for a vertical axis, for which constant torque is required,
make sure that the torque will not become insufficient.
• If an NX-series Pulse Output Unit is used, the following error in the Servo Drive that is connected to the Pulse Output Unit is not reset. Refer to the NX-series Position Interface Units
User’s Manual (Cat. No. W524) for details.
• Executing this Instruction for the Master Axis of Synchronized Control
If this instruction is executed for the master axis of synchronous control when the command
position is used as the synchronization data for the master axis, the slave axis will move in
the reverse direction according to the gear ratio or cam data variable.
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for
precautions on the master axis.
Instruction Details
This section describes the instruction in detail.
z Applicable Axes and Execution Condition
• You can use this instruction for servo and virtual servo axes in the following cases.
During single-axis position control
During the MC_MoveVelocity (Velocity Control) instruction
During synchronized control
• An error occurs if the instruction is executed for an encoder or virtual encoder axis.
3-160
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Axis Variable Status
Status.Stopping (Deceleration Stopping) in the Axis Variable status changes to TRUE.
z Executing this Instruction during Control Mode Changes
CPU Units with Unit Version 1.10 or Later
The following error between the command current position and the actual current position is reset to
0 immediately after the change to Position Control Mode is completed.
CPU Units with Unit Version 1.09 or Earlier
The following error between the command current position and the actual current position is reset to
0 as soon as the MC_ResetFollowingError instruction is executed.
NY-series Motion Control Instructions Reference Manual (W561)
3-161
3
Function
Refer to MC_TorqueControl on page 3-312 and MC_SyncMoveVelocity on page 3-369 for details on
changing the control mode.
MC_ResetFollowingError
If you execute an instruction that changes the control mode to Position Control Mode during execution of the MC_TorqueControl (Torque Control) or MC_SyncMoveVelocity (Cyclic Synchronous
Velocity Control) instruction and then execute the MC_ResetFollowingError instruction before the
change to Position Control Mode is actually completed, the timing for resetting the following error to
0 depends on the unit version of the CPU Unit as described below.
3 Axis Command Instructions
Timing Charts
Timing charts for when this instruction is executed during holding status for the MC_MoveAbsolute
(Absolute Positioning) instruction are given below.
MC_MoveAbsolute instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
MC_ResetFollowingError instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Position
Command position
Actual position
Velocity
Holding status
Command velocity
Time
Actual velocity
Time
3-162
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
Buffer Mode Selection
Aborting
Description
Cancels the instruction being executed and switches to this instruction.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Relation to MC_Stop Instruction
If the MC_ResetFollowingError (Reset Following Error Counter) instruction is executed during
MC_Stop instruction execution, Done from the MC_Stop instruction changes to TRUE and the
MC_ResetFollowingError instruction is executed.
z Execution of Other Instructions during Instruction Execution
The axis decelerates to a stop when this instruction is executed.
Execute an instruction for which multi-execution is supported while the axis is decelerating.
If an instruction for which multi-execution is not supported is executed, CommandAborted for the
instruction changes to TRUE.
Relation to MC_Stop Instruction
If the MC_Stop instruction is executed during the MC_ResetFollowingError (Reset Following Error
Counter) instruction, CommandAborted from the MC_ResetFollowingError instruction changes to
TRUE. The MC_Stop instruction is executed. However, Deceleration (Deceleration Rate) to the
MC_Stop instruction is not used and an immediate stop is performed.
NY-series Motion Control Instructions Reference Manual (W561)
3-163
3
Function
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction.
You can buffer one instruction per axis.
Specify the operation of this instruction by using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
MC_ResetFollowingError
Multi-execution of Motion Control Instructions
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, an immediate stop is performed and CommandAborted
changes to TRUE. Also, if an error occurs when this instruction is executed, Error will change to TRUE.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Timing charts for when the MC_MoveAbsolute (Absolute Positioning) instruction is executed and an
error occurs when the MC_ResetFollowing Error is executed during holding status are given below.
MC_MoveAbsolute instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
MC_ResetFollowingError Instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-164
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_CamIn
The MC_CamIn instruction starts a cam operation by using a specified cam table.
Instruction
MC_CamIn
Name
Start Cam
Operation
FB/
FUN
FB
MC_CamIn_instance
MC_CamIn_instance (
Master :=parameter,
Slave :=parameter,
CamTable :=parameter,
Execute :=parameter,
Periodic :=parameter,
StartMode :=parameter,
StartPosition :=parameter,
MasterStartDistance :=parameter,
MasterScaling :=parameter,
SlaveScaling :=parameter,
MasterOffset :=parameter,
SlaveOffset :=parameter,
ReferenceType :=parameter,
Direction :=parameter,
CamTransition :=parameter,
BufferMode :=parameter,
InCam =>parameter,
InSync =>parameter,
EndOfProfile =>parameter,
Index =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_CamIn
Master
Master
Slave
Slave
CamTable
CamTable
Execute
InCam
InSync
Periodic
EndOfProfile
StartMode
StartPosition
Index
MasterStartDistance
Busy
Active
MasterScaling
CommandAborted
SlaveScaling
Error
MasterOffset
ErrorID
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Periodic
Periodic
Mode
BOOL
TRUE or FALSE
FALSE
Specify whether to execute
the specified cam table periodically or only once.
FALSE: Non-periodic
TRUE: Periodic
StartMode
Start Mode
_eMC_
START_MODE
0: _mcAbsolutePosition
1: _mcRelativePosition
0*1
Specify the coordinates
used by MasterStartDistance.
0: Absolute position
1: Relative position
NY-series Motion Control Instructions Reference Manual (W561)
3-165
3
Variables
ST expression
MC_CamIn
Graphic expression
3 Axis Command Instructions
Name
Meaning
Data type
Valid range
Default
Description
StartPosition
Cam Table
Start Position
LREAL
Negative number, positive number, or 0
0
Specify the starting point of
the cam table (0 phase) as
an absolute position of the
master axis. The unit is command units.*2
MasterStart Distance
Master Following Distance
LREAL
Negative number, positive number, or 0
0
Specify the position of the
master axis when the following axis starts the cam
motion. When absolute positioning is specified with
StartMode, specify the absolute position of the master
axis. When relative positioning is specified, specify a relative distance from the
StartPosition (Cam Table
Start Position). The unit is
command units.*2
Master Scaling
Master
Coefficient
LREAL
Positive value (>0.0)
1.0
The phase of the master
axis is extended or contracted by using the specified scale.
SlaveScaling
Slave Axis
Coefficient
LREAL
Positive value (>0.0)
1.0
The displacement of the
slave axis is extended or
contracted by using the
specified scale.
MasterOffset
Master Offset
LREAL
Negative number, positive number, or 0
0
The phase of the master
axis is shifted by using the
specified offset value.
SlaveOffset
Slave Offset
LREAL
Negative number, positive number, or 0
0
The displacement of the
slave axis is shifted by using
the specified offset value.
Reference Type
Position
Type
Selection
_eMC_REFERENCE_ TYPE
0: _mcCommand
1: _mcFeedback
2: _mcLatestCommand
0*1
Specify the position type of
the master axis.
Direction
Direction
_eMC_DIRECTION
0: _mcPositiveDirection
2: _mcNegativeDirection
4: _mcNoDirection
4*1
The slave axis cam moves
when the master axis moves
in the specified direction
only. If the master axis is
moving opposite to the direction specified, the slave axis
cam is stopped.
0: Positive direction
2: Negative direction
4: No direction specified
CamTransition
(Reserved)
Cam Transition
Selection
_eMC_CAM_
TRANSITION
0: _mcCTNone
0*1
(Reserved)
3-166
0: Command position (value
calculated in the previous
task period*3)
1: Actual position (value
obtained in the same task
period*3)
2: Command position (value
calculated in the same
task period*3)
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
BufferMode
Meaning
Buffer
Mode
Selection
Data type
Valid range
_eMC_
BUFFER_MODE
Default
0: _mcAborting
1: _mcBuffered
2: _mcBlendingLow*4
3: _mcBlendingPrevious*4
4: _mcBlendingNext*4
5: _mcBlendingHigh*4
0*1
Description
Specify the behavior when
executing more than one
motion instruction.
0: Aborting
1: Buffered
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*3 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
*4 A CPU Unit with unit version 1.06 or later and Sysmac Studio version 1.07 or higher are required for these settings. The
operation is the same regardless of which of the four types of blending is specified.
Meaning
3
Variables
Output Variables
Name
MC_CamIn
*1 The default value for an enumeration variable is actually not the number, but the enumerator.
Data type
Valid range
Unit
Description
InCam
Cam Motion
BOOL
TRUE or
FALSE
---
TRUE when the cam table start point is executed.
InSync
In Sync
BOOL
TRUE or
FALSE
---
TRUE when the cam is in operation.
EndOfProfile
End of Cam
Cycle
BOOL
TRUE or
FALSE
---
TRUE when the cam table end point is executed.
Index
Index
UINT
Nonnegative value
---
Contains the cam data index number.*1
Busy
Executing
BOOL
TRUE or
FALSE
---
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
---
TRUE when the axis is being controlled.
Command Aborted
Command
Aborted
BOOL
TRUE or
FALSE
---
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
---
TRUE while there is an error.
ErrorID
Error Code
WORD
*2
---
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
*1 FALSE while InCam (Cam In Motion) is FALSE.
*2 Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-167
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
InSync
When the slave axis starts cam operation.
• When Periodic is FALSE and EndOfProfile
changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
EndOfProfile
The period where the phase and displacement of the end point of the cam table are
output as the command position.
One period after EndofProfile changes to TRUE.
Busy
When Execute changes to TRUE.
• When Periodic is FALSE and EndOfProfile
changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
InCam
When the master axis passes the StartPosition (Cam Table Start Position).
• When Periodic is FALSE and EndOfProfile
changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Periodic is FALSE and EndOfProfile
changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to an
error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When the MC_CamOut instruction is executed.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
Note The update timing of the output variables may change depending on the mode that is set for cam switching. The default
timing is given above.
In-Out Variables
Meaning
Data type
Master
Name
Master Axis
_sAXIS_REF
---
Valid range
Description
Specify the master axis.*1
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*1
CamTable
Cam Table
ARRAY[0..N]OF
_sMC_CAM_
REF
---
Specify the cam data structure _sMC_CAM_REF array variable as the cam table.*2
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 N in the array variable is set automatically by the Sysmac Studio. Specify a cam data variable that was created on Cam
Editor of the Sysmac Studio.
3-168
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
If you specify the same axis for the master axis and slave axis, a Master and Slave Defined as
Same Axis minor fault (error code 5436 hex) will occur.
Function
• You must create the cam table specified for this instruction by using the Cam Editor and download it
to the Controller in advance.
• This instruction is executed when Execute changes to TRUE.
3
Precautions for Correct Use
Additional Information
Use the Synchronize Menu of the Sysmac Studio to download the project.
For details on cam tables, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No.
W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No.
W559).
Specify the phases and displacements in the cam table as relative quantities from a start point of 0.0.
The command positions for the master and slave axes are linear interpolations between two cam data
where the slave axis displacement corresponding to the master axis phase is calculated.
If there are only a few cam data, the intervals between phases are large and cam operation will not be
very precise. If there are many cam data, the intervals between phases are small and cam operation
will be very precise.
1 cycle Command position during electronic cam operation
Start
point
0
0
Cam data
60
200
1
120
100
2
180
300
3
240
100
4
300
200
5
360
0
6
End point
The phase is calculated from the master
axis position for each cycle. The linear
interpolation of cam data is used to
calculate displacements from the phases.
(These are the red dots on the line.)
350
Phase Displacement
Index = 0
300
250
200
Displacement 150
100
50
0
0
60
120
180
240
300
360
Phase
Linearly interpolate between cam data (black dots on the line).
NY-series Motion Control Instructions Reference Manual (W561)
3-169
Function
For the cam table, you must use a cam data variable that was created on the Cam Editor of the
Sysmac Studio.
Cam Table
MC_CamIn
• The MC_CamIn instruction executes a cam motion that synchronizes the master axis phase and
slave axis displacement according to a cam table.
3 Axis Command Instructions
Precautions for Correct Use
• Do not execute the MC_SetPosition instruction for the Master (Master Axis) if you use this
instruction on a CPU Unit with unit version 1.09 or earlier.
If the MC_SetPosition instruction is executed for the Master (Master Axis), the Slave (Slave
Axis) may follow the master axis quickly.
If you want to use the MC_SetPosition instruction for the Master (Master Axis), disable the
relationship between the Master (Master Axis) and slave axes before executing the instruction.
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for
precautions on the master axis.
• When executed, this instruction checks if the phases are in ascending order. If they are not in
ascending order, an error occurs.
When you change cam data, execute the MC_SetCamTableProperty (Set Cam Table Properties) instruction to make sure that the phases are in ascending order.
Make sure that the phases will be in ascending order before you change the phases during a
cam motion. The cam motion may stop if the phases are not in ascending order.
• Cam data variables are global variables. You can therefore access or change the values of
cam data variables from more than one task. If you change the values of cam data variables
from more than one task, program the changes so that there is no competition in writing the
value from more than one task.
• If you use exclusive control of global variables between tasks for a cam data variable, do not
use the cam data variable for motion control instructions while exclusive control is in effect for
the cam data variable. An Incorrect Cam Table Specification error (error code: 5439 hex) will
occur.
3-170
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Instruction Details
This section describes the instruction in detail.
z Instruction Execution Condition
You can execute this instruction while the master axis is stopped, during position control, velocity
control, or synchronized control. For details on the slave axis, refer to Re-execution of Motion
Instructions on page 3-190 and Multi-execution of Motion Instructions on page 3-191.
MC_CamIn
z Software Limits
If the slave axis exceeds the software limit during cam operation, an error occurs.
z Cam Data Variables
A cam data variable is declared as an array of cam data structures. The type declaration for the cam
data structure is shown below.
(*Cam data structure*)
_sMC_CAM_REF :
STRUCT
Phase
: REAL;
Distance : REAL;
END_STRUCT;
END_TYPE
Function
TYPE
(*Phase*)
(*Displacement*)
Create the cam data variables on the Sysmac Studio.
You can specify a name for the cam table name (i.e., the name of the cam data variable).
For example, if you make a cam table called MyCam1 with 1,000 points use the following variable
declaration is automatically made by the Sysmac Studio.
VAR
(*Cam table*)
MyCam1
END_VAR
:
ARRAY [0..999] OF _sMC_CAM_REF;
The following notation is used to specify MyCam1 for this instruction. In this example, the master
axis is Axis1 and the slave axis is Axis2.
MC_CamIn_instance
MC_CamIn
Axis1
Master
Master
Axis1
Axis2
Slave
Slave
Axis2
MyCam1
CamTable
3
CamTable
MyCam1
An error will occur if the specified cam table does not exist in the Controller. You can also specify the
same cam table for more than one axis.
The values in cam data variables can be written from the user program. However, any changes to
the values are lost when the power supply to the Controller is turned OFF or the cam data variables
are downloaded from the Sysmac Studio.
The values that are downloaded from the Sysmac Studio are always used when the power supply to
the Controller is turned ON or after the cam data variables are downloaded.
To save any changes, execute the MC_SaveCamTable instruction.
Changes to the cam data variables are retained when the operating mode of the CPU Unit is
changed.
NY-series Motion Control Instructions Reference Manual (W561)
3-171
3 Axis Command Instructions
Additional Information
• The cam data variables are not published to the network.
For example, you can monitor the values of MyCam1[10].Phase or MyCam1[10].Distance
from the Sysmac Studio, but you cannot access from another Controller via EtherNet/IP.
• Use the Synchronize Menu of the Sysmac Studio to download the project.
z Starting Cam Operation
After the instruction starts, the master axis has to reach the StartPosition (Cam Table Start Position).
After the master axis passes the StartPosition (Cam Table Start Position), the start point in the cam
table is executed and the InCam output variable (Cam Motion) changes to TRUE.
Relative amounts are applied to the phase and displacements in the cam table so that the start point is
zeroed. The absolute position of each axis at each phase is the relative value from the absolute position
of the axis at the start point of the cam table. For example, if the Count Mode of the master axis is 0° to
360° in Rotary Mode, the StartPosition (Cam Table Start Position) is 60. The absolute position of the
master axis is the phase added to the StartPosition, as shown in the following cam table. The absolute
position of the slave axis is the displacement from the cam table added to the absolute position of the
slave axis at the start point of the cam table.
Cam Table
Absolute Position of Axes
Phase Displacement
Master axis
Slave axis
Start point
0
0
Cam data
60
200
120
100
180 100 + Absolute position of slave axis at start point of cam table
180
300
240 300 + Absolute position of slave axis at start point of cam table
240
100
300 100 + Absolute position of slave axis at start point of cam table
300
200
360 200 + Absolute position of slave axis at start point of cam table
360
0
60 0 + Absolute position of slave axis at start point of cam table
End point
60 0 + Absolute position of slave axis at start point of cam table
StartPosition=60
120 200 + Absolute position of slave axis at start point of cam table
When the MasterStartDistance (Master Following Distance) is then passed, the cam operation of the
slave axis starts and the InSync output variable changes to TRUE.
The MasterStartDistance (Master Following Distance) is specified either as an absolute position, or as
a relative distance from the StartPosition (Cam Table Start Position). Set whether to specify using an
absolute position or relative position with StartMode.
Example 1: Differences in Slave Axis Operation for Differences in
MasterStartDistance
In this example, the same cam table and same master axis are used.
The cam table settings are given in the following table.
Master axis
0.000
80.000
120.000
360.000
3-172
Slave axis
0.000
80.000
200.000
360.000
Cam curve
--Straight line
Straight line
Straight line
Connecting
velocity
--360.000
1080.000
240.000
Connecting
acceleration
--0.000
0.000
0.000
Phase pitch
--0.010
0.010
0.010
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
The conditions for starting cam operation are given in the following table.
Input variable
Periodic (Periodic Mode)
StartMode
StartPosition (Cam Table Start Position)
MasterStartDistance (Master Following
Distance)
Condition 1
TRUE: Periodic
_mcRelativePosition (relative
position)
0
0
Condition 2
TRUE: Periodic
_mcRelativePosition (relative
position)
0
80
For condition 2, the InCam (Cam Motion) changes to TRUE when the master axis passes 0°. Then, the
InSync output variable changes to TRUE and the slave axis starts cam operation when the master axis
passes 80°*1. For condition 2, cam operation starts in the middle of the cam table, so the slave axis will
accelerate rapidly.
MC_CamIn
For condition 1, the InCam (Cam Motion) and InSync output variables both change to TRUE and the
slave axis starts cam operation when the master axis passes 0°.
3
Function
Master axis
command position
360°
80°
Time
0°
Slave axis
command position
Operation for Condition 1
Time
0
InCam
InSync
Slave axis
command position
Operation for Condition 2
0
Time
InCam
InSync
*1. Because StartMode is set to _mcRelativePosition, the cam operation starts at StartPosition + MasterStart-Distance, or 80°.
NY-series Motion Control Instructions Reference Manual (W561)
3-173
3 Axis Command Instructions
Additional Information
For condition 2, the slave axis will accelerate rapidly if SlaveOffset is set to 0.
Slave axis
command
position
Operation for Condition 2
Time
0
InCam
InSync
If SlaveOffset is set to -80, the slave axis starts synchronization from a displacement of MasterStartDistance (Master Following Distance) and rapid acceleration is prevented.
Slave axis
command
position
Operation for Condition 2
Time
0
InCam
InSync
Example 2: Differences in Slave Axis Operation for Differences in StartPosition and
MasterStartDistance
The cam table settings are the same as in the previous example. The conditions for starting cam operation are given in the following table.
Input variable
Periodic (Periodic Mode)
StartMode
StartPosition (Cam Table Start Position)
MasterStartDistance (Master Following
Distance)
Condition 1
TRUE: Periodic
_mcRelativePosition
(relative position)
0
0
Condition 2
TRUE: Periodic
_mcRelativePosition
(relative position)
40
0
Condition 3
TRUE: Periodic
_mcRelativePosition
(relative position)
40
80
For condition 1, the InCam (Cam Motion) and InSync output variables both change to TRUE and the
slave axis starts cam operation when the master axis passes 0°.
For condition 2, the InCam (Cam Motion) and InSync output variables both change to TRUE and the
slave axis starts cam operation when the master axis passes 40° (the value that is specified for StartPosition (Cam Table Start Position)).
For condition 3, the InCam (Cam Motion) changes to TRUE when the master axis passes 40°. Then,
the InSync output variable changes to TRUE and the slave axis starts cam operation when the master
axis passes 120°*1.
*1. Because StartMode is set to _mcRelativePosition, the cam operation starts at StartPosition + MasterStart-Distance, or 120°.
3-174
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Master axis
command position
360°
120°
40°
0°
MC_CamIn
Slave axis
command position
Time
Operation for Condition 1
3
Function
Time
0
InCam
InSync
Slave axis
command position
Operation for Condition 2
Time
0
InCam
InSync
Slave axis
command position
Operation for Condition 3
Time
0
InCam
InSync
NY-series Motion Control Instructions Reference Manual (W561)
3-175
3 Axis Command Instructions
Example 3: Differences in Starting Cam Operation of the Slave Axis for Differences
in StartMode
You can use StartMode to specify whether the value that is specified for MasterStartDistance (Master
Following Distance) is treated as an absolute value or a relative value.
This example describes the differences in starting cam operation of the slave axis for differences in
StartMode. The cam table settings are the same as in the previous example.
The conditions for starting cam operation are given in the following table.
Input variable
Periodic (Periodic Mode)
StartMode
StartPosition (Cam Table Start Position)
MasterStartDistance (Master Following
Distance)
Condition 1
TRUE: Periodic
_mcAbsolutePosition (absolute
position)
40
80
Condition 2
TRUE: Periodic
_mcRelativePosition (relative
position)
40
80
For both conditions 1 and 2, the InCam (Cam Motion) output variable changes to TRUE when the master axis passes 40°.
For condition 1, StartMode is set to _mcAbsolutePosition (absolute position), so the InSync output variable changes to TRUE and the slave axis starts cam operation when the master axis passes 80°.
For condition 2, StartMode is set to _mcRelativePosition (relative position), so the InSync output variable changes to TRUE and the slave axis starts cam operation when the master axis passes 120° (=
40° + 80°).
3-176
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Master axis
command position
360°
120°
80°
40°
0°
MC_CamIn
Slave axis
command position
Time
Operation for Condition 1
3
Function
Time
0
InCam
InSync
Slave axis
command position
Operation for Condition 2
Time
0
InCam
InSync
Precautions for Correct Use
To perform a cam motion, use the Cam Editor in the Sysmac Studio to create a cam profile and
then download the cam profile to the CPU Unit. Use the Synchronize Menu of the Sysmac Studio
to download the project.
NY-series Motion Control Instructions Reference Manual (W561)
3-177
3 Axis Command Instructions
z Periodic (Periodic Mode)
If you specify TRUE (periodic) for Periodic, the cam motion will be repeated from the start to the end
point of the cam table.
If you specify FALSE (non-periodic), the cam operation ends when the last point in the cam table is
executed.
If the stroke position of the slave axis is the same at the start and end points of the cam table when
TRUE (periodic) is set, the cam operates as a reciprocal cam. (Refer to Reciprocal Cam Operation.)
If the stroke position of the slave axis differs at the start point and end point, the cam operates as a
feeding cam. (Refer to Feeding Cam Operation.) In the following chart, the horizontal axis indicates
the master axis and the vertical axis indicates the slave axis.
Reciprocal Cam Operation
Slave axis
Distance of one cam rotation
Displacement
Starting
position
Starting position
Master axis
Feeding Cam Operation
Slave axis
Distance of one cam rotation
Displacement
Starting
position
Starting position
Master axis
z EndOfProfile (End of Cam Cycle)
EndOfProfile (End of Cam Cycle) is TRUE for one period when the command value of the cam
motion for the phase and displacement defined by the end point in the cam table is output. Set the
absolute position of the master axis as the StartPosition (Cam Table Start Position) and the cam
table becomes relative to that position. EndOfProfile (End of Cam Cycle) functions as an output indicating the end of the cam table.
3-178
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Ending Cam Operation
Use the MC_CamOut (End Cam Operation) instruction or MC_Stop instruction to stop cam operation before it is completed.
z Scaling Factor
2.0
MC_CamIn
Slave scaling
You can specify a scaling factor to scale up or scale down the master axis phase and slave axis displacement of a specified cam table. You can apply separate factors to the master and slave axes.
1.0
3
1.0
Function
2.0
Master scaling
z Offset
You can shift the phase and displacement by an offset from the specified cam table.
You can specify separate offsets for the master axis phase and slave axis displacement.
MasterOffset > 0
Displacement
One period
MasterOffset = 100
Phase
Cam table start position
EndOfProfile changes to
TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
EndOfProfile changes
to TRUE.
EndOfProfile changes
to TRUE.
3-179
3 Axis Command Instructions
MasterOffset < 0
Displacement
MasterOffset = -100
Cam table start
position
EndOfProfile changes
to TRUE.
Phase
EndOfProfile changes
to TRUE.
SlaveOffset > 0
Displacement
SlaveOffset = 50
Cam table start position
Phase
SlaveOffset < 0
Displacement
SlaveOffset = −50
Phase
Cam table start position
3-180
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z ReferenceType (Position Type Selection)
Any of the following position types can be selected for the master axis to which the slave axis is synchronized.
• _mcCommand: Command position (value calculated in the previous task period)
The master axis command position that was calculated in the previous task period is used for the
current period.
The command value that was calculated for the master axis in the last periodic task is used to calculate the command position of the slave axis in the current period.
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
Additional Information
The command position that is calculated in the same task period enables greater precision in
synchronization than the command position that was calculated in the previous task period.
However, the axis number set for the master axis in the system-defined variable for motion control must be lower than the axis number set for the slave axis in the system-defined variable for
motion control.
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
Axis Type
Servo axis
Encoder axis
Virtual servo axis
Virtual encoder axis
ReferenceType
_mcCommand or _mcLatestCommand
OK
No*
OK
No*
_mcFeedback
OK
OK
OK
OK
* A Position Type Selection Out of Range error (error code: 5430 hex) occurs when the instruction is executed.
NY-series Motion Control Instructions Reference Manual (W561)
3-181
3
Function
Precautions for Correct Use
MC_CamIn
• _mcLatestCommand: Command position (value calculated in the same task period)
The command position of the master axis that was calculated in the same task period is used.
This enables the use of information that is more recent than for _mcCommand. However, the axis
number of the master axis must be set lower than the axis number of the slave axis. If the axis
number of the slave axis is lower than the axis number of the master axis, Error will change to
TRUE. A Master/Slave Axis Numbers Not in Ascending Order error (error code: 5438 hex) will be
output to ErrorID.
3 Axis Command Instructions
z Direction
You can start cam operation for the slave axis only if the travel direction of the master axis matches
the setting in Direction. Direction is valid only while InSync is TRUE.
_mcNoDirection (No Direction Specified)
Cam operation starts regardless of whether the master axis is traveling in the positive or negative
direction.
Slave
position
Master
position
Time
Time
_mcPositiveDirection
Cam operation starts when the master axis is moving in the positive direction.
Slave
position
Master
position
Time
Time
_mcNegativeDirection
Cam operation starts when the master axis is moving in the negative direction.
Slave
position
Master
position
Time
Time
Version Information
If MasterStartDistance (Master Following Distance) is exceeded while the master axis is moving
in the opposite direction from Direction (Direction) and InSync (In Sync) changes to TRUE, the
operation depends on the unit version of the CPU Unit as follows:
• CPU Units with Unit Version 1.10 or Later
When InSync (In Sync) changes to TRUE, the slave axis moves to the displacement according
to the phase in the cam table. If the master axis then moves in the direction specified in Direction (Direction), the slave axis starts cam operation.
• CPU Units with Unit Version 1.09 or Earlier
If the master axis moves in the direction specified in Direction (Direction) after InSync (In
Sync) changes to TRUE, the slave axis starts cam operation.
3-182
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
An example is given below.
The cam table settings are the same as in the previous example.
The conditions for starting cam operation are given in the following table.
Input variable
StartMode (Start Mode)
Direction (Direction)
StartPosition (Cam Table Start Position)
MasterStartDistance (Master Following Distance)
Condition
_mcAbsolutePosition (Absolute Position)
_mcPositiveDirection (Positive Direction)
0
80
MC_CamIn
Master axis command position
360°
3
Time
0°
Slave axis command position
Ver. 1.10 or Later
Time
0
InCam
InSync
Slave axis command position
Ver. 1.09 or Earlier
0
Time
InCam
InSync
NY-series Motion Control Instructions Reference Manual (W561)
3-183
Function
80°
3 Axis Command Instructions
z BufferMode (Buffer Mode Selection)
BufferMode specifies how to join the axis motions for this instruction and the previous instruction.
There are the following six settings.
Buffer Mode Selection
Aborting
Description
Cancels the instruction being executed and switches to this instruction.
When the master axis passes StartPosition (Cam Table Start Position) and
then passes MasterStartDistance (Master Following Distance), the cam operation of the slave axis starts and the InSync output variable changes to TRUE.
The slave axis remains stopped until the InSync output variable to the buffered
instruction changes to TRUE.
Buffered
The starting point in the cam table is specified by StartPosition (Cam Table
Start Position).
The buffered instruction is executed automatically starting from the period in
which the current instruction is completed normally. When the master axis
passes StartPosition (Cam Table Start Position) and then passes MasterStartDistance (Master Following Distance), the cam operation of the slave axis
starts and the InSync output variable changes to TRUE.
The slave axis remains stopped until the InSync output variable to the buffered
instruction changes to TRUE.
Blending*1
Blending low
Blending previous
Blending next
Blending high
The starting point in the cam table is specified by StartPosition (Cam Table
Start Position).
The InSync output variable from the buffered instruction changes to TRUE in
the period in which the current instruction is completed normally, and cam
operation starts without the slave axis ever stopping.
Even if StartPosition (Cam Table Start Position) and MasterStartDistance
(Master Following Distance) are specified for the buffered instruction, the
slave axis starts cam operation as soon as instruction execution starts regardless of the values that are specified.
The starting point in the cam table is the final position for the current instruction.
*1 A CPU Unit with unit version 1.06 or later and Sysmac Studio version 1.07 or higher are required for these settings. The operation is the same regardless of which of the four types of blending is specified.
z Multi-execution of Instructions with Buffer Mode in Buffered
Consider the case of multi-execution of instructions where MC_CamIn2 is executed with the Buffer
Mode set to Buffered during execution of MC_CamIn1. After execution of MC_CamIn1 is completed
and Active (Controlling) to MC_CamIn2 changes to TRUE, InSync changes to TRUE at the next
StartPosition (Cam Table Start Position) and cam operation starts.
3-184
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Master axis position
StartPosition
Slave axis position
MC_CamIn
MC_CamIn1
Active
InCam
InSync
3
EndOfProfile
Function
MC_CamIn2
Execute
Busy
Active
InCam
InSync
EndOfProfile
z Multi-execution of Instructions with Buffer Mode in Blending
Consider the case of multi-execution of instructions where MC_CamIn2 is executed with the Buffer
Mode set for blending during execution of MC_CamIn1. In the same period in which execution of
MC_CamIn1 is completed, InSync from MC_CamIn2 changes to TRUE and cam operation starts.
NY-series Motion Control Instructions Reference Manual (W561)
3-185
3 Axis Command Instructions
Master axis position
StartPosition
Slave axis position
MC_CamIn1
Active
InCam
InSync
EndOfProfile
MC_CamIn2
Execute
Busy
Active
InCam
InSync
EndOfProfile
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Index
Of the two cam data used to find the command positions of the master and slave axes, the one with
the smaller cam data index number is output to the Index output variable. Use this value for fine-tuning the cam data with the Cam Editor or with the user program.
z In-position Check
An in-position check is not performed for this instruction.
z Override Factors
You cannot set override factors with the MC_SetOverride (Set Override Factors) instruction for this
instruction.
3-186
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
z Non-periodic Operation
The following timing chart shows the operation when Periodic (Periodic Mode) is FALSE (non-periodic) for the MC_CamIn (Start Cam Operation) instruction.
Master Axis Position
MasterStartDistance
MC_CamIn
StartPosition
Slave axis position
3
Function
Execute
InCam
InSync
EndOfProfile
Busy
Active
NY-series Motion Control Instructions Reference Manual (W561)
3-187
3 Axis Command Instructions
z Periodic Operation
The cam motion is repeatedly executed.
The slave axis decelerates to 0 when the cam operation is ended with the MC_CamOut (End Cam
Operation) instruction. The operation of the master axis is not affected.
The following timing chart shows the operation when Periodic (Periodic Mode) is TRUE (periodic) for
the MC_CamIn (Start Cam Operation) instruction and then the MC_CamOut (End Cam Operation)
instruction is executed.
Master Axis Position
MasterStartDistance
StartPosition
Slave axis position
Deceleration
Velocity of 0
MC_CamIn
Execute
InCam
InSync
EndOfProfile
Busy
Active
MC_CamOut
Execute
Done
Busy
3-188
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z MC_Stop Instruction
If the MC_Stop instruction is executed for the master axis during cam operation, the sync between
the master axis and slave axis is maintained. If the MC_Stop instruction is executed for the slave
axis during cam operation, the sync between the master axis and slave axis ends.
The following timing chart displays the operation when Periodic (Periodic Mode) is TRUE (periodic)
for the MC_CamIn (Start Cam Operation) instruction and then the MC_Stop instruction is executed
for the slave axis.
Master Axis Position
MC_CamIn
MasterStartDistance
StartPosition
Slave axis position
3
Deceleration stopping
Function
MC_CamIn
Execute
InCam
InSync
EndOfProfile
Busy
Active
MC_Stop
Execute
Done
Busy
Active
NY-series Motion Control Instructions Reference Manual (W561)
3-189
3 Axis Command Instructions
Aborting the Instruction
If an axis error occurs for the slave axis during execution of this instruction, the slave axis decelerates
to a stop at the maximum deceleration rate for the axis. If the MC_Stop instruction is executed for the
slave axis, CommandAborted changes to TRUE and the slave axis decelerates to a stop at the deceleration rate that is specified in the MC_Stop instruction. Refer to the NY-series Troubleshooting Manual
(Cat. No. W564) for information on isolating the causes of axis errors. If an axis error occurs on the
master axis, cam operation will continue.
Master axis position
MasterStartDistance
StartPosition
Deceleration
stopping
Slave axis position
Execute
InCam
InSync
Busy
Active
CommandAborted
Re-execution of Motion Instructions
You can re-execute this instruction to change the cam table during operation. To change any conditions
other than the cam table, use multi-execution of instructions for this instruction. When re-executing the
instruction, InCam and InSync retain the status that they had prior to the re-execution. If the instruction
is re-executed when InSync is TRUE, the cam operation starts from the phase that is larger than the
phase for the actual position. The phase for the actual position is found by linearly interpolating
between cam data points.
Only the cam table is affected by re-execution.
Precautions for Correct Use
If a cam table is switched by re-executing the instruction during a cam motion, the velocity or
acceleration of the slave axis may change rapidly after re-execution. Be careful when re-executing the instruction because the mechanical composition may be affected.
For details on re-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
3-190
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Re-execution Procedure
For the procedure to re-execute this instruction, refer to Sample Programming 1 on page 3-192 and
Sample Programming 2 on page 3-203.
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Multi-execution of instructions cannot be used for the MC_GenerateCamTable (Generate Cam
Table) instruction during execution of an MC_CamIn instruction for which the same cam table is
specified with CamTable.
• When another instruction is executed by using multi-execution with BufferMode set to Aborting,
the cam motion is aborted and the next operation is started.
• When another instruction is executed with BufferMode set to Buffered, the command position of
the next operation is output when EndOfProfile (End of Cam Cycle) changes to TRUE.
z Multi-execution of MC_CamIn Instructions with Buffer Mode in Blending
• You can specify blending only for multi-execution of two MC_CamIn instructions. You cannot execute this instruction with blending during execution of any other instruction.
• Specify the same values for Master (Master Axis) and ReferenceType (Position Type Selection)
as those specified in the instruction that is currently in operation. If you specify different values, a
Motion Control Instruction Multi-execution Disabled error will occur.
• The InSync output variable from the buffered instruction changes to TRUE in the period in which
the current instruction is completed normally, and cam operation starts without the slave axis ever
stopping.
• Even if StartPosition (Cam Table Start Position) and MasterStartDistance (Master Following Distance) are specified, the slave axis starts cam operation as soon as instruction execution starts
regardless of the values that are specified. The starting point in the cam table is the final position
for the current instruction. The operation is the same regardless of which of the four types of
blending is specified.
z Execution during Execution of Other Instructions
Multi-execution of instructions cannot be used for this instruction during execution of the MC_GenerateCamTable (Generate Cam Table) instruction for which the same cam table is specified with
CamTable.
z Master Axis and Slave Axis Compensations
There are the following two instructions that shift the phase of master and slave axes during synchronized control.
• MC_Phasing (Shift Master Axis Phase)
• MC_SyncOffsetPosition (Cyclic Synchronous Position Offset Compensation)
If multi-execution of instructions causes any synchronized control instruction other than the MC_CamIn (Start Cam Operation) instruction to be aborted (i.e., if the CommandAborted output variable
changes to TRUE), any instructions that shift the phase are also aborted.
If blending is used for multi-execution of two MC_CamIn (Start Cam Operation) instructions, the
instructions that shift the phase are not aborted and processing is continued.
NY-series Motion Control Instructions Reference Manual (W561)
3-191
3
Function
To use multi-execution of motion instructions for this instruction, specify the slave axis. When multiexecution of another instruction is performed while this instruction is in execution, the following limits
apply depending on the Buffer Mode.
MC_CamIn
z Execution of Other Instructions during Instruction Execution
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE. You can find out the cause of
the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Master axis position
Slave axis position
Execute
InCam
InSync
Busy
Active
Error
Error code
ErrorID 16#0000
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
Sample Programming 1
This sample programming shows cam operation when periodic operation is specified. In this example,
the master axis is axis 1 and the slave axis is axis 2.
Additional Information
You can specify only the initial values for input variables that are reserved. In this sample, variables with initial values are defined for the instructions, but you do not need to assign variables
and parameters when you program them.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Types
Axis
3-192
Axis Type
Axis 1
Servo axis (master axis)
Axis 2
Servo axis (slave axis)
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Count Modes
Axis
Count Mode
Axis 1
Rotary Mode
Axis 2
Linear Mode
Ring Counter
Axis
Axis 1
Modulo maximum position
360
Modulo minimum position
0
MC_CamIn
Units of Display
Axis
Unit of Display
Axis 1
degree
Axis 2
mm
3
Sample Programming 1
Operation Example
z Operation Pattern
Master axis command position
360°
60°
Cam operation start point 40°
(relative)
Cam table start position 20°
Time
Slave axis command position
MC_CamOut executed.
1000
0
1
Time
Starting Cam Operation
If the cam table start point position (zero phase position) is 20°, the slave axis starts operation
when the master axis reaches a position where the relative angle from that point is 40°. Cam
operation operates in a periodic motion. If Periodic is TRUE, periodic operation is performed.
2
Ending Cam Operation
When the actual position of the slave axis MC_Axis001.Act.Pos exceeds 1000.0, cam operation
is ended and the slave axis is stopped at deceleration rate DecRate2.
NY-series Motion Control Instructions Reference Manual (W561)
3-193
3 Axis Command Instructions
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
MC_Axis001
MC_Axis001.MFaultLvl.Active
BOOL
_sAXIS_REF
BOOL
FALSE
--FALSE
MC_Axis001.Details.Homed
Pwr1_S
BOOL
BOOL
FALSE
FALSE
Pwr2_S
BOOL
FALSE
ARRAY[0..360] OF
_sMC_CAM_REF
---
DecRate2
LREAL
10000.0
Vel_InVel
BOOL
FALSE
Camin_InCam0
BOOL
FALSE
Camout_Ex
BOOL
FALSE
StartPg
BOOL
FALSE
CamProfile0
3-194
Comment
Axis Variable for the master axis, axis 1.
TRUE while there is a minor fault level
error for axis 1.
TRUE when home is defined for axis 1.
Axis Variable for the slave axis, axis 2.
TRUE while there is a minor fault level
error for axis 2.
TRUE when home is defined for axis 2.
This variable is assigned to the Status
output variable from the PWR1 instance
of the MC_Power instruction. This variable changes to TRUE when the Servo
is turned ON.
This variable is assigned to the Status
output variable from the PWR2 instance
of the MC_Power instruction. This variable changes to TRUE when the Servo
is turned ON.
This is the cam data variable. The array
elements ARRAY[0..N] are set with the
Cam Editor. In this sample, 0 to 360 are
used, but the number of array elements
depends on the settings that you make
with the Cam Editor.
This variable sets the deceleration rate
for execution of MC_CamOut.
This variable is assigned to the InVelocity output variable from the VEL instance
of the MC_MoveVelocity instruction. It is
TRUE when the target velocity is
reached.
This variable is assigned to the InCam
output variable from the CAMIN instance
of the MC_CamIn instruction. It is TRUE
during cam operation.
The CAMOUT instance of MC_CamOut
is executed while this variable is TRUE.
The Servo is turned ON if this variable is
TRUE and EtherCAT process data communications are established.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Master axis
MC_Axis000.Cmd.Pos
Slave axis
MC_Axis001.Cmd.Pos
MC_CamIn
MC_MoveVelocity Instruction
Vel_InVel
MC_CamIn Instruction
3
Camin_InCam0
Sample Programming 1
Camin_InSync
Camin_EOP
Camin_Index
Camin_Bsy
Camin_Act
Camin_Ca
MC_CamOut Instruction
Camout_Ex
Camout_D
Camout_Bsy
z Sample Programming
If StartPg is TRUE, EtherCAT communications for axis 1 are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
If StartPg is TRUE, EtherCAT communications for axis 2 are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
If process data communications are active for axis 1, the Servo is turned ON.
PWR1
MC_Power
Lock1
MC_Axis000
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_S
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
3-195
3 Axis Command Instructions
If process data communications are active for axis 2, the Servo is turned ON.
PWR2
MC_Power
MC_Axis001
Lock2
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_S
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed to define home.
HM1
MC_Home
Pwr1_S MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed to define home.
HM2
MC_Home
Pwr2_S MC_Axis001.Details.Homed
MC_Axis001
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
The MC_MoveVelocity (Velocity Control) instruction is executed after homing is completed for axis 1.
VEL
Hm1_D
MC_Axis000
LREAL#1000.0
LREAL#100000.0
LREAL#100000.0
_eMC_DIRECTION#_mcPositiveDirection
3-196
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_EIrrD
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
The MC_CamIn (Start Cam Operation) instruction is executed if Vel_InVel is TRUE for the MC_MoveVelocity
(Velocity Control) instruction.
CAMIN
MC_Axis000
MC_Axis001
CamProfile0
Vel_InVel
Camin_InCam0
Camin_InSync
Camin_EOP
Camin_Index
Camin_Bsy
Camin_Act
Camin_Ca
Camin_Err
Camin_ErrID
MC_CamIn
BOOL#TRUE
_eMC_START_MODE#_mcRelativePosition
LREAL#20.0
LREAL#40.0
LREAL#1.0
LREAL#1.0
LREAL#0.0
LREAL#0.0
_eMC_REFERENCE_TYPE#_mcCommand
_eMC_DIRECTION#_mcNoDirection
MC_CamIn
Master
Master
Slave
Slave
CamTable
CamTable
Execute
InCam
InSync
Periodic
EndOfProfile
StartMode
StartPosition
Index
MasterStartDistance
Busy
Active
MasterScaling
SlaveScaling CommandAborted
Error
MasterOffset
ErrorID
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
3
Sample Programming 1
CamOut_Ex changes to TRUE if Camin_InCam0 is TRUE and MC_Axis001.Act.Pos exceeds 1000.
Camin_InCam0
Note: The contents of the inline
ST are given below.
The MC_CamOut (End Cam Operation) instruction is executed when Camout_Ex changes to TRUE.
The deceleration rate is specified by DecRate2.
CAMOUT
MC_Axis001
Camout_Ex
DecRate2
MC_CamOut
Slave
Slave
Done
Execute
Busy
Deceleration
Jerk
CommandAborted
OutMode
Error
ErrorID
Camout_D
Camout_Bsy
Camout_Ca
Camout_Err
Camout_ErrID
Contents of Inline ST
IF MC_Axis001.Act.Pos>LREAL#1000.0 THEN
Camout_Ex := TRUE;
END_IF;
Structured Text (ST)
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
-FALSE
MC_Axis000.Details.Homed
MC_Axis001
MC_Axis001.MFaultLvl.Active
BOOL
_sAXIS_REF
BOOL
FALSE
--FALSE
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for the master axis, axis 1.
TRUE while there is a minor fault level
error for axis 1.
TRUE when home is defined for axis 1.
Axis Variable for the slave axis, axis 2.
TRUE while there is a minor fault level
error for axis 2.
3-197
3 Axis Command Instructions
Name
MC_Axis001.Details.Homed
Pwr1_S
Data type
BOOL
BOOL
Default
FALSE
FALSE
BOOL
FALSE
ARRAY[0..360] OF
_sMC_CAM_REF
---
DecRate2
LREAL
10000.0
Vel_InVel
BOOL
FALSE
Camin_InCam0
BOOL
FALSE
Camout_Ex
BOOL
FALSE
StartPg
BOOL
FALSE
Camin_Ex
BOOL
FALSE
InitFlag
BOOL
FALSE
Pwr2_S
CamProfile0
3-198
Comment
TRUE when home is defined for axis 2.
This variable is assigned to the Status
output variable from the PWR1 instance
of the MC_Power instruction. This variable changes to TRUE when the Servo
is turned ON.
This variable is assigned to the Status
output variable from the PWR2 instance
of the MC_Power instruction. This variable changes to TRUE when the Servo
is turned ON.
This is the cam data variable. The array
elements ARRAY[0..N] are set with the
Cam Editor. In this sample, 0 to 360 are
used, but the number of array elements
depends on the settings that you make
with the Cam Editor.
This variable sets the deceleration rate
for execution of MC_CamOut.
This variable is assigned to the InVelocity output variable from the VEL instance
of the MC_MoveVelocity instruction. It is
TRUE when the target velocity is
reached.
This variable is assigned to the InCam
output variable from the CAMIN instance
of the MC_CamIn instruction. It is TRUE
during cam operation.
The CAMOUT instance of MC_CamOut
is executed while this variable is TRUE.
The Servo is turned ON if this variable is
TRUE and EtherCAT process data communications are established.
This variable is changed to TRUE when
Vel_InVel changes to TRUE to change
Execute for the CAMIN instance of MC_CamIn to TRUE.
This variable indicates if it is necessary
to set the input parameters. Input parameters are set when this variable is
FALSE. When setting the input parameters is completed, this variable changes
to TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Master axis
MC_Axis000.Cmd.Pos
Slave axis
MC_Axis001.Cmd.Pos
MC_CamIn
MC_MoveVelocity Instruction
Vel_InVel
MC_CamIn Instruction
3
Camin_Ex
Sample Programming 1
Camin_InCam0
Camin_InSync
Camin_EOP
Camin_Index
Camin_Bsy
Camin_Act
Camin_Ca
MC_CamOut Instruction
Camout_Ex
Camout_D
Camout_Bsy
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MC_CamIn parameters
Camin_EM
:= TRUE;
// Periodic Mode
Camin_StMode := _eMC_START_MODE#_mcRelativePosition;
Camin_StPos
:= LREAL#20.0;
// Master axis absolute position for start point
Camin_MStDis := LREAL#40.0;
// Master axis position to start cam operation
Camin_MSc
:= LREAL#1.0;
// Master axis scaling
Camin_SSc
:= LREAL#1.0;
// Slave axis scaling
Camin_MO
:= LREAL#0.0;
// Master offset
Camin_SO
:= LREAL#0.0;
// Slave offset
Camin_RT
:= _eMC_REFERENCE_TYPE#_mcCommand;
// Position type selection
Camin_Dir
:= _eMC_DIRECTION#_mcNoDirection;
// Direction
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#100000.0;
Vel_Dec := LREAL#100000.0;
Vel_Dir := _eMC_DIRECTION#_mcPositiveDirection;
NY-series Motion Control Instructions Reference Manual (W561)
3-199
3 Axis Command Instructions
// MC_CamOut parameters
Camout_Dec := DecRate2;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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 for axis 1 or axis 2, the error handler for the device is executed.
// Program the FaultHandler according to the device.
IF (MC_Axis000.MFaultLvl.Active=TRUE) OR (MC_Axis001.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed for axis 1.
IF (Pwr1_S=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed for axis 2.
IF (Pwr2_S=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// After homing is completed for axis 1, MC_MoveVelocity is executed.
IF Hm1_D=TRUE THEN
Vel_Ex := TRUE;
END_IF;
// CamIn is executed when InVel of MC_MoveVelocity is TRUE.
IF Vel_InVel=TRUE THEN
Camin_Ex := TRUE;
END_IF;
// CamOut is executed when Camin_InCam0 is TRUE and MC_Axis001.Act.Pos is greater than 1000.
IF (Camin_InCam0=TRUE) AND (MC_Axis001.Act.Pos>LREAL#1000.0) THEN
Camout_Ex := TRUE;
END_IF;
// MC_Power for axis 1
PWR1(
Axis
:= MC_Axis000,
Enable
:= Pwr1_En,
3-200
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Status
Busy
Error
ErrorID
=> Pwr1_S,
=> Pwr1_Bsy,
=> Pwr1_Err,
=> Pwr1_ErrID
);
// MC_Home for axis 2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Direction
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
//MC_CamIn
CAMIN(
Master
Slave
CamTable
Execute
Periodic
3
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
Sample Programming 1
// MC_Home for axis 1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
MC_CamIn
// MC_Power for axis 2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_S,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Dir,
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
:= MC_Axis000,
:= MC_Axis001,
:= CamProfile0,
:= Camin_Ex,
:= Camin_EM,
NY-series Motion Control Instructions Reference Manual (W561)
3-201
3 Axis Command Instructions
StartMode
StartPosition
MasterStartDistance
MasterScaling
SlaveScaling
MasterOffset
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
InCam
InSync
EndOfProfile
Index
Busy
Active
CommandAborted
Error
ErrorID
);
//MC_CamOut
CAMOUT(
Slave
Execute
Deceleration
Done
Busy
CommandAborted
Error
ErrorID
);
3-202
:= Camin_StMode,
:= Camin_StPos,
:= Camin_MStDis,
:= Camin_MSc,
:= Camin_SSc,
:= Camin_MO,
:= Camin_SO,
:= Camin_RT,
:= Camin_Dir,
:= Camin_CT,
:= Camin_BM,
=> Camin_InCam0,
=> Camin_InSync,
=> Camin_EOP,
=> Camin_Index,
=> Camin_Bsy,
=> Camin_Act,
=> Camin_Ca,
=> Camin_Err,
=> Camin_ErrID
:= MC_Axis001,
:= Camout_Ex,
:= Camout_Dec,
=> Camout_D,
=> Camout_Bsy,
=> Camout_Ca,
=> Camout_Err,
=> Camout_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Sample Programming 2
This sample programming shows cam operation for a liquid filler.
Additional Information
You can specify only the initial values for input variables that are reserved. Parameters are not
specified in this sample.
MC_CamIn
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
3
Axis Types
Sample Programming 2
Axis
Axis Type
Axis 1
Servo axis (master axis)
Axis 2
Servo axis (slave axis)
Axis 3
Servo axis (slave axis)
Axis 4
Servo axis (slave axis)
Axis 5
Servo axis (slave axis)
Count Modes
Axis
Count Mode
Axis 1
Rotary Mode
Axis 2
Rotary Mode
Axis 3
Rotary Mode
Axis 4
Rotary Mode
Axis 5
Rotary Mode
Ring Counters
Axis
Modulo maximum position
Modulo minimum position
Axis 1
360
0
Axis 2
360
0
Axis 3
360
0
Axis 4
360
0
Axis 5
360
0
Units of Display
Axis
Unit of Display
Axis 1
degree
Axis 2
degree
Axis 3
degree
Axis 4
degree
Axis 5
degree
NY-series Motion Control Instructions Reference Manual (W561)
3-203
3 Axis Command Instructions
Operation Example
Axis 2
Axis 3
Axis 4
Axis 5
Synchronized slave axis
Synchronized master axis
Axis 1
z Operation Pattern
Axis 1
Axis 2
MasterOffset = 30
Axis 3
MasterOffset = 80
Axis 4
MasterOffset = 130
Axis 5
MasterOffset = 180
1
Start Cam Operation
The slave axes, axes 2 to 5, perform cam operation in synchronization with the master axis, axis
1. Each axis shifts its phase by 50° and starts cam operation.
2
Periodic Operation
Each axis periodically executes the specified cam operation.
3-204
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Ladder Diagram
z Main Variables
Data type
_sAXIS_REF
_sAXIS_REF
_sAXIS_REF
_sAXIS_REF
_sAXIS_REF
BOOL
Default
----------FALSE
BOOL
FALSE
Vel_InVel
CamProfile0
---
z Timing Chart
Axis 1
MC_Axis000.Cmd.Pos
Axis 2
MC_Axis001.Cmd.Pos
Axis 3
MC_Axis002.Cmd.Pos
Axis 4
MC_Axis003.Cmd.Pos
Axis 5
MC_Axis004.Cmd.Pos
MC_MoveVelocity Instruction
Vel_InVel
MC_CamIn Instruction
InCam *1
InSync *2
Busy *3
Active *4
Camin1_Eop
Camin2_Eop
Camin3_Eop
Camin4_Eop
*1 The timing is the same for the following: Camin1_InCam, Camin2_InCam, Camin3_InCam, and Camin4_InCam.
NY-series Motion Control Instructions Reference Manual (W561)
3-205
3
Sample Programming 2
ARRAY[0..360] OF
_sMC_CAM_REF
Comment
Axis Variable for the master axis, axis 1.
Axis Variable for the slave axis, axis 2.
Axis Variable for the slave axis, axis 3.
Axis Variable for the slave axis, axis 4.
Axis Variable for the slave axis, axis 5.
The Servo is turned ON if this variable is TRUE and EtherCAT process data communications are established.
This variable is assigned to the InVelocity output variable from the VEL instance of the MC_MoveVelocity
instruction. It is TRUE when the target velocity is
reached.
This is the cam data variable. This variable is assigned
to the CamTable input variables from the CAMIN1 to
CAMIN4 instances of the MC_CamIn instruction. The
array elements ARRAY[0..N] are set with the Cam Editor.
MC_CamIn
Name
MC_Axis000
MC_Axis001
MC_Axis002
MC_Axis003
MC_Axis004
StartPg
3 Axis Command Instructions
*2 The timing is the same for the following: Camin1_InSync, Camin2_InSync, Camin3_InSync, and Camin4_InSync. In this sample, MasterStartDistance is 0, so InSync changes to TRUE from when the master axis is 0°.
*3 The timing is the same for the following: Camin1_Bsy, Camin2_Bsy, Camin3_Bsy, and Camin4_Bsy.
*4 The timing is the same for the following: Camin1_Act, Camin2_Act, Camin3_Act, and Camin4_Act.
3-206
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data
communications are normal.
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
StartPg
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
StartPg
_EC_PDSlavTbl[MC_Axis002.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis002.Cfg.NodeAddress]
Lock3
MC_CamIn
StartPg
_EC_PDSlavTbl[MC_Axis003.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis003.Cfg.NodeAddress]
Lock4
3
StartPg
_EC_PDSlavTbl[MC_Axis004.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis004.Cfg.NodeAddress]
Lock5
If process data communications are active, the Servo is turned ON for the axes.
PWR1
MC_Power
Lock1
MC_Axis000
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
PWR2
MC_Power
Lock2
MC_Axis001
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
PWR3
MC_Power
Lock3
MC_Axis002
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr3_Status
Pwr3_Bsy
Pwr3_Err
Pwr3_ErrID
PWR4
MC_Power
Lock4
MC_Axis003
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr4_Status
Pwr4_Bsy
Pwr4_Err
Pwr4_ErrID
3-207
Sample Programming 2
StartPg
3 Axis Command Instructions
PWR5
MC_Power
MC_Axis004
Lock5
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr5_Status
Pwr5_Bsy
Pwr5_Err
Pwr5_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
MC_Axis002.MFaultLvl.Active
MC_Axis003.MFaultLvl.Active
MC_Axis004.MFaultLvl.Active
If the Servo is ON for axis 1 to axis 5 and the Home instruction is executed for each axis if home is not defined.
HM1
MC_Home
Pwr1_Status
MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
HM2
MC_Home
Pwr2_Status
MC_Axis001.Details.Homed
MC_Axis001
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
HM3
MC_Home
Pwr3_Status
3-208
MC_Axis002.Details.Homed
MC_Axis002
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm3_D
Hm3_Bsy
Hm3_Ca
Hm3_Err
Hm3_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
HM4
MC_Home
Pwr4_Status
MC_Axis003.Details.Homed
MC_Axis003
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm4_D
Hm4_Bsy
Hm4_Ca
Hm4_Err
Hm4_ErrID
HM5
MC_Axis004.Details.Homed
MC_Axis004
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm5_D
Hm5_Bsy
Hm5_Ca
Hm5_Err
Hm5_ErrID
3
VEL
MC_Axis000
LREAL#1000.0
LREAL#0.0
LREAL#0.0
_eMC_DIRECTION#_mcPositiveDirection
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_ErrID
The MC_CamIn (Start Cam Operation) instruction is executed for axis 2 (slave axis) if Vel_InVel is TRUE for the
MC_MoveVelocity (Velocity Control) instruction and homing is completed for axis 2.
CAMIN1
Vel_InVel
MC_Axis001.Details.Homed
MC_Axis000
MC_Axis001
CamProfile0
BOOL#FALSE
_eMC_START_MODE#_mcAbsolutePosition
LREAL#0.0
LREAL#0.0
LREAL#1.0
LREAL#1.0
LREAL#30.0
LREAL#0.0
_eMC_REFERENCE_TYPE#_mcCommand
_eMC_DIRECTION#_mcNoDirection
NY-series Motion Control Instructions Reference Manual (W561)
MC_CamIn
Master
Master
Slave
Slave
CamTable
CamTable
Execute
InCam
InSync
Periodic
EndOfProfile
StartMode
StartPosition
Index
MasterStartDistance
Busy
Active
MasterScaling
SlaveScaling CommandAborted
Error
MasterOffset
ErrorID
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
Camin1_InCam
Camin1_InSync
Camin1_Eop
Camin1_Index
Camin1_Bsy
Camin1_Act
Camin1_Ca
Camin1_Err
Camin1_ErrID
3-209
Sample Programming 2
The MC_MoveVelocity (Velocity Control) instruction is executed after homing is completed for axis 1.
Hm1_D
MC_CamIn
MC_Home
Pwr5_Status
3 Axis Command Instructions
The MC_CamIn (Start Cam Operation) instruction is executed for axis 3 (slave axis) if Vel_InVel is TRUE for the
MC_MoveVelocity (Velocity Control) instruction and homing is completed for axis 3.
CAMIN2
Vel_InVel
MC_Axis002.Details.Homed
MC_Axis000
MC_Axis002
CamProfile0
BOOL#FALSE
_eMC_START_MODE#_mcAbsolutePosition
LREAL#0.0
LREAL#0.0
LREAL#1.0
LREAL#1.0
LREAL#80.0
LREAL#0.0
_eMC_REFERENCE_TYPE#_mcCommand
_eMC_DIRECTION#_mcNoDirection
MC_CamIn
Master
Master
Slave
Slave
CamTable
CamTable
Execute
InCam
InSync
Periodic
EndOfProfile
StartMode
StartPosition
Index
MasterStartDistance
Busy
Active
MasterScaling
SlaveScaling CommandAborted
Error
MasterOffset
ErrorID
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
Camin2_InCam
Camin2_InSync
Camin2_Eop
Camin2_Index
Camin2_Bsy
Camin2_Act
Camin2_Ca
Camin2_Err
Camin2_ErrID
The MC_CamIn (Start Cam Operation) instruction is executed for axis 4 (slave axis) if Vel_InVel is TRUE for the
MC_MoveVelocity (Velocity Control) instruction and homing is completed for axis 4.
CAMIN3
MC_CamIn
Vel_InVel
MC_Axis003.Details.Homed
MC_Axis000
MC_Axis003
CamProfile0
BOOL#FALSE
_eMC_START_MODE#_mcAbsolutePosition
LREAL#0.0
LREAL#0.0
LREAL#1.0
LREAL#1.0
LREAL#130.0
LREAL#0.0
_eMC_REFERENCE_TYPE#_mcCommand
_eMC_DIRECTION#_mcNoDirection
3-210
Master
Master
Slave
Slave
CamTable
CamTable
Execute
InCam
InSync
Periodic
EndOfProfile
StartMode
StartPosition
Index
MasterStartDistance
Busy
Active
MasterScaling
SlaveScaling CommandAborted
Error
MasterOffset
ErrorID
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
Camin3_InCam
Camin3_InSync
Camin3_Eop
Camin3_Index
Camin3_Bsy
Camin3_Act
Camin3_Ca
Camin3_Err
Camin3_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
The MC_CamIn (Start Cam Operation) instruction is executed for axis 5 (slave axis) if Vel_InVel is TRUE for the
MC_MoveVelocity (Velocity Control) instruction and homing is completed for axis 5.
CAMIN4
Vel_InVel
MC_Axis004.Details.Homed
MC_Axis000
MC_Axis004
CamProfile0
Camin4_InCam
Camin4_InSync
Camin4_Eop
Camin4_Index
Camin4_Bsy
Camin4_Act
Camin4_Ca
Camin4_Err
Camin4_ErrID
MC_CamIn
BOOL#FALSE
_eMC_START_MODE#_mcAbsolutePosition
LREAL#0.0
LREAL#0.0
LREAL#1.0
LREAL#1.0
LREAL#180.0
LREAL#0.0
_eMC_REFERENCE_TYPE#_mcCommand
_eMC_DIRECTION#_mcNoDirection
MC_CamIn
Master
Master
Slave
Slave
CamTable
CamTable
Execute
InCam
InSync
Periodic
EndOfProfile
StartMode
StartPosition
Index
MasterStartDistance
Busy
Active
MasterScaling
SlaveScaling CommandAborted
Error
MasterOffset
ErrorID
SlaveOffset
ReferenceType
Direction
CamTransition
BufferMode
3
Sample Programming 2
Structured Text (ST)
z Main Variables
Name
MC_Axis000
MC_Axis001
MC_Axis002
MC_Axis003
MC_Axis004
StartPg
Data type
_sAXIS_REF
_sAXIS_REF
_sAXIS_REF
_sAXIS_REF
_sAXIS_REF
BOOL
Default
----------FALSE
BOOL
FALSE
CamProfile0
ARRAY[0..360] OF
_sMC_CAM_REF
---
Camin1_Ex
Camin2_Ex
Camin3_Ex
Camin4_Ex
InitFlag
BOOL
BOOL
BOOL
BOOL
BOOL
FALSE
FALSE
FALSE
FALSE
FALSE
Vel_InVel
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for the master axis, axis 1.
Axis Variable for the slave axis, axis 2.
Axis Variable for the slave axis, axis 3.
Axis Variable for the slave axis, axis 4.
Axis Variable for the slave axis, axis 5.
The Servo is turned ON if this variable is TRUE and EtherCAT process data communications are established.
This variable is assigned to the InVelocity output variable from the VEL instance of the MC_MoveVelocity
instruction. It is TRUE when the target velocity is
reached.
This is the cam data variable. This variable is assigned
to the CamTable input variables from the CAMIN1 to
CAMIN4 instances of the MC_CamIn instruction. The
array elements ARRAY[0..N] are set with the Cam Editor.
The CAMIN1 to CAMIN4 instances of MC_CamIn are
executed when this variable changes to TRUE.
This variable indicates if it is necessary to set the input
parameters. Input parameters are set when this variable
is FALSE. When setting the input parameters is completed, this variable changes to TRUE.
3-211
3 Axis Command Instructions
z Timing Chart
Master axis
MC_Axis000.Cmd.Pos
Slave axis 1
MC_Axis001.Cmd.Pos
Slave axis 2
MC_Axis002.Cmd.Pos
Slave axis 3
MC_Axis003.Cmd.Pos
Slave axis 4
MC_Axis004.Cmd.Pos
MC_MoveVelocity Instruction
Vel_InVel
MC_CamIn Instruction
Ex *1
InCam *2
InSync *3
Busy *4
Active *5
Camin1_Eop
Camin2_Eop
Camin3_Eop
Camin4_Eop
*1 The timing is the same for the following: Camin1_InCam, Camin2_InCam, Camin3_InCam, and Camin4_InCam.
*2 The timing is the same for the following: Camin1_InSync, Camin2_InSync, Camin3_InSync, and Camin4_InSync. In this sample, MasterStartDistance is 0, so InSync changes to TRUE from when the master axis is 0°.
*3 The timing is the same for the following: Camin1_Bsy, Camin2_Bsy, Camin3_Bsy, and Camin4_Bsy.
*4 The timing is the same for the following: Camin1_Act, Camin2_Act, Camin3_Act, and Camin4_Act.
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
//MC_MoveVelocity Input Parameter
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#0.0;
Vel_Dec := LREAL#0.0;
Vel_Dir := _eMC_DIRECTION#_mcPositiveDirection;
//MC_CamIn Input Parameter
Camin1_Em
:= TRUE;
Camin1_Sm
:= _eMC_START_MODE#_mcAbsolutePosition;
Camin1_Sp
:= LREAL#0.0;
Camin1_Msd
:= LREAL#0.0;
Camin1_Ms
:= LREAL#1.0;
Camin1_Ss
:= LREAL#1.0;
3-212
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Camin3_Em
Camin3_Sm
Camin3_Sp
Camin3_Msd
Camin3_Ms
Camin3_Ss
Camin3_Mo
Camin3_So
Camin3_Rt
Camin3_Dir
:= TRUE;
:= _eMC_START_MODE#_mcAbsolutePosition;
:= LREAL#0.0;
:= LREAL#0.0;
:= LREAL#1.0;
:= LREAL#1.0;
:= LREAL#130.0;
:= LREAL#0.0;
:= _eMC_REFERENCE_TYPE#_mcCommand;
:= _eMC_DIRECTION#_mcNoDirection;
Camin4_Em
Camin4_Sm
Camin4_Sp
Camin4_Msd
Camin4_Ms
Camin4_Ss
Camin4_Mo
Camin4_So
Camin4_Rt
Camin4_Dir
:= TRUE;
:= _eMC_START_MODE#_mcAbsolutePosition;
:= LREAL#0.0;
:= LREAL#0.0;
:= LREAL#1.0;
:= LREAL#1.0;
:= LREAL#180.0;
:= LREAL#0.0;
:= _eMC_REFERENCE_TYPE#_mcCommand;
:= _eMC_DIRECTION#_mcNoDirection;
3
Sample Programming 2
:= LREAL#30.0;
:= LREAL#0.0;
:= _eMC_REFERENCE_TYPE#_mcCommand;
:= _eMC_DIRECTION#_mcNoDirection;
:= TRUE;
:= _eMC_START_MODE#_mcAbsolutePosition;
:= LREAL#0.0;
:= LREAL#0.0;
:= LREAL#1.0;
:= LREAL#1.0;
:= LREAL#80.0;
:= LREAL#0.0;
:= _eMC_REFERENCE_TYPE#_mcCommand;
:= _eMC_DIRECTION#_mcNoDirection;
MC_CamIn
Camin1_Mo
Camin1_So
Camin1_Rt
Camin1_Dir
Camin2_Em
Camin2_Sm
Camin2_Sp
Camin2_Msd
Camin2_Ms
Camin2_Ss
Camin2_Mo
Camin2_So
Camin2_Rt
Camin2_Dir
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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 StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 3 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
NY-series Motion Control Instructions Reference Manual (W561)
3-213
3 Axis Command Instructions
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis002.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis002.Cfg.NodeAddress]=FALSE) THEN
Pwr3_En:=TRUE;
ELSE
Pwr3_En:=FALSE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 4 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis003.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis003.Cfg.NodeAddress]=FALSE) THEN
Pwr4_En:=TRUE;
ELSE
Pwr4_En:=FALSE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 5 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis004.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis004.Cfg.NodeAddress]=FALSE) THEN
Pwr5_En:=TRUE;
ELSE
Pwr5_En:=FALSE;
END_IF;
// If a minor fault level error occurs for axis 1 to axis 5, 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_Axis002.MFaultLvl.Active=TRUE)
OR (MC_Axis003.MFaultLvl.Active=TRUE)
OR (MC_Axis004.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed for axis 1.
IF (Pwr1_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed for axis 2.
IF (Pwr2_Status=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 3 and home is not defined, the Home instruction is executed for axis 3.
IF (Pwr3_Status=TRUE) AND (MC_Axis002.Details.Homed=FALSE) THEN
Hm3_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 4 and home is not defined, the Home instruction is executed for axis 4.
IF (Pwr4_Status=TRUE) AND (MC_Axis003.Details.Homed=FALSE) THEN
Hm4_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 5 and home is not defined, the Home instruction is executed for axis 5.
IF (Pwr5_Status=TRUE) AND (MC_Axis004.Details.Homed=FALSE) THEN
Hm5_Ex:=TRUE;
END_IF;
3-214
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
// After homing is completed for axis 1, MC_MoveVelocity is executed.
IF Hm1_D=TRUE THEN
Vel_Ex:=TRUE;
END_IF;
// If home is defined for axis 2 and Vel_InVel of MC_MoveVelocity is TRUE,
// the MC_CamIn instruction for axis 2 (slave axis) is executed.
IF (Vel_InVel=TRUE) AND (MC_Axis001.Details.Homed=TRUE) THEN
Camin1_Ex := TRUE;
END_IF;
MC_CamIn
// If home is defined for axis 3 and Vel_InVel of MC_MoveVelocity is TRUE,
// the MC_CamIn instruction for axis 3 (slave axis) is executed.
IF (Vel_InVel=TRUE) AND (MC_Axis002.Details.Homed=TRUE) THEN
Camin2_Ex := TRUE;
END_IF;
// If home is defined for axis 4 and Vel_InVel of MC_MoveVelocity is TRUE,
// the MC_CamIn instruction for axis 4 (slave axis) is executed.
IF (Vel_InVel=TRUE) AND (MC_Axis003.Details.Homed=TRUE) THEN
Camin3_Ex := TRUE;
END_IF;
3
Sample Programming 2
// If home is defined for axis 5 and Vel_InVel of MC_MoveVelocity is TRUE,
// the MC_CamIn instruction for axis 5 (slave axis) is executed.
IF (Vel_InVel=TRUE) AND (MC_Axis004.Details.Homed=TRUE) THEN
Camin4_Ex := TRUE;
END_IF;
// MC_Power for axis 1
PWR1(
Axis
:= MC_Axis000,
Enable
:= Pwr1_En,
Status
=> Pwr1_Status,
Busy
=> Pwr1_Bsy,
Error
=> Pwr1_Err,
ErrorID
=> Pwr1_ErrID
);
// MC_Power for axis 2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_Status,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
// MC_Power for axis 3
PWR3(
Axis
:= MC_Axis002,
Enable
:= Pwr3_En,
Status
=> Pwr3_Status,
Busy
=> Pwr3_Bsy,
Error
=> Pwr3_Err,
ErrorID
=> Pwr3_ErrID
);
// MC_Power for axis 4
PWR4(
Axis
:= MC_Axis003,
Enable
:= Pwr4_En,
Status
=> Pwr4_Status,
Busy
=> Pwr4_Bsy,
NY-series Motion Control Instructions Reference Manual (W561)
3-215
3 Axis Command Instructions
Error
ErrorID
=> Pwr4_Err,
=> Pwr4_ErrID
);
// MC_Power for axis 5
PWR5(
Axis
:= MC_Axis004,
Enable
:= Pwr5_En,
Status
=> Pwr5_Status,
Busy
=> Pwr5_Bsy,
Error
=> Pwr5_Err,
ErrorID
=> Pwr5_ErrID
);
// MC_Home for axis 1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home for axis 2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home for axis 3
HM3(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home for axis 4
HM4(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home for axis 5
HM5(
Axis
Execute
Done
Busy
CommandAborted
3-216
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
:= MC_Axis002,
:= Hm3_Ex,
=> Hm3_D,
=> Hm3_Bsy,
=> Hm3_Ca,
=> Hm3_Err,
=> Hm3_ErrID
:= MC_Axis003,
:= Hm4_Ex,
=> Hm4_D,
=> Hm4_Bsy,
=> Hm4_Ca,
=> Hm4_Err,
=> Hm4_ErrID
:= MC_Axis004,
:= Hm5_Ex,
=> Hm5_D,
=> Hm5_Bsy,
=> Hm5_Ca,
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Error
ErrorID
=> Hm5_Err,
=> Hm5_ErrID
);
CAMIN2(
Master
Slave
CamTable
Execute
Periodic
StartMode
StartPosition
MasterStartDistance
MasterScaling
SlaveScaling
MasterOffset
SlaveOffset
ReferenceType
Direction
InCam
InSync
3
Sample Programming 2
//MC_CamIn
CAMIN1(
Master
Slave
CamTable
Execute
Periodic
StartMode
StartPosition
MasterStartDistance
MasterScaling
SlaveScaling
MasterOffset
SlaveOffset
ReferenceType
Direction
InCam
InSync
EndOfProfile
Index
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Dir,
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
MC_CamIn
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Direction
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= MC_Axis001,
:= CamProfile0,
:= Camin1_Ex,
:= Camin1_Em,
:= Camin1_Sm,
:= Camin1_Sp,
:= Camin1_Msd,
:= Camin1_Ms,
:= Camin1_Ss,
:= Camin1_Mo,
:= Camin1_So,
:= Camin1_Rt,
:= Camin1_Dir,
=> Camin1_InCam,
=> Camin1_InSync,
=> Camin1_Eop,
=> Camin1_Index,
=> Camin1_Bsy,
=> Camin1_Act,
=> Camin1_Ca,
=> Camin1_Err,
=> Camin1_ErrID
:= MC_Axis000,
:= MC_Axis002,
:= CamProfile0,
:= Camin2_Ex,
:= Camin2_Em,
:= Camin2_Sm,
:= Camin2_Sp,
:= Camin2_Msd,
:= Camin2_Ms,
:= Camin2_Ss,
:= Camin2_Mo,
:= Camin2_So,
:= Camin2_Rt,
:= Camin2_Dir,
=> Camin2_InCam,
=> Camin2_InSync,
NY-series Motion Control Instructions Reference Manual (W561)
3-217
3 Axis Command Instructions
EndOfProfile
Index
Busy
Active
CommandAborted
Error
ErrorID
=> Camin2_Eop,
=> Camin2_Index,
=> Camin2_Bsy,
=> Camin2_Act,
=> Camin2_Ca,
=> Camin2_Err,
=> Camin2_ErrID
);
3-218
CAMIN3(
Master
Slave
CamTable
Execute
Periodic
StartMode
StartPosition
MasterStartDistance
MasterScaling
SlaveScaling
MasterOffset
SlaveOffset
ReferenceType
Direction
InCam
InSync
EndOfProfile
Index
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= MC_Axis003,
:= CamProfile0,
:= Camin3_Ex,
:= Camin3_Em,
:= Camin3_Sm,
:= Camin3_Sp,
:= Camin3_Msd,
:= Camin3_Ms,
:= Camin3_Ss,
:= Camin3_Mo,
:= Camin3_So,
:= Camin3_Rt,
:= Camin3_Dir,
=> Camin3_InCam,
=> Camin3_InSync,
=> Camin3_Eop,
=> Camin3_Index,
=> Camin3_Bsy,
=> Camin3_Act,
=> Camin3_Ca,
=> Camin3_Err,
=> Camin3_ErrID
CAMIN4(
Master
Slave
CamTable
Execute
Periodic
StartMode
StartPosition
MasterStartDistance
MasterScaling
SlaveScaling
MasterOffset
SlaveOffset
ReferenceType
Direction
InCam
InSync
EndOfProfile
Index
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= MC_Axis004,
:= CamProfile0,
:= Camin4_Ex,
:= Camin4_Em,
:= Camin4_Sm,
:= Camin4_Sp,
:= Camin4_Msd,
:= Camin4_Ms,
:= Camin4_Ss,
:= Camin4_Mo,
:= Camin4_So,
:= Camin4_Rt,
:= Camin4_Dir,
=> Camin4_InCam,
=> Camin4_InSync,
=> Camin4_Eop,
=> Camin4_Index,
=> Camin4_Bsy,
=> Camin4_Act,
=> Camin4_Ca,
=> Camin4_Err,
=> Camin4_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_CamOut
Cam operation is ended for the axis specified with the input parameter.
Instruction
MC_CamOut
Name
FB/FUN
End Cam Operation FB
MC_CamOut_instance
MC_CamOut
Slave
Execute
Deceleration
Jerk
OutMode
Slave
Done
Busy
CommandAborted
Error
ErrorID
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when Execute changes to TRUE.
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate. The unit
is command units/s2.*1
Jerk (Reserved) Jerk
LREAL
0
0
(Reserved)
OutMode
(Reserved)
_eMC_
OUT_
MODE
0: _mcStop
0*2
(Reserved)
Sync End
Mode Selection
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-219
3
Variables
ST expression
MC_CamOut_instance (
Slave :=parameter,
Execute :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
OutMode :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_CamOut
Graphic expression
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When the velocity reaches 0.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When this instruction is executed while
there is an error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution con- When the error is cleared.
ditions or input parameters for the instruction.
In-Out Variables
Name
Slave
Meaning
Slave Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the slave axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_CamOut instruction disables cam operation of the slave axis.
• When Execute changes to TRUE, the axis starts decelerating towards 0 velocity at the deceleration
rate specified with Deceleration (Deceleration Rate).
• When the command velocity reaches 0, the instruction is completed.
• If you execute this instruction on an axis that is not in cam operation, an error will occur.
Precautions for Correct Use
• Cam data variables are global variables. You can therefore access or change the values of
cam data variables from more than one task. If you change the values of cam data variables
from more than one task, program the changes so that there is no competition in writing the
value from more than one task.
• If you use exclusive control of global variables between tasks for a cam data variable, do not
use the cam data variable for motion control instructions in a task that does not control the
variable. An Incorrect Cam Table Specification error (error code: 5439 hex) will occur.
3-220
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
Master axis position
MasterStartDistance
StartPosition
Slave axis position
Synchronized control
Synchronized control
MC_CamOut
Deceleration stopping
Deceleration stopping
MC_CamIn
Execute
InCam
3
InSync
Function
EndOfProfile
Busy
Active
MC_CamOut
Execute
Done
Busy
NY-series Motion Control Instructions Reference Manual (W561)
3-221
3 Axis Command Instructions
Aborting the Instruction
If an axis error occurs for the slave axis during execution of this instruction, CommandAborted changes
to TRUE and Busy (Executing) changes to FALSE. The axis will decelerate at the rate specified with
Deceleration (Deceleration Rate) for this instruction.
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for information on axis errors.
Master axis position
MasterStartDistance
Error
occurs in slave axis.
StartPosition
Slave axis position
Error occurs
in slave axis.
Deceleration stopping
Deceleration stopping
MC_CamIn
Execute
InCam
InSync
Busy
Active
MC_CamOut
Execute
Done
Busy
CommandAborted
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Instructions
z Execution during Execution of Other Instructions
If you execute this instruction while the MC_CamIn (Start Cam Operation) instruction is in execution,
CommandAborted for the MC_CamIn instruction will change to TRUE and Busy for this instruction
will change to TRUE. If this instruction is executed when the MC_CamIn (Start Cam Operation)
instruction is not in execution, and an error will occur.
z Execution of Other Instructions during Instruction Execution
To use multi-execution of motion instructions for this instruction, specify the slave axis.
If you execute another instruction during execution of this instruction, you can specify either aborting
or buffering.
3-222
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE. You can find out the cause of
the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Master axis position
MasterStartDistance
MC_CamOut
StartPosition
Slave axis position
3
Deceleration stopping
MC_CamIn
Execute
Function
InCam
InSync
Busy
Active
MC_CamOut
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-223
3 Axis Command Instructions
MC_GearIn
Specifies the gear ratio between the master axis and the slave axis and starts gear operation.
Instruction
MC_GearIn
Name
Start Gear
Operation
FB/FUN
Graphic expression
FB
ST expression
MC_GearIn_instance
MC_GearIn
Master
Master
Slave
Slave
Execute
InGear
RatioNumerator
Busy
Active
RatioDenominator
CommandAborted
ReferenceType
Acceleration
Error
Deceleration
ErrorID
Jerk
BufferMode
MC_GearIn_instance (
Master :=parameter,
Slave :=parameter,
Execute :=parameter,
RatioNumerator :=parameter,
RatioDenominator :=parameter,
ReferenceType :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
BufferMode :=parameter,
InGear =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Ratio
Numerator
Gear Ratio
Numerator
DINT*1
Positive or negative
number*1
10,000
Specify the numerator of the electronic gear ratio between the master
and slave axes.
Ratio
Denominator
Gear Ratio
Denominator
UDINT*2
Positive number
10,000
Specify the denominator of the electronic gear ratio between the master
and slave axes.
Reference
Type*3
Position Type
Selection
_eMC_ REFERENCE_
TYPE
0: _mcCommand
0*4
Specify the position type.
1: _mcFeedback
0: Command position (value calculated in the previous task
period*5)
2: _mcLatestCommand
1: Actual position (value obtained in
the same task period*5)
2: Command position (value calculated in the same task period*5)
Acceleration
3-224
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate. The
unit is command units/s2.*6
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Meaning
Data type
Valid range
Default
Description
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate. The
unit is command units/s2.*3
Jerk
(Reserved)
Jerk
LREAL
0
0
(Reserved)
BufferMode
Buffer Mode
Selection
_eMC_
BUFFER_
MODE
0: _mcAborting
0*2
Specify the behavior when executing more than one motion instruction.
0: Aborting
1: Buffered
1: _mcBuffered
*2 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use this variable. For
any previous version combinations, the data type is UINT.
*3 To use _mcLatestCommand, the following condition must be met for the master and slave axes.
When you use _mcLatestCommand, the axis number set for the Master (Master Axis) in the system-defined variable for
motion control must be lower than the axis number set for the Slave (Slave Axis) in the system-defined variable for motion
control.
*5 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
*6 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
Output Variables
Name
Meaning
Data type
Valid range
Description
InGear
Gear Ratio
Achieved
BOOL
TRUE or
FALSE
TRUE when the slave axis reaches the target velocity.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
InGear
Timing for changing to TRUE
When the following relationship is established.
• Accelerating: Velocity of slave axis ≥ Velocity of
master axis × Gear ratio
• Decelerating: Velocity of slave axis ≤ Velocity of
master axis × Gear ratio
Busy
When Execute changes to TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
Timing for changing to FALSE
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
3-225
3
Variables
*4 The default value for an enumeration variable is actually not the number, but the enumerator.
MC_GearIn
*1 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use this variable. For
any previous version combinations, the data type is UINT and the valid range is positive numbers.
3 Axis Command Instructions
Name
Timing for changing to TRUE
Timing for changing to FALSE
Active
When the instruction is started.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When the MC_GearOut instruction is executed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Meaning
Data type
Master
Name
Master Axis
_sAXIS_REF
---
Valid range
Description
Specify the master axis.*
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Precautions for Correct Use
If you specify the same axis for the master axis and slave axis, a Master and Slave Defined as
Same Axis minor fault (error code 5436 hex) will occur.
Function
• The MC_GearIn instruction performs gear operation for the slave axis specified with Slave. The following parameters are also specified: RatioNumerator (Gear Ratio Numerator), RatioDenominator
(Gear Ratio Denominator), ReferenceType (Position Type), Acceleration (Acceleration Rate), and
Deceleration (Deceleration Rate).
• For the master axis, you can specify the command position, actual position, or most recent command
position.
Specified with
ReferenceType.
Actual position
Command position
Gear function
Numerator
Denominator
Command position
Remainder
Most recent
command position
3-226
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• After operation starts, the slave axis uses the velocity of the master axis multiplied by the gear ratio
for its target velocity, and accelerates/decelerates accordingly.
• The catching phase exists until the target velocity is reached. The InGear phase exists after that.
• If the gear ratio is positive, the slave axis and master axis move in the same direction.
Position
Catching phase
InGear phase
Master
MC_GearIn
Travel distance of slave axis
RatioNumerator
= Travel distance of master axis ×
RatioDenominator
3
Slave
Function
Execute
Time
• If the gear ratio is negative, the slave axis and master axis move in the opposite directions.
Position
Catching Phase
InGear phase
Master
Travel distance of slave axis
RatioNumerator
= Travel distance of master axis ×
RatioDenominator
Slave
Execute
Time
• Electronic gear operation starts when Execute changes to TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3-227
3 Axis Command Instructions
Precautions for Correct Use
Do not execute the MC_SetPosition instruction for the Master (Master Axis) if you use this
instruction on a CPU Unit with unit version 1.09 or earlier. If the MC_SetPosition instruction is
executed for the Master (Master Axis), the Slave (Slave Axis) may follow the master axis quickly.
If you want to use the MC_SetPosition instruction for the Master (Master Axis), disable the relationship between the Master (Master Axis) and Slave (Slave Axis) before executing the instruction.
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
z ReferenceType (Position Type Selection)
You can select one of the following position types.
• _mcCommand: Command position (value calculated in the previous task period)
The master axis command position that was calculated in the previous task period is used for the
current period.
The command value that was calculated for the master axis in the last periodic task is used to calculate the command position of the slave axis in the current period.
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
• _mcLatestCommand: Command position (value calculated in the same task period)
The command position of the master axis that was calculated in the same task period is used.
This enables the use of information that is more recent than for _mcCommand. However, the axis
number of the master axis must be set lower than the axis number of the slave axis.
If the axis number of the slave axis is lower than the axis number of the master axis, Error will
change to TRUE. A Master/Slave Axis Numbers Not in Ascending Order error (error code: 5438
hex) will be output to ErrorID.
Precautions for Correct Use
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
Additional Information
The command position that is calculated in the same task period enables greater precision in
synchronization than the command position that was calculated in the previous task period.
However, the axis number set for the Master (Master Axis) in the system-defined variable for
motion control must be lower than the axis number set for the Slave (Slave Axis) in the systemdefined variable for motion control.
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
Axis Type
Servo axis
Encoder axis
Virtual servo axis
Virtual encoder axis
ReferenceType
_mcCommand or _mcLatestCommand
OK
No*
OK
No*
_mcFeedback
OK
OK
OK
OK
* A Position Type Selection Out of Range error (error code: 5430 hex) occurs when the instruction is executed.
3-228
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• InGear (Gear Ratio Reached) changes to TRUE when the target velocity is reached.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing), Active (Controlling), and InGear (Gear Ratio Reached) change to FALSE.
• Use the MC_GearOut (End Gear Operation) or MC_Stop instruction to stop electronic gear operation
before it is completed.
MC_GearIn
Execute
InGear
Busy
3
Active
Function
CommandAborted
Error
ErrorID
16#0000
InGearPhase
Multi-execution of
another instruction
Velocity
MC_GearIn executed.
Time
You can specify the Acceleration (Acceleration Rate) and Deceleration (Deceleration Rate) as input
variables.
Velocity
Velocity
MC_GearIn executed.
InGear phase
Acceleration
MC_GearIn executed.
Deceleration
InGear phase
Time
Time
When the Acceleration (Acceleration Rate) or Deceleration (Deceleration Rate) is 0 and you execute
this instruction, the axis will reach the target velocity without accelerating or decelerating.
Velocity
Velocity
The axis enters InGear phase state
as soon as MC_GearIn is executed.
Time
NY-series Motion Control Instructions Reference Manual (W561)
The axis becomes InGear phase
at the same time as executing
MC_GearIn.
Time
3-229
3 Axis Command Instructions
Re-execution of Motion Instructions
You can change the operation of the instruction if you change an input variable during positioning and
change Execute to TRUE again. Input variables RatioNumerator (Gear Ratio Numerator), RatioDenominator (Gear Ratio Denominator), Acceleration (Acceleration Rate), and Deceleration (Deceleration
Rate) can be changed by re-executing the motion control instruction. For details on re-execution of
motion control instructions, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No.
W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No.
W559).
The following timing chart shows when the instruction is re-executed during the Catching phase to
change the Acceleration (Acceleration Rate).
Execute
InGear
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Velocity
Master axis velocity
MC_GearIn
re-executed.
Time
3-230
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
The following timing chart shows when the instruction is re-executed during the InGear phase to
change the RatioNumerator (Gear Ratio Numerator) and RatioDenominator (Gear Ratio Denominator).
The motion is the same as when Acceleration (Acceleration Rate) and Deceleration (Deceleration Rate)
are both set to 0.
Execute
InGear
Busy
MC_GearIn
Active
CommandAborted
Error
ErrorID
3
16#0000
Function
Velocity
Master axis velocity
MC_GearIn re-executed.
Time
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis.
Specify the operation of this instruction by using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion
will be reversed according to the Operation Selection at Reversing axis parameter.
Buffered
Automatically executes the buffered instruction after the current instruction is
completed.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
Another instruction with the Buffer Mode set to Aborting can be executed during execution of this
instruction. In that case, the gear operation is stopped and the operation of the aborting instruction is
started. You cannot specify any Buffer Mode with other than Aborting.
NY-series Motion Control Instructions Reference Manual (W561)
3-231
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
InGear
Busy
Active
CommandAborted
Error
ErrorID
Error code
Additional Information
• The slave axis is not affected by the error status of the master axis during synchronized control. The error status of the master axis is cleared and the slave axis continues electronic gear
operation after the master axis operates normally.
• The master axis is not affected if an error occurs for the slave axis during startup or execution
of this instruction.
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-232
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Sample Programming
This section shows sample programming for operation proportional to a gear ratio.
Additional Information
You can specify only the initial values for input variables that are reserved. Parameters are not
specified in this sample.
MC_GearIn
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
3
Axis Types
Sample Programming
Axis
Axis Type
Axis 1
Servo axis (master axis)
Axis 2
Servo axis (slave axis)
Axis 3
Servo axis (slave axis)
Count Modes
Axis
Count Mode
Axis 1
Rotary Mode
Axis 2
Rotary Mode
Axis 3
Rotary Mode
Ring Counter
Axis
Modulo maximum position
Modulo minimum position
Axis 1
360
0
Axis 2
360
0
Axis 3
360
0
Units of Display
Axis
Unit of Display
Axis 1
mm
Axis 2
mm
Axis 3
mm
NY-series Motion Control Instructions Reference Manual (W561)
3-233
3 Axis Command Instructions
Operation Example
Axis 1
1:2
2:3
Axis 2
1
Axis 3
Starting the Master Axis
The master axis (axis 1) is an actual servo axis and it is operated with velocity control.
2
Executing the Slave Axes
When the actual velocity for the master axis reaches the target velocity, gear operation is performed so that the gear ratio of axis 2 (slave axis) is 1:2 and axis 3 (slave axis) is 2:3 against the
actual position of the master axis.
3
Stopping the Slave Axes
When the actual position of the master axis MC_Axis000.Act.Pos exceeds 1000.0, gear operation of axis 2 is ended and axis 2 decelerates to a stop with deceleration rate DecRate. Axis 3
continues gear operation.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.Act.Pos
MC_Axis001
MC_Axis002
Pwr1_Status
3-234
Data type
_sAXIS_REF
LREAL
_sAXIS_REF
_sAXIS_REF
BOOL
Default
--------FALSE
Pwr2_Status
BOOL
FALSE
Pwr3_Status
BOOL
FALSE
StartPg
BOOL
FALSE
Vel_InVel
BOOL
FALSE
Gearin1_Act
BOOL
FALSE
Gearout_Ex
BOOL
FALSE
Comment
Axis Variable for the master axis, axis 1.
This variable gives the actual current position of axis 1.
Axis Variable for the slave axis, axis 2.
Axis Variable for the slave axis, axis 3.
This variable is assigned to the Status output variable from
the PWR1 instance of the MC_Power instruction. This variable changes to TRUE when the Servo is turned ON.
This variable is assigned to the Status output variable from
the PWR2 instance of the MC_Power instruction. This variable changes to TRUE when the Servo is turned ON.
This variable is assigned to the Status output variable from
the PWR3 instance of the MC_Power instruction. This variable changes to TRUE when the Servo is turned ON.
The Servo is turned ON if this variable is TRUE and EtherCAT process data communications are established.
This variable is assigned to the InVelocity output variable
from the VEL instance of the MC_MoveVelocity instruction. It
is TRUE when the target velocity is reached.
This variable is assigned to the Active output variable from
the GEARIN1 instance of the MC_GearIn instruction. It is
TRUE during control operations for GEARIN1.
The GEAROUT instance of MC_GearOut is executed when
this variable changes to TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Pwr1_Status
Pwr2_Status
Pwr3_Status
Vel_InVel
Vel_Bsy
Vel_Act
MC_GearIn
Gearin1_InGear
Gearin1_Bsy
Gearin1_Act
Gearin1_Ca
3
Gearin2_InGear
Gearin2_Bsy
Sample Programming
Gearin2_Act
Gearout_Bsy
Gearout_D
Axis 1
Command position
1000
Actual position
Command velocity
Axis 2
Command velocity
Axis 3
Command velocity
NY-series Motion Control Instructions Reference Manual (W561)
3-235
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
_EC_PDSlavTbl[MC_Axis002.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis002.Cfg.NodeAddress]
Lock3
If process data communications are active, the Servo is turned ON for the axes.
PWR1
MC_Power
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
PWR2
MC_Power
MC_Axis001
Lock2
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
PWR3
MC_Power
MC_Axis002
Lock3
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr3_Status
Pwr3_Bsy
Pwr3_Err
Pwr3_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
MC_Axis002.MFaultLvl.Active
The MC_MoveVelocity (Velocity Control) instruction is executed after the Servo is turned ON for the master axis (axis 1).
VEL
MC_MoveVelocity
Pwr1_Status
MC_Axis000
LREAL#2000.0
LREAL#2000.0
LREAL#2000.0
_eMC_DIRECTION#_mcPositiveDirection
3-236
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
When the actual velocity for the master axis (axis 1) reaches the target velocity, gear operation is performed so that
the gear ratio of axis 2 (slave axis) is 1:2 and axis 3 (slave axis) is 2:3.
GEARIN1
Vel_InVel Pwr2_Status
MC_Axis000
MC_Axis001
Gearin1_InGear
Gearin1_Bsy
Gearin1_Act
Gearin1_Ca
Gearin1_Err
Gearin1_ErrID
MC_GearIn
UINT#1
UINT#2
_eMC_REFERENCE_TYPE#_mcFeedback
LREAL#4000.0
LREAL#4000.0
MC_GearIn
Master
Master
Slave
Slave
Execute
InGear
RatioNumerator
Busy
RatioDenominator
Active
ReferenceType CommandAborted
Acceleration
Error
ErrorID
Deceleration
Jerk
BufferMode
GEARIN2
MC_GearIn
Pwr3_Status
MC_Axis000
MC_Axis002
3
Gearin2_InGear
Sample Programming
UINT#2
UINT#3
_eMC_REFERENCE_TYPE#_mcFeedback
LREAL#4000.0
LREAL#4000.0
Master
Master
Slave
Slave
Execute
InGear
RatioNumerator
Busy
RatioDenominator
Active
ReferenceType CommandAborted
Acceleration
Error
ErrorID
Deceleration
Jerk
BufferMode
Gearin2_Bsy
Gearin2_Act
Gearin2_Ca
Gearin2_Err
Gearin2_ErrID
When the actual position of the master axis is 1000.0 or higher during gear operation of axis 2 (slave axis),
Gearout_Ex changes to TRUE.
Note: The contents of the inline ST
are given below.
When Gearout_Ex changes to TRUE, gear operation is stopped for the axis 2 (slave axis). The axis decelerates to
a stop.
GEAROUT
Gearout_Ex
MC_Axis001
DecRate
MC_GearOut
Slave
Slave
Execute
Done
Deceleration
Busy
Jerk
CommandAborted
OutMode
Error
ErrorID
Gearout_D
Gearout_Bsy
Gearout_Ca
Gearout_Err
Gearout_ErrID
Contents of Inline ST
IF (Gearin1_Act=TRUE) AND (MC_Axis000.Act.Pos>=LREAL#1000.0) THEN
Gearout_Ex := TRUE;
END_IF;
NY-series Motion Control Instructions Reference Manual (W561)
3-237
3 Axis Command Instructions
Structured Text (ST)
z Main Variables
3-238
Name
MC_Axis000
MC_Axis000.Act.Pos
Data type
_sAXIS_REF
LREAL
Default
-----
MC_Axis001
MC_Axis002
Pwr1_Status
_sAXIS_REF
_sAXIS_REF
BOOL
----FALSE
Pwr2_Status
BOOL
FALSE
Pwr3_Status
BOOL
FALSE
StartPg
BOOL
FALSE
Vel_InVel
BOOL
FALSE
Gearin1_Act
BOOL
FALSE
Gearout_Ex
BOOL
FALSE
Vel_Ex
BOOL
FALSE
Gearin1_Ex
BOOL
FALSE
Gearin2_Ex
BOOL
FALSE
InitFlag
BOOL
FALSE
Comment
Axis Variable for the master axis, axis 1.
This variable gives the actual current position of
axis 1.
Axis Variable for the slave axis, axis 2.
Axis Variable for the slave axis, axis 3.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR3 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
This variable is assigned to the InVelocity output
variable from the VEL instance of the
MC_MoveVelocity instruction. It is TRUE when
the target velocity is reached.
This variable is assigned to the Active output variable from the GEARIN1 instance of the
MC_GearIn instruction. It is TRUE during control
operations for GEARIN1.
The GEAROUT instance of MC_GearOut is executed when this variable changes to TRUE.
The VEL instance of MC_MoveVelocity is executed when this variable changes to TRUE.
The GEARIN1 instance of MC_GearIn is executed when this variable changes to TRUE.
The GEARIN2 instance of MC_GearIn is executed when this variable changes to TRUE.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes
to TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart
Pwr1_Status
Pwr2_Status
Pwr3_Status
Vel_Ex
Vel_InVel
Vel_Bsy
MC_GearIn
Vel_Act
Gearin1_Ex
Gearin1_InGear
Gearin1_Bsy
3
Gearin1_Act
Gearin1_Ca
Sample Programming
Gearin2_Ex
Gearin2_InGear
Gearin2_Bsy
Gearin2_Act
Gearout_Ex
Gearout_Bsy
Gearout_D
Axis 1
Command position
1000
Actual position
Command velocity
Axis 2
Command velocity
Axis 3
Command velocity
NY-series Motion Control Instructions Reference Manual (W561)
3-239
3 Axis Command Instructions
z Sample Programming
// Processing when input parameters are not set
IF InitFlag = FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel := LREAL#2000.0;
Vel_Acc := LREAL#2000.0;
Vel_Dec := LREAL#2000.0;
Vel_Dir := _eMC_DIRECTION#_mcPositiveDirection;
// MC_GearIn1 parameters
Gearin1_Rn
:= UINT#1;
Gearin1_Rd
:= UINT#2;
Gearin1_Rt
:= _eMC_REFERENCE_TYPE#_mcFeedback;
Gearin1_Acc
:= LREAL#4000.0;
Gearin1_Dec
:= LREAL#4000.0;
// MC_GearIn2 parameters
Gearin2_Rn
:= UINT#2;
Gearin2_Rd
:= UINT#3;
Gearin2_Rt
:= _eMC_REFERENCE_TYPE#_mcFeedback;
Gearin2_Acc
:= LREAL#4000.0;
Gearin2_Dec
:= LREAL#4000.0;
// MC_GearOut parameters
DecRate
:= LREAL#200.0;
Gearout_Dec
:= DecRate;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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 StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 3 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis002.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis002.Cfg.NodeAddress]=FALSE) THEN
Pwr3_En:=TRUE;
ELSE
Pwr3_En:=FALSE;
END_IF;
3-240
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
// If a minor fault level error occurs for axis 1 to axis 3, 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_Axis002.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1, the MC_MoveVelocity instruction is executed.
IF Pwr1_Status=TRUE THEN
Vel_Ex := TRUE;
END_IF;
IF (Vel_InVel=TRUE) AND (Pwr2_Status=TRUE) THEN
Gearin1_Ex := TRUE;
END_IF;
3
// If the actual position of axis 1 is 1000.0 or higher during gear operation for axis 2,
// the GearOut instruction for axis 2 (slave axis) is executed.
IF (Gearin1_Act=TRUE) AND (MC_Axis000.Act.Pos>=LREAL#1000.0) THEN
Gearout_Ex := TRUE;
END_IF;
// MC_Power for axis 1
PWR1(
Axis
:= MC_Axis000,
Enable
:= Pwr1_En,
Status
=> Pwr1_Status,
Busy
=> Pwr1_Bsy,
Error
=> Pwr1_Err,
ErrorID
=> Pwr1_ErrID
);
// MC_Power for axis 2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_Status,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
// MC_Power for axis 3
PWR3(
Axis
:= MC_Axis002,
Enable
:= Pwr3_En,
Status
=> Pwr3_Status,
Busy
=> Pwr3_Bsy,
Error
=> Pwr3_Err,
ErrorID
=> Pwr3_ErrID
);
3-241
Sample Programming
// If InVelocity of MC_MoveVelocity is TRUE and the Servo for axis 3 is ON, MC_GearIn is executed with axis 1
as the master axis and axis 3 as the slave axis.
IF (Vel_InVel=TRUE) AND (Pwr3_Status=TRUE) THEN
Gearin2_Ex := TRUE;
END_IF;
NY-series Motion Control Instructions Reference Manual (W561)
MC_GearIn
// If InVelocity of MC_MoveVelocity is TRUE and the Servo for axis 2 is ON, MC_GearIn is executed with axis 1
as the master axis and axis 2 as the slave axis.
3 Axis Command Instructions
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Direction
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Dir,
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
// MC_GearIn with axis 1 as master axis and axis 2 as slave axis
GEARIN1(
Master
:= MC_Axis000,
Slave
:= MC_Axis001,
Execute
:= Gearin1_Ex,
RatioNumerator
:= Gearin1_Rn,
RatioDenominator := Gearin1_Rd,
ReferenceType
:= Gearin1_Rt,
Acceleration
:= Gearin1_Acc,
Deceleration
:= Gearin1_Dec,
InGear
=> Gearin1_InGear,
Busy
=> Gearin1_Bsy,
Active
=> Gearin1_Act,
CommandAborted => Gearin1_CA,
Error
=> Gearin1_Err,
ErrorID
=> Gearin1_ErrID
);
// MC_GearIn with axis 1 as master axis and axis 3 as slave axis
GEARIN2(
Master
:= MC_Axis000,
Slave
:= MC_Axis002,
Execute
:= Gearin2_Ex,
RatioNumerator
:= Gearin2_Rn,
RatioDenominator := Gearin2_Rd,
ReferenceType
:= Gearin2_Rt,
Acceleration
:= Gearin2_Acc,
Deceleration
:= Gearin2_Dec,
InGear
=> Gearin2_InGear,
Busy
=> Gearin2_Bsy,
Active
=> Gearin2_Act,
CommandAborted => Gearin2_CA,
Error
=> Gearin2_Err,
ErrorID
=> Gearin2_ErrID
);
//MC_GearOut
GEAROUT(
Slave
Execute
Deceleration
Done
Busy
CommandAborted
Error
ErrorID
);
3-242
:= MC_Axis001,
:= Gearout_Ex,
:= Gearout_Dec,
=> Gearout_D,
=> Gearout_Bsy,
=> Gearout_CA,
=> Gearout_Err,
=> Gearout_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_GearInPos
The MC_GearInPos instruction performs electronic gear operation for the specified gear ratio between
the master axis and the slave axis. The positions at which to start synchronizing the master axis and
slave axis are specified.
FB/
FUN
Name
MC_GearInPOS
Positioning
Gear
Operation
FB
ST expression
MC_GearInPos_instance
MC_GearInPos_instance (
Master :=parameter,
Slave :=parameter,
Execute :=parameter,
RatioNumerator :=parameter,
RatioDenominator :=parameter,
ReferenceType :=parameter,
MasterSyncPosition :=parameter,
SlaveSyncPosition :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
BufferMode :=parameter,
StartSync =>parameter,
InSync =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_GearInPos
Master
Master
Slave
Slave
Execute
StartSync
RatioNumerator
InSync
RatioDenominator
Busy
Active
ReferenceType
MasterSyncPosition
CommandAborted
SlaveSyncPosition
Error
ErrorID
Velocity
Acceleration
Deceleration
Jerk
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Ratio
Numerator
Gear Ratio
Numerator
DINT*1
Positive or negative
number*1
10,000
Specify the numerator of the electronic gear ratio between the master
and slave axes.
Ratio
Denominator
Gear Ratio
Denominator
UDINT*2
Positive number
10,000
Specify the denominator of the electronic gear ratio between the master
and slave axes.
Reference
Type*3
Position Type
Selection
_eMC_ REFERENCE_
TYPE
0: _mcCommand
0*4
Specify the position type.
1: _mcFeedback
2: _mcLatestCommand
0: Command position (value calculated in the previous task
period*5)
1: Actual position (value obtained in
the same task period*5)
2: Command position (value calculated in the same task period*5)
NY-series Motion Control Instructions Reference Manual (W561)
3-243
3
Variables
Graphic expression
MC_GearInPos
Instruction
3 Axis Command Instructions
Name
Meaning
Data type
Valid range
Default
Description
MasterSync
Position
Master Sync
Position
LREAL
Negative number, positive number, or 0
0
Specify the absolute master sync
position. The unit is command
units.*6
SlaveSync
Position
Slave Sync
Position
LREAL
Negative number, positive number, or 0
0
Specify the absolute slave sync position. The unit is command units.*3
Velocity
Target Velocity
LREAL
Positive number
0
Specify the target velocity. Always
set the target velocity. If the axis is
moved without setting a target velocity, an error will occur. The unit is
command units/s.*3
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate. The
unit is command units/s2.*3
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate. The
unit is command units/s2.*3
Jerk
(Reserved)
Jerk
LREAL
0
0
(Reserved)
BufferMode
(Reserved)
Buffer Mode
Selection
_eMC_
BUFFER_
MODE
0: _mcAborting
0*2
(Reserved)
*1 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use this variable. For
any previous version combinations, the data type is UINT and the valid range is positive numbers.
*2 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use this variable. For
any previous version combinations, the data type is UINT.
*3 To use _mcLatestCommand, the following condition must be met for the master and slave axes.
When you use _mcLatestCommand, the axis number set for the Master (Master Axis) in the system-defined variable for
motion control must be lower than the axis number set for the Slave (Slave Axis) in the system-defined variable for motion
control.
*4 The default value for an enumeration variable is actually not the number, but the enumerator.
*5 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
*6 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
Output Variables
Name
Meaning
Data type
Valid range
Description
StartSync
Following
BOOL
TRUE or FALSE
TRUE when acceleration/deceleration is started for
synchronization.
InSync
In Sync
BOOL
TRUE or FALSE
TRUE when the slave axis reaches the slave sync
position.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-244
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the axis starts moving.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
InSync
When the slave axis reaches SlaveSyncPosition.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Busy
When Execute changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When an instruction is received.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When the MC_GearOut instruction is executed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
3
Variables
Error
In-Out Variables
Name
Valid range
Meaning
Data type
Master
Master Axis
_sAXIS_REF
---
Specify the master axis.*
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*
Description
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Precautions for Correct Use
If you specify the same axis for the master axis and slave axis, a Master and Slave Defined as
Same Axis minor fault (error code 5436 hex) will occur.
NY-series Motion Control Instructions Reference Manual (W561)
MC_GearInPos
StartSync
3-245
3 Axis Command Instructions
Function
• The MC_GearInPos instruction performs gear operation for the slave axis specified with Slave. The
following parameters are also specified: RatioNumerator (Gear Ratio Numerator), RatioDenominator
(Gear Ratio Denominator), ReferenceType (Position Type), Acceleration (Acceleration Rate), and
Deceleration (Deceleration Rate).
• For the master axis, you can specify the command position, actual position, or most recent command
position.
Specified with
ReferenceType.
Gear function
Numerator
Actual position
Command position
Denominator
Command position
Remainder
Most recent
command position
• After operation starts, the Slave (Slave Axis) accelerates and decelerates in sync with the Master
(Master Axis) in the catching operation.
• Catching phase exists until the slave axis reaches the slave sync position. For either, the position is
synchronized with the master axis.
• The Velocity (Target Velocity) input variable is the target velocity for the catching phase.
• The slave axis moves in the same direction as the master axis when operation is started.
An error occurs if the master axis velocity is 0 when started. If the master axis is moving in the positive direction and SlaveSyncPosition (Slave Sync Position) is smaller than the position of the slave
axis when the instruction was executed, the slave axis will reverse direction. If the master axis is
moving in the negative direction and SlaveSyncPosition (Slave Sync Position) is larger than the position of the slave axis when the instruction was executed, the slave axis will also reverse direction. For
either, the position is synchronized with the master axis.
• If the master axis velocity changes significantly between periods, the slave axis velocity will not be
constant.
3-246
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• If the gear ratio is positive, the slave axis and master axis move in the same direction.
Catching phase
InGear phase
MasterSyncPosition
SlaveSyncPosition
MC_GearInPos
Instruction executed.
Time
StartSync
3
InSync
Function
Busy
Active
• If the gear ratio is negative, the slave axis and master axis move in the opposite directions.
Catching phase
InGear phase
MasterSyncPosition
SlaveSyncPosition
Instruction executed.
Time
Precautions for Correct Use
Do not execute the MC_SetPosition instruction for the Master (Master Axis) if you use this
instruction on a CPU Unit with unit version 1.09 or earlier.
If the MC_SetPosition instruction is executed for the Master (Master Axis), the Slave (Slave Axis)
may follow the Master (Master Axis) quickly.
If you want to use the MC_SetPosition instruction for the Master (Master Axis), disable the relationship between the Master (Master Axis) and Slave (Slave Axis) before executing the instruction.
• The MC Function Module calculates the velocity profile for linear acceleration and deceleration
with the following three velocities using the Acceleration (Acceleration Rate) and Deceleration
(Deceleration Rate).
• The velocity of the Slave (Slave Axis) when an instruction is executed is the initial velocity.
• The velocity of the Master (Master Axis) when an instruction is executed multiplied by the
gear ratio is the final velocity.
• The Velocity (Target Velocity) is the target velocity.
If the travel distance during the catching phase is too short, the target velocity will not be reached.
NY-series Motion Control Instructions Reference Manual (W561)
3-247
3 Axis Command Instructions
Master axis velocity
Vm(T1)
Catching
phase
Time
InGear phase
Slave axis velocity
Velocity
Vm(T1) × Gear ratio
T1
Time
For the Slave (Slave Axis) to catch up with the Master (Master Axis) for the MasterSyncPosition
(Master Sync Position) and SlaveSyncPosition (Slave Sync Position), the following condition must
be met for the Velocity (Target Velocity)
Velocity >
Master axis velocity when MC_GearInPos is executed × Gear ratio numerator
Gear ratio denominator
The information that is used as the mater axis velocity depends on the setting of ReferenceType
(Position Type Selection).
When _mcCommand or _mcLatestCommand is set: Use the command current velocity.
When _mcFeedback is set:
Use the actual current position.
If the Slave (Slave Axis) cannot catch up with the Master (Master Axis) for the MasterSyncPosition
(Master Sync Position) and SlaveSyncPosition (Slave Sync Position), a Positioning Gear Operation
Insufficient Target Velocity error (error code 5447 hex) will occur. Also, if you set the Count Mode to
Rotary Mode, make sure that the synchronous operation starts within one cycle of the ring counter.
• When the Count Mode is set to Rotary Mode, the operation is different for different unit versions of
the CPU Unit as described below.
• CPU Units with Unit Version 1.10 or Later
When the Count Mode of the master axis is Rotary Mode, you can specify a MasterSyncPosition
(Master Sync Position) outside the range specified by the modulo maximum position and modulo
minimum position setting values. If you do, the relationship between the master axis current position and the master sync position will be the same as when no direction is specified for Direction in
the MC_MoveAbsolute (Absolute Positioning) instruction. Refer to MC_MoveAbsolute on page 349 for information on the MC_MoveAbsolute (Absolute Positioning) instruction. In the same way,
when the Count Mode of the slave axis is Rotary Mode, you can specify a SlaveSyncPosition
(Slave Sync Position) outside the range specified by the modulo maximum position and modulo
minimum position setting values.
• CPU Units with Unit Version 1.09 or Earlier
If you set the Count Mode to Rotary Mode, make sure that the synchronous operation starts within
one cycle of the ring counter.
Precautions for Correct Use
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
3-248
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z ReferenceType (Position Type Selection)
You can select one of the following position types.
• _mcCommand: Command position (value calculated in the previous task period)
The master axis command position that was calculated in the previous task period is used for the
current period.
The command value that was calculated for the master axis in the last periodic task is used to calculate the command position of the slave axis in the current period.
• _mcLatestCommand: Command position (value calculated in the same task period)
The command position of the master axis that was calculated in the same task period is used.
This enables the use of information that is more recent than for _mcCommand. However, the axis
number of the master axis must be set lower than the axis number of the slave axis.
If the axis number of the slave axis is lower than the axis number of the master axis, Error will
change to TRUE. A Master/Slave Axis Numbers Not in Ascending Order error (error code: 5438
hex) will be output to ErrorID.
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
Additional Information
The command position that is calculated in the same task period enables greater precision in
synchronization than the command position that was calculated in the previous task period.
However, the axis number set for the Master (Master Axis) in the system-defined variable for
motion control must be lower than the axis number set for the Slave (Slave Axis) in the systemdefined variable for motion control.
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
Axis Type
Servo axis
Encoder axis
Virtual servo axis
Virtual encoder axis
ReferenceType
_mcCommand or _mcLatestCommand
OK
No*
OK
No*
_mcFeedback
OK
OK
OK
OK
* A Position Type Selection Out of Range error (error code 5430 hex) occurs when the instruction is executed.
NY-series Motion Control Instructions Reference Manual (W561)
3-249
3
Function
Precautions for Correct Use
MC_GearInPos
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
3 Axis Command Instructions
Timing Charts
• Electronic gear operation starts when Execute changes to TRUE.
• Busy (Executing) changes to TRUE when Execute changes to TRUE. After the operation is started,
Active (Controlling) and StartSync (Following) change to TRUE and the Slave (Slave Axis) starts the
gear operation.
• When the MasterSyncPosition (Master Sync Position) and SlaveSyncPosition (Slave Sync Position)
are reached, InSync changes to TRUE.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing), Active (Controlling), StartSync (Following), and InSync change to FALSE.
Execute
StartSync
InSync
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Velocity
InSyncPhase
CatchingPhase
Time
The operation when this instruction is aborted by another instruction is shown below.
3-250
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Execute
StartSync
InSync
Busy
Active
MC_GearInPos
CommandAborted
Error
ErrorID
Velocity
16#0000
InSyncPhase
Multi-execution of
another instruction
3
Function
CatchingPhase
Time
Depending on setting of the SlaveSyncPosition, the axis may not reach the target velocity. An example of this is shown below.
Execute
StartSync
InSync
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Velocity
InSyncPhase
CatchingPhase
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-251
3 Axis Command Instructions
The slave axis follows the master axis position before the InSync phase as well. An example of this
is shown below.
Execute
StartSync
InSync
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Velocity
Master axis
InSyncPhase
Slave axis
CatchingPhase
Time
You can specify the Acceleration (Acceleration Rate) and Deceleration (Deceleration Rate) as input
variables. The following figures show operation examples of the electronic gear.
Velocity
Velocity
Acceleration
Catching phase
InSync phase
Deceleration
InSync phase
Catching phase
Time
Time
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
3-252
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Multi-execution of Motion Instructions
The axis command status of the master axis, including whether it is stopped due to an error or it is
decelerating to a stop, does not affect the execution of this instruction.
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Specify the operation of this instruction by using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Aborting
Description
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion
will be reversed according to the Operation Selection at Reversing axis parameter.
Precautions for Correct Use
If another instruction is executed with BufferMode set to anything other than Aborting, an error
will occur in the other instruction.
Errors
If an error occurs during instruction execution, Error will change to TRUE. You can find out the cause of
the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
StartSync
InSync
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
The slave axis is not affected by the error status of the master axis during synchronized control.
After the error status of the master axis is cleared, the slave axis continues electronic gear operation
when the master axis operates.
The master axis is not affected if an error occurs for the slave axis during startup or execution of this
instruction.
NY-series Motion Control Instructions Reference Manual (W561)
3-253
3
Function
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
MC_GearInPos
z Execution of Other Instructions during Instruction Execution
3 Axis Command Instructions
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
Sample Programming
This section describes sample programming where the sync position for the master axis is Pos1 and
the sync position for the slave axis Pos2.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Types
Axis
Axis Types
Axis 1
Servo axis (master axis)
Axis 2
Servo axis (slave axis)
Count Modes
Axis
Count Mode
Axis 1
Rotary Mode
Axis 2
Rotary Mode
Ring Counters
Axis
Modulo maximum position
Modulo minimum position
Axis 1
360
0
Axis 2
360
0
Units of Display
Axis
Unit of Display
Axis 1
degree
Axis 2
degree
Operation Example
Axis 1
1:2
Axis 2
3-254
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Operation Pattern
Axis 1 position
Pos1
Time
MC_GearInPos
Vel_InVel
Axis 2 position
Pos2
3
Sample Programming
Time
1
Starting the Master Axis
The master axis (axis 1) is an actual servo axis and it is operated with velocity control.
2
Reaching Target Velocity for Master Axis
When the command velocity of the master axis reaches the target velocity, InVelocity (Target
Velocity Reached) of the master axis changes to TRUE.
3
Executing the Slave Axes
When InVelocity of the master axis changes to TRUE, slave axis (axis 2) performs gear operation with a gear ratio of 1:2 against the actual position of the master axis. The synchronized
positions are Pos1 for the master axis and Pos2 for the slave axis.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.Details.Homed
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
BOOL
Default
--FALSE
FALSE
MC_Axis001
MC_Axis001.Details.Homed
MC_Axis001.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
Pwr1_Status
BOOL
FALSE
Pwr2_Status
BOOL
FALSE
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for the master axis, axis 1.
TRUE when home is defined for axis 1.
TRUE while there is a minor fault level error for
axis 1.
Axis Variable for the slave axis, axis 2.
TRUE when home is defined for axis 2.
TRUE while there is a minor fault level error for
axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
3-255
3 Axis Command Instructions
Hm1_D
Name
Data type
BOOL
Default
FALSE
Hm2_D
BOOL
FALSE
Vel_InVel
BOOL
FALSE
Pos1
Pos2
StartPg
LREAL
LREAL
BOOL
----FALSE
Comment
This variable is assigned to the Done output variable from the HM1 instance of the MC_Home
instruction.
This variable is assigned to the Done output variable from the HM2 instance of the MC_Home
instruction.
This variable is assigned to the InVelocity output
variable from the VEL instance of the
MC_MoveVelocity instruction. It is TRUE when
the target velocity is reached.
This variable gives the master sync position.
This variable gives the slave sync position.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
z Timing Chart
Pwr1_Status
Pwr2_Status
Hm1_D
Hm1_Bsy
Hm2_D
Hm2_Bsy
Vel_InVel
Vel_Bsy
Vel_Act
Gearinpos_StSync
Gearinpos_InSync
Gearinpos_Bsy
Gearinpos_Act
Axis 1
Command position
Actual position
Command velocity
Actual velocity
Axis 2
Command position
Command velocity
3-256
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data
communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
PWR1
MC_Power
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
3
MC_Axis001
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
If the Servo is ON for the master axis (axis 1) and home is not defined, the Home instruction is executed to define home.
HM1
MC_Home
Pwr1_Status
MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
If the Servo is ON for the slave axis (axis 2) and home is not defined, the Home instruction is executed to define home.
HM2
MC_Home
Pwr2_Status
MC_Axis001.Details.Homed
MC_Axis001
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
3-257
Sample Programming
PWR2
MC_Power
Lock2
MC_GearInPos
If process data communications are active, the Servo is turned ON for the axes.
3 Axis Command Instructions
The MC_MoveVelocity (Velocity Control) instruction is executed after homing is completed for the master axis (axis 1).
VEL
MC_Axis000
Hm1_D
LREAL#90.0
LREAL#90.0
LREAL#90.0
LREAL#0.0
_eMC_DIRECTION#_mcPositiveDirection
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_ErrID
After homing is completed for axis 2 (slave axis), MC_GearInPos (Positioning Gear Operation) is executed to start
gear operation if Vel_InVel of MC_MoveVelocity is TRUE.
GEARINPOS
MC_GearInPos
MC_Axis001.Details.Homed
Vel_InVel
MC_Axis000
MC_Axis001
UINT#1
UINT#2
_eMC_REFERENCE_TYPE#_mcFeedback
Pos1
Pos2
LREAL#180.0
LREAL#180.0
LREAL#180.0
Master
Master
Slave
Slave
Execute
StartSync
RatioNumerator
InSync
RatioDenominator
Busy
Active
ReferenceType
MasterSyncPosition CommandAborted
SlaveSyncPosition
Error
ErrorID
Velocity
Acceleration
Deceleration
Jerk
BufferMode
Gearinpos_StSync
Gearinpos_InSync
Gearinpos_Bsy
Gearinpos_Act
Gearinpos_Ca
Gearinpos_Err
Gearinpos_ErrID
Structured Text (ST)
z Main Variables
Name
3-258
MC_Axis000
MC_Axis000.Details.Homed
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
BOOL
Default
--FALSE
FALSE
MC_Axis001
MC_Axis001.Details.Homed
MC_Axis001.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
Pwr1_Status
BOOL
FALSE
Pwr2_Status
BOOL
FALSE
Hm1_D
BOOL
FALSE
Hm2_D
BOOL
FALSE
Comment
Axis Variable for the master axis, axis 1.
TRUE when home is defined for axis 1.
TRUE while there is a minor fault level error for
axis 1.
Axis Variable for the slave axis, axis 2.
TRUE when home is defined for axis 2.
TRUE while there is a minor fault level error for
axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Done output variable from the HM1 instance of the MC_Home
instruction.
This variable is assigned to the Done output variable from the HM2 instance of the MC_Home
instruction.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Default
FALSE
Pos1
Pos2
StartPg
LREAL
LREAL
BOOL
----FALSE
Gearinpos_Ex
BOOL
FALSE
Vel_Ex
BOOL
FALSE
InitFlag
BOOL
FALSE
Comment
This variable is assigned to the InVelocity output
variable from the VEL instance of the
MC_MoveVelocity instruction. It is TRUE when
the target velocity is reached.
This variable gives the master sync position.
This variable gives the slave sync position.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
The GEARIN1 instance of MC_GearInPos is executed when this variable changes to TRUE.
The VEL instance of MC_MoveVelocity is executed when this variable changes to TRUE.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes
to TRUE.
MC_GearInPos
Data type
BOOL
Vel_InVel
3
Sample Programming
NY-series Motion Control Instructions Reference Manual (W561)
3-259
3 Axis Command Instructions
z Timing Chart
Pwr1_Status
Pwr2_Status
Hm1_Ex
Hm1_D
Hm1_Bsy
Hm2_Ex
Hm2_D
Hm2_Bsy
Vel_Ex
Vel_InVel
Vel_Bsy
Vel_Act
Gearinpos_Ex
Gearinpos_StSync
Gearinpos_InSync
Gearinpos_Bsy
Gearinpos_Act
Axis 1
Command position
Actual position
Command velocity
Actual velocity
Axis 2
Command position
Command velocity
z Sample Programming
// Processing when input parameters are not set
IF InitFlag = FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel := LREAL#90.0;
Vel_Acc := LREAL#90.0;
Vel_Dec := LREAL#90.0;
Vel_Dir := _eMC_DIRECTION#_mcPositiveDirection;
// MC_GearInPos parameters
Pos1
:= LREAL#300.0;
Pos2
:= LREAL#200.0;
Gearinpos_Rn
:= UINT#1;
3-260
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Gearinpos_Rd
Gearinpos_Rt
Gearinpos_Mtpos
Gearinpos_Svpos
Gearinpos_Vel
Gearinpos_Acc
Gearinpos_Dec
:= UINT#2;
:= _eMC_REFERENCE_TYPE#_mcFeedback;
:= Pos1;
:= Pos2;
:= LREAL#180.0;
:= LREAL#180.0;
:= LREAL#180.0;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
MC_GearInPos
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
3
Sample Programming
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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 for axis 1 or axis 2, 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) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed.
IF (Pwr1_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed.
IF (Pwr2_Status=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// After homing is completed for axis 1, MC_MoveVelocity is executed.
IF Hm1_D=TRUE THEN
Vel_Ex := TRUE;
END_IF;
// After homing is completed for axis 2, MC_GearInPos is executed when Vel_InVel of MC_MoveVelocity is
TRUE.
IF (MC_Axis001.Details.Homed=TRUE) AND (Vel_InVel=TRUE) THEN
Gearinpos_Ex := TRUE;
END_IF;
// MC_Power for axis 1
PWR1(
NY-series Motion Control Instructions Reference Manual (W561)
3-261
3 Axis Command Instructions
Axis
Enable
Status
Busy
Error
ErrorID
:= MC_Axis000,
:= Pwr1_En,
=> Pwr1_Status,
=> Pwr1_Bsy,
=> Pwr1_Err,
=> Pwr1_ErrID
);
// MC_Power for axis 2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_Status,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
// MC_Home for axis 1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home for axis 2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Direction
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
//MC_GearInPos
GEARINPOS(
Master
Slave
Execute
RatioNumerator
RatioDenominator
ReferenceType
MasterSyncPosition
SlaveSyncPosition
Velocity
3-262
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Dir,
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
:= MC_Axis000,
:= MC_Axis001,
:= Gearinpos_Ex,
:= Gearinpos_Rn,
:= Gearinpos_Rd,
:= Gearinpos_Rt,
:= Gearinpos_Mtpos,
:= Gearinpos_Svpos,
:= Gearinpos_Vel,
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Acceleration
Deceleration
StartSync
InSync
Busy
Active
CommandAborted
Error
ErrorID
:= Gearinpos_Acc,
:= Gearinpos_Dec,
=> Gearinpos_StSync,
=> Gearinpos_InSync,
=> Gearinpos_Bsy,
=> Gearinpos_Act,
=> Gearinpos_Ca,
=> Gearinpos_Err,
=> Gearinpos_ErrID
);
MC_GearInPos
3
Sample Programming
NY-series Motion Control Instructions Reference Manual (W561)
3-263
3 Axis Command Instructions
MC_GearOut
The MC_GearOut instruction stops operation for the MC_GearIn (Start Gear Operation) instruction or
MC_GearInPos (Positioning Gear Operation) instruction.
Instruction
Name
MC_GearOut
End Gear
Operation
FB/FUN
Graphic expression
FB
ST expression
MC_GearOut_instance
MC_GearOut
Slave
Execute
Deceleration
Jerk
OutMode
Slave
Done
Busy
CommandAborted
Error
ErrorID
MC_GearOut_instance (
Slave :=parameter,
Execute :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
OutMode :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate. The
unit is command units/s2.*1
Jerk (Reserved) Jerk
LREAL
0
0
(Reserved)
OutMode
(Reserved)
_eMC_OUT_
MODE
0: _mcStop
0*2
(Reserved)
Sync End
Mode Selection
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-264
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the instruction is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
3
Variables
Error
In-Out Variables
Name
Slave
Meaning
Slave Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the slave axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
NY-series Motion Control Instructions Reference Manual (W561)
MC_GearOut
Done
3-265
3 Axis Command Instructions
Function
• The MC_GearOut instruction stops the operation of the MC_GearIn (Start Gear Operation) or
MC_GearInPos (Positioning Gear Operation) instruction for the operation axis specified with Slave
and at the specified Deceleration (Deceleration Rate).
• This instruction does not affect the MC_GearIn (Start Gear Operation) or MC_GearInPos (Positioning
Gear Operation) operation of the master axis.
Timing Charts
• Busy (Executing) changes to TRUE when Execute changes to TRUE.
• Done changes to TRUE when the target velocity is reached.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing) changes to FALSE.
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Velocity
Master axis velocity
Time
z When This Instruction Is Aborted by Another Instruction
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Velocity
Master axis velocity
Multi-execution of
another instruction
Time
3-266
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z When The Instruction Is Executed with a Deceleration Rate of 0
If deceleration rate is set to 0 and the instruction is executed, the axis will stop without decelerating.
The following chart shows an operation example of when the deceleration rate is 0.
Velocity
MC_GearOut executed.
MC_GearOut
Time
Re-execution of Motion Instructions
3
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
If you execute this instruction while MC_GearIn (Start Gear Operation) or MC_GearInPos (Positioning Gear Operation) instruction is in execution, CommandAborted for MC_GearIn or MC_GearInPos
will change to TRUE and Busy (Executing) of this instruction will change to TRUE. If you execute
this instruction while instructions other than MC_GearIn or MC_GearInPos are in execution, this
instruction will result in an error.
z Execution of Other Instructions during Instruction Execution
To use multi-execution of motion instruction for this instruction, specify the slave axis.
If you execute another instruction during execution of this instruction, you can specify either aborting
or buffering.
NY-series Motion Control Instructions Reference Manual (W561)
3-267
Function
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE. You can find out the cause of
the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
Error code
Velocity
Master axis velocity
Time
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-268
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_MoveLink
Positioning is performed in sync with the specified master axis.
Instruction
MC_MoveLink
Name
Graphic expression
FB
MC_MoveLink_instance
MC_MoveLink_instance (
Master :=parameter,
Slave :=parameter,
TriggerInput :=parameter,
TriggerVariable :=parameter,
Execute :=parameter,
ReferenceType :=parameter,
SlaveDistance :=parameter,
MasterDistance :=parameter,
MasterDistanceInACC :=parameter,
MasterDistanceInDEC :=parameter,
LinkOption :=parameter,
MasterStartDistance :=parameter,
BufferMode :=parameter,
Done =>parameter,
InSync =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Reference
Type*1
Position
Type Selection
_eMC_
REFERENCE
_TYPE
0: _mcCommand
1: _mcFeedback
2: _mcLatestCommand
0*2
Specify the position type.
0: Command position
(value calculated in the
previous task period*3)
1: Actual position (value
obtained in the same
task period*3)
2: Command position
(value calculated in the
same task period*3)
SlaveDistance
Slave Axis
Travel Distance
LREAL
Negative number, positive
number, or 0
NY-series Motion Control Instructions Reference Manual (W561)
0
Specify the travel distance
of the slave axis. The unit is
command units.*4
3-269
3
Variables
MC_MoveLink
Master
Master
Slave
Slave
TriggerInput
TriggerInput
TriggerVariable
TriggerVariable
Done
Execute
InSync
ReferenceType
SlaveDistance
Busy
MasterDistance
Active
MasterDistanceInACC CommandAborted
Error
MasterDistanceInDEC
ErrorID
LinkOption
MasterStartDistance
BufferMode
ST expression
MC_MoveLink
Synchronous Positioning
FB/
FUN
3 Axis Command Instructions
Name
Meaning
Data type
MasterDistance
Master Axis
Travel Distance
LREAL
Non-negative number
0
Specify the travel distance
of the master axis as an
unsigned absolute value.
The value is valid for both
positive and negative travel
of the master axis. The unit
is command units.*4
Master
DistanceInACC
Master Distance in
Acceleration
LREAL
Non-negative number
0
Specify the travel distance
of the master axis while the
slave axis is accelerating.
Specify the unsigned absolute value. The value is
valid for both positive and
negative travel of the master axis. The unit is command units.*3
Master
DistanceInDEC
Master Dis- LREAL
tance in
Deceleration
Non-negative number
0
Specify the travel distance
of the master axis while the
slave axis is decelerating.
Specify the unsigned absolute value. The value is
valid for both positive and
negative travel of the master axis. The unit is command units.*3
LinkOption
Synchronization Start
Condition
0: _mcCommandEexecution
1: _mcTriggerDetection
2: _mcMasterReach
0*2
Specify the condition for the
slave axis to synchronize
with the master axis.
_eMC_
LINKOPTION
Valid range
Default
Description
0: When instruction execution starts
1: When trigger is detected
2: When the master axis
reaches the master following distance.
MasterStart
Distance
Master Following Distance
LREAL
Negative number, positive
number, or 0
0
Specify the absolute position of the master axis
when the slave axis starts
following the master axis.
The unit is command
units.*3
BufferMode
Buffer Mode
Selection
_eMC_
BUFFER_ MODE
0: _mcAborting
1: _mcBuffered
0*2
Specify the behavior when
executing more than one
motion instruction.
0: Aborting
1: Buffered
*1 To use _mcLatestCommand, the following condition must be met for the master and slave axes.
When you use _mcLatestCommand, the axis number set for the Master (Master Axis) in the system-defined variable for
motion control must be lower than the axis number set for the Slave (Slave Axis) in the system-defined variable for motion
control.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
*3 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
*4 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
3-270
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
InSync
In Sync
BOOL
TRUE or FALSE
TRUE when synchronization is started.
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
MC_MoveLink
Busy
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3
z Output Variable Update Timing
Timing for changing to TRUE
Timing for changing to FALSE
Done
When the instruction is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is
FALSE.
InSync
When synchronization conditions are met.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Active
When an instruction is received.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
• When Execute is TRUE and changes to
motion control instruction was executed with the BufFALSE.
fer Mode set to Aborting.
• After one period when Execute is
• When this instruction is canceled due to an error.
FALSE.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
NY-series Motion Control Instructions Reference Manual (W561)
When the error is cleared.
3-271
Variables
Name
3 Axis Command Instructions
In-Out Variables
Name
Meaning
Data type
Valid range
Description
Master
Master Axis
_sAXIS_REF
---
Specify the master axis.*1
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*1
TriggerInput
Trigger Input
Condition
_sTRIGGER_REF
---
Set the trigger condition.*2
TriggerVariable
Trigger Variable
BOOL
TRUE or
FALSE
Specify the input variable to function as the trigger
to specify the controller mode with a trigger condition.
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Define a user-defined variable with a data type of _sTRIGGER_REF..
z _sTRIGGER_REF
Name
Meaning
Data type
Valid range
Function
Mode
Mode
_eMC_Trigger_
Mode
0: _mcDrive
1: _mcController
Specify the trigger mode.
0: Drive Mode
1: Controller Mode
LatchID
Latch ID
Selection
_eMC_Trigger_
Latch_ID
0: _mcLatch1
1: _mcLatch2
Specify which of the two latch functions to use
in Drive Mode.
0: Latch 1
1: Latch 2
InputDrive
Trigger
Input Signal
_eMC_Trigger_
Input _Drive
0: _mcEncoderMark
1: _mcEXT
Specify the Servo Drive trigger signal to use in
Drive Mode.
0: Z-phase signal
1: External input
Function
• The MC_MoveLink instruction moves a slave axis in synchronization with a specified master axis.
• A type of electronic cam operation is performed, but synchronous positioning is performed between
the slave axis and the master axis.
• Use MC_Stop to stop the axis during motion for this instruction.
Precautions for Correct Use
Do not execute the MC_SetPosition instruction for the Master (Master Axis) if you use this
instruction on a CPU Unit with unit version 1.09 or earlier. If the MC_SetPosition instruction is
executed for the Master (Master Axis), the Slave (Slave Axis) may follow the Master (Master
Axis) quickly.
If you want to use the MC_SetPosition instruction for the Master (Master Axis), disable the relationship between the Master (Master Axis) and Slave (Slave Axis) executing the instruction.
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
z Mapping Data Objects
You must map the following object data when LinkOption (Synchronization Start Condition) is set to
_mcTriggerDetection and the MC_MoveLink (Synchronous Positioning) instruction executed with
Mode set to Drive Mode. Mapping is performed in the Detailed Setting Area of the Axis Basic Settings Display of the Sysmac Studio.
3-272
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• Touch probe function (60B8 hex)
• Touch probe status (60B9 hex)
• Touch probe pos1 pos value (60BA hex)
• Touch probe pos2 pos value (60BC hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
MC_MoveLink
For details on mapping data objects, refer to 2-3 PDO Mapping and to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
Refer to I/O Entry Mappings in the NX-series Position Interface Units User’s Manual (Cat. No.
W524) for information on using the NX-series Position Interface Units.
Instruction Details
3
This section describes the instruction in detail.
Function
z Master (Master Axis)
Specify the master axis with Master.
z Slave (Slave Axis)
Specify the slave axis with Slave.
z TriggerInput (Trigger Input Condition) and TriggerVariable
These variables specify the input signal on which to start synchronization when the sync start condition is set to _mcTriggerDectection. For the input signal selection and information on the timing when
a trigger is generated, refer to MC_TouchProbe on page 3-336. If the Drive Mode is specified for
Mode in TriggerInput (Trigger Input Condition), a drive input from the slave axis is used. If the Controller Mode is specified, TriggerVariable is used as the trigger signal.
z ReferenceType (Position Type Selection)
You can select one of the following position types.
• _mcCommand: Command position (value calculated in the previous task period)
The master axis command position that was calculated in the previous task period is used for the
current period.
The command value that was calculated for the master axis in the last periodic task is used to calculate the command position of the slave axis in the current period.
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
• _mcLatestCommand: Command position (value calculated in the same task period)
The command position of the master axis that was calculated in the same task period is used.
This enables the use of information that is more recent than for _mcCommand. However, the axis
number of the master axis must be set lower than the axis number of the slave axis.
If the axis number of the slave axis is lower than the axis number of the master axis, Error will
change to TRUE. A Master/Slave Axis Numbers Not in Ascending Order error (error code: 5438
hex) will be output to ErrorID.
Precautions for Correct Use
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
NY-series Motion Control Instructions Reference Manual (W561)
3-273
3 Axis Command Instructions
Additional Information
The command position that is calculated in the same task period enables greater precision in
synchronization than the command position that was calculated in the previous task period.
However, the axis number set for the Master (Master Axis) in the system-defined variable for
motion control must be lower than the axis number set for the Slave (Slave Axis) in the systemdefined variable for motion control.
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
ReferenceType
_mcCommand or _mcLatestCommand
OK
Axis Type
Servo axis
Encoder axis
No*
OK
Virtual servo axis
Virtual encoder axis
_mcFeedback
OK
OK
OK
OK
No*
* A Position Type Selection Out of Range error (error code: 5430 hex) occurs when the instruction is executed.
z SlaveDistance (Slave Axis Travel Distance), MasterDistance (Master Axis
Travel Distance), MasterDistanceInACC (Master Distance in Acceleration),
and MasterDistanceInDEC (Master Distance in Deceleration)
The velocity and position of the slave axis are determined by the ratio of the travel distances of the
master axis and the slave axis as shown in the following figure. The master following distance
shown in the following figure represents the position where the sync start condition was met.
Master Axis Travel in Positive Direction
Master axis position
MasterDistanceInDEC
MasterDistance
Master
following
distance
MasterDistanceInACC
Slave axis position
Time
SlaveDistance
Time
Slave axis velocity
Time
3-274
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Master Axis Travel in Negative Direction
Master axis position
Master
following
distance
MasterDistanceInACC
MasterDistance
MasterDistanceInDEC
MC_MoveLink
Time
Slave axis position
3
SlaveDistance
Function
Time
Slave axis velocity
Time
The relationship between the travel distance of the master axis and the travel distance of the slave
axis is shown in the following table.
Section
Relationship between the master axis and slave axis travel distances
Acceleration
Master axis
Master Distance in Acceleration
Slave axis
Master distance in acceleration
Slave axis
2
×
travel
Master distance
Master
axis
travel
distance
− Master distance in
Master distance
distance
in acceleration + acceleration − Master distance in deceleration + in deceleration
2
2
Constant
velocity
Master axis
Master axis travel distance − Master distance in acceleration − Master distance in
deceleration
Slave axis
Slave axis travel distance − Slave axis travel distance at the acceleration rate above
− Slave axis travel distance at the deceleration rate below
Master axis
Master Distance in Deceleration
Deceleration
Slave axis
Slave axis
×
travel
distance
Master distance in deceleration
2
Master distance Master axis travel distance − Master distance in
Master distance
in acceleration + acceleration − Master distance in deceleration + in deceleration
2
2
When the constant velocity section of the master axis is negative, a constant velocity travel distance
error occurs and the axis stops. If you want to feed the slave axis at the same velocity as the master
axis, set the following value as the travel distance of the slave axis.
Slave axis
=
travel distance
Master distance
in acceleration +
2
Master axis travel distance − Master distance in
acceleration − Master distance in deceleration
+
Master distance
in deceleration
2
Precautions for Correct Use
If the counter mode for the master axis is Rotary Mode, specify a value that is within one ring
counter cycle for MasterDistance (Master Axis Travel Distance).
NY-series Motion Control Instructions Reference Manual (W561)
3-275
3 Axis Command Instructions
z LinkOption (Synchronization Start Condition)
Specify the condition for the slave axis to synchronize with the master axis.
• Start of Instruction
When this instruction is executed, the slave axis performs positioning in synchronization with the
master axis from the next period.
• When Trigger Is Detected
When the input signal specified as the input trigger occurs, the slave axis synchronizes with the
master axis and performs positioning from the next period.
• When the Master Axis Reaches the Master Following Distance
When the master axis reaches the master following distance during instruction execution, the
slave axis starts synchronization and performs positioning from the next period.
Even if the instruction is executed while the master axis is stopped at the master following distance, the slave axis starts synchronization and performs positioning from the next period.
Precautions for Correct Use
You must map object data when LinkOption (Synchronization Start Condition) is set to_mcTriggerDetection and Mode is set to Drive Mode. Set the following objects.
• Touch probe function (60B8 hex)
• Touch probe status (60B9 hex)
• Touch probe pos1 pos value (60BA hex)
• Touch probe pos2 pos value (60BC hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs. For details on mapping object data, refer to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box
PC Motion Control User’s Manual (Cat. No. W559).
z MasterStartDistance
MasterStartDistance specifies the absolute position where the slave axis starts synchronization with
the master axis.
CPU Units with Unit Version 1.10 or Later
When the Count Mode of the master axis is Rotary Mode, you can specify a MasterStartDistance
(Master Following Distance) outside the range specified by the modulo maximum position and modulo minimum position setting values. If you do, the relationship between the master axis current
position and the master axis following distance will be the same as when no direction is specified for
Direction in the MC_MoveAbsolute (Absolute Positioning) instruction. Refer to MC_MoveAbsolute
on page 3-49 for information on the MC_MoveAbsolute (Absolute Positioning) instruction.
CPU Units with Unit Version 1.09 or Earlier
If the Count Mode for the master axis is Rotary Mode, specify a value that is within the range specified by the modulo maximum position and modulo minimum position setting values for MasterStartDistance (Master Following Distance). If the value is not within the limits, an Cam Master Axis
Following First Position Setting Out of Range error (error code 547B hex) is output when the instruction is executed.
3-276
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z BufferMode (Buffer Mode Selection)
BufferMode specifies how to join the axis motions for this instruction and the previous instruction.
There is currently only the following two settings.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
Buffered
Automatically executes the buffered instruction after the current instruction is
completed.
z In-position Check
An in-position check is performed when the slave axis ends operation.
An in-position check is performed for this instruction according to the settings in In-position Range
and In-position Check Time axis parameters.
3
Function
Timing Charts
z Executing MC_MoveLink
LinkOption Set to _mcCommandExecution
Execute
Busy
Active
InSync
Done
Master/slave axis position
Master axis
Slave axis
Time
Slave axis
velocity
Time
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveLink
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
3-277
3 Axis Command Instructions
LinkOption Set to _mcTriggerDetection
Execute
TriggerInput
Done
InSync
Busy
Active
Master/slave axis position
Master axis
Slave axis
Slave axis
velocity
Time
Time
3-278
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Sync Start Condition Setting = When the Master Axis Reaches the Master
Following Distance
Execute
Done
InSync
Busy
MC_MoveLink
Active
Master/slave axis position
Master axis
Master
following
distance
3
Slave
axis
velocity
Function
Slave axis
Time
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-279
3 Axis Command Instructions
z When an Instruction Is Executed with BufferMode Set to Aborting during
Previous Operation
This section describes when this instruction is executed with LinkOption set to _mcCommandExecution when the previous operation, MC_MoveAbsolute (Absolute Positioning), is in execution.
Precautions for Correct Use
As shown in the following chart, the velocity of the slave axis becomes discontinuous when this
instruction is started.
Previous Instruction: MC_MoveAbsolute (Absolute Positioning)
Execute
Done
Busy
Active
CommandAborted
Current Instruction
Execute
Done
InSync
Busy
Active
CommandAborted
Slave axis velocity
The velocity changes
discontinuously when
MC_MoveLink is started.
Time
z When an Instruction Is Executed with BufferMode Set to Buffered during
Previous Operation
This instruction is executed after the previous instruction is finished.
3-280
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted, and the axis stops.
Execute
Done
MC_MoveLink
InSync
Busy
Active
3
CommandAborted
Error
16#0000
Function
ErrorID
Error code
Slave axis velocity
Time
Multi-execution of Motion Instructions
For details on multi-execution of instructions, refer to the NJ/NX-series CPU Unit Motion Control User’s
Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s
Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
If you execute another instruction during execution of this instruction, you can specify either aborting
or buffering.
You cannot specify blending.
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You can
find out the cause of the error by referring to the value output by ErrorID (Error Code). Refer to Re-execution of Motion Instructions on page 3-281 for the timing chart after an error occurs.
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-281
3 Axis Command Instructions
Sample Programming
This sample programming shows the control of a cutter.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Types
Axis
Axis Type
Axis 1
Servo axis (master axis)
Axis 2
Servo axis (slave axis)
Count Modes
Axis
Count Mode
Axis 1
Rotary Mode
Axis 2
Linear Mode
Ring Counter
Axis
Axis 1
Modulo maximum position
360
Modulo minimum position
0
Units of Display
Axis
Unit of Display
Axis 1
degree
Axis 2
mm
Operation Example
Axis 2
Servo axis
Pneumatic actuator
Axis 1
Servo axis
3-282
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Operation Patterns
Axis 1 position
M_DEC
M_Dist
MC_MoveLink
M_ACC
M_StartPos
Time
3
Axis 2 position
Sample Programming
Synchronization
started.
S_Dist
Time
1
Starting the Master Axis
Axis 1 for the belt conveyer is treated as master axis to feed back the position.
2
Executing the Slave Axis
Axis 2 for the ball screw that moves in the horizontal direction moves in synchronization with
axis 1.
3
Cutting with the Cutter
The pneumatic actuator turns ON when axis 2 is synchronized. The cutter, which is connected
to the pneumatic actuator, descends in a vertical direction and cuts the workpiece.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
MC_Axis001
MC_Axis001.MFaultLvl.Active
BOOL
_sAXIS_REF
BOOL
FALSE
--FALSE
BOOL
BOOL
FALSE
FALSE
MC_Axis001.Details.Homed
Pwr1_Status
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for the master axis, axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
Axis Variable for the slave axis, axis 2.
TRUE while there is a minor fault level error for
axis 2.
TRUE when home is defined for axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
3-283
3 Axis Command Instructions
Name
Data type
BOOL
Default
FALSE
StartPg
BOOL
FALSE
Actuator
BOOL
FALSE
InitFlag
BOOL
FALSE
Pwr2_Status
Comment
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
TRUE when axis 1 and axis 2 are synchronized.
While Actuator is TRUE, the cutter moves down
vertically.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes
to TRUE.
z Timing Chart
MC_Axis001.DrvStatus.Latch1
Mv_Link_D
Mv_Link_InSync
Mv_Link_Bsy
Master axis Velocity
MC_Axis000.Cmd.Vel
Slave axis
Velocity
Time
MC_Axis001.Cmd.Vel
Time
3-284
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
PWR1
MC_Power
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
3
MC_Power
MC_Axis001
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed to define home.
HM1
MC_Home
Pwr1_Status
MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed to define home.
HM2
MC_Home
Pwr2_Status
MC_Axis001.Details.Homed
MC_Axis001
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
3-285
Sample Programming
PWR2
Lock2
MC_MoveLink
If process data communications are active, the Servo is turned ON for the axes.
3 Axis Command Instructions
The parameters are set for the MC_MoveVelocity (Velocity Control) and MC_MoveLink (Synchronous Positioning) instructions.
InitFlag
Note: The contents of the inline ST are
given below.
The MC_MoveVelocity (Velocity Control) instruction is executed if home is defined for axis 1.
VEL
MC_Axis000
MC_Axis000.Details.Homed
Vel_Vel
Vel_Acc
Vel_Dec
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_EIrrD
The MC_MoveLink (Synchronous Positioning) instruction is executed if home is defined for axis 2 (slave axis).
MV_LINK
MC_MoveLink
MC_Axis000
MC_Axis001
Mv_Link_TrigRef
MC_Axis001.Details.Homed Vel_InVel Mv_Link_TrigVar
Mv_Link_SlvDis
Mv_Link_MasDis
Mv_Link_MasDisInAcc
Mv_Link_MasDisInDec
Mv_Link_LnkOpt
Master
Master
Slave
Slave
TriggerInput
TriggerInput
TriggerVariable
TriggerVariable
Done
Execute
ReferenceType
InSync
SlaveDistance
Busy
MasterDistance
Active
MasterDistanceInACC CommandAborted
MasterDistanceInDEC
Error
ErrorID
LinkOption
MasterStartDistance
BufferMode
Mv_Link_D
Mv_Link_InSync
Mv_Link_Bsy
Mv_Link_Act
Mv_Link_Ca
Mv_Link_Err
Mv_Link_ErrID
Actuator is TRUE while the axes are synchronized.
Actuator
Mv_Link_InSync
Contents of Inline ST
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#0.0;
Vel_Dec := LREAL#0.0;
// MC_MoveLink parameters
Mv_Link_TrigRef.Mode
Mv_Link_TrigRef.LatchID
Mv_Link_TrigRef.InputDrive
Mv_Link_TrigVar
Mv_Link_SlvDis
Mv_Link_MasDis
Mv_Link_MasDisInAcc
Mv_Link_MasDisInDec
3-286
:= _eMC_TRIGGER_MODE#_mcDrive;
:= _eMC_TRIGGER_LATCH_ID#_mcLatch1;
:= _eMC_TRIGGER_INPUT_DRIVE#_mcEXT;
:= FALSE;
:= LREAL#1000.0;
:= LREAL#1000.0;
:= LREAL#100.0;
:= LREAL#100.0;
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Mv_Link_LnkOpt
:= _eMC_LINKOPTION#_mcTriggerDetection;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
Structured Text (ST)
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
MC_Axis001
MC_Axis001.MFaultLvl.Active
BOOL
_sAXIS_REF
BOOL
FALSE
--FALSE
MC_Axis001.Details.Homed
Pwr1_Status
BOOL
BOOL
FALSE
FALSE
Pwr2_Status
BOOL
FALSE
StartPg
BOOL
FALSE
Actuator
BOOL
FALSE
InitFlag
BOOL
FALSE
NY-series Motion Control Instructions Reference Manual (W561)
Comment
Axis Variable for the master axis, axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
Axis Variable for the slave axis, axis 2.
TRUE while there is a minor fault level error for
axis 2.
TRUE when home is defined for axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
TRUE when axis 1 and axis 2 are synchronized.
While Actuator is TRUE, the cutter moves down
vertically.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes
to TRUE.
3-287
3
Sample Programming
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
MC_MoveLink
z Main Variables
3 Axis Command Instructions
z Timing Chart
MC_Axis001.DrvStatus.Latch1
Mv_Link_Ex
Mv_Link_D
Mv_Link_InSync
Mv_Link_Bsy
Master axis Velocity
MC_Axis000.Cmd.Vel
Slave axis Velocity
Time
MC_Axis001.Cmd.Vel
Time
3-288
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#0.0;
Vel_Dec := LREAL#0.0;
:= _eMC_TRIGGER_MODE#_mcDrive;
:= _eMC_TRIGGER_LATCH_ID#_mcLatch1;
:= _eMC_TRIGGER_INPUT_DRIVE#_mcEXT;
:= FALSE;
:= LREAL#1000.0;
:= LREAL#1000.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_LINKOPTION#_mcTriggerDetection;
MC_MoveLink
// MC_MoveLink parameters
Mv_Link_TrigRef.Mode
Mv_Link_TrigRef.LatchID
Mv_Link_TrigRef.InputDrive
Mv_Link_TrigVar
Mv_Link_SlvDis
Mv_Link_MasDis
Mv_Link_MasDisInAcc
Mv_Link_MasDisInDec
Mv_Link_LnkOpt
3
Sample Programming
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo for axis 1.
ELSE
Pwr1_En:=FALSE;
// Turn OFF the Servo for axis 1.
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo for axis 2.
ELSE
Pwr2_En:=FALSE;
// Turn OFF the Servo for axis 2.
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF (MC_Axis000.MFaultLvl.Active=TRUE) OR (MC_Axis001.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed.
IF (Pwr1_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed.
IF (Pwr2_Status=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// After home is defined for axis 1, MC_MoveVelocity is executed for axis 1.
IF MC_Axis000.Details.Homed=TRUE THEN
Vel_Ex:=TRUE;
NY-series Motion Control Instructions Reference Manual (W561)
3-289
3 Axis Command Instructions
END_IF;
// MC_MoveLink is executed for axis 2 if home is defined for axis 2 and the target velocity was reached for axis
1.
IF (MC_Axis001.Details.Homed=TRUE) AND (Vel_InVel=TRUE) THEN
Mv_Link_Ex:=TRUE;
END_IF;
// The actuator is turned ON if axis 1 and axis 2 are synchronized.
IF Mv_Link_InSync=TRUE THEN
Actuator:=TRUE;
ELSE
Actuator:=FALSE;
END_IF;
// MC_Power1
PWR1(
Axis
:= MC_Axis000,
Enable
:= Pwr1_En,
Status
=> Pwr1_Status,
Busy
=> Pwr1_Bsy,
Error
=> Pwr1_Err,
ErrorID
=> Pwr1_ErrID
);
// MC_Power2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_Status,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
// MC_Home1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_Home2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
3-290
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
);
:= MC_Axis000,
:= MC_Axis001,
:= Mv_Link_TrigRef,
:= Mv_Link_TrigVar,
:= Mv_Link_Ex,
:= Mv_Link_SlvDis,
:= Mv_Link_MasDis,
:= Mv_Link_MasDisInAcc,
:= Mv_Link_MasDisInDec,
:= Mv_Link_LnkOpt,
=> Mv_Link_D,
=> Mv_Link_InSync,
=> Mv_Link_Bsy,
=> Mv_Link_Act,
=> Mv_Link_Ca,
=> Mv_Link_Err,
=> Mv_Link_ErrID
3
Sample Programming
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveLink
// MC_MoveLink
MV_LINK(
Master
Slave
TriggerInput
TriggerVariable
Execute
SlaveDistance
MasterDistance
MasterDistanceInAcc
MasterDistanceInDec
LinkOption
Done
InSync
Busy
Active
CommandAborted
Error
ErrorID
);
3-291
3 Axis Command Instructions
MC_CombineAxes
The MC_CombineAxes instruction outputs the sum or difference of the command positions of two axes
as the command position.
Instruction
Name
MC_CombineAxes
Combine
Axes
FB/
FUN
FB
Graphic expression
ST expression
MC_CombineAxes_instance
MC_CombineAxes_instance (
Master :=parameter,
Auxiliary :=parameter,
Slave :=parameter,
Execute :=parameter,
CombineMode :=parameter,
RatioNumeratorMaster
:=parameter,
RatioDenominatorMaster
:=parameter,
RatioNumeratorAuxiliary
:=parameter,
RatioDenominatorAuxiliary
:=parameter,
ReferenceTypeMaster :=parameter,
ReferenceTypeAuxiliary
:=parameter,
BufferMode :=parameter,
InCombination =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_CombineAxes
Master
Master
Auxiliary
Auxiliary
Slave
Slave
InCombination
Execute
CombineMode
Busy
RatioNumeratorMaster
Active
RatioDenominatorMaster CommandAborted
Error
RatioNumeratorAuxiliary
ErrorID
RatioDenominatorAuxiliary
ReferenceTypeMaster
ReferenceTypeAuxiliary
BufferMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
CombineMode
Combine
Mode
_eMC
_COMBINE_
MODE
0: _mcAddAxes
0*1
Specify the combining method.
Master Axis
Gear Ratio
Numerator
DINT*2
Positive or negative number*2
10000
Reserved
Master Axis
Gear Ratio
Denominator
UDINT*3
Positive number
10000
Reserved
Ratio
Numerator
Master
0: Addition
1: _mcSubAxes
1: Subtraction
(Reserved)
Ratio
Denominator
Master
(Reserved)
3-292
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Ratio
Numerator
Auxiliary
Meaning
Data type
Valid range
Default
Description
Auxiliary Axis
Gear Ratio
Numerator
DINT*2
Positive or negative number*2
10000
Reserved
Auxiliary Axis
Gear Ratio
Denominator
UDINT*3
Positive number
10000
Reserved
1: _mcFeedback
2*1
Specify the position type of the
master axis.
(Reserved)
Ratio
Denominator
Auxiliary
Reference
TypeMaster
Master Axis
_eMC_
Position Type REFERENCE_
Selection
TYPE
2: _mcLatestCommand
1: Actual position (value
obtained in the same task
period*4)
2: Command position (value
calculated in the same task
period*4)
Auxiliary Axis _eMC_
Position Type REFERENCE_
Selection
TYPE
1: _mcFeedback
2*1
2: _mcLatestCommand
Specify the position type of the
auxiliary axis.
1: Actual position (value
obtained in the same task
period*4)
2: Command position (value
calculated in the same task
period*4)
BufferMode
Buffer Mode
Selection
_eMC
_BUFFER_
MODE
0: _mcAborting
0*1
Specify the behavior when executing more than one motion
instruction.
0: Aborting
*1 The default value for an enumeration variable is actually not the number, but the enumerator.
*2 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use this variable. For
any previous version combinations, the data type is UINT and the valid range is positive numbers.
*3 A CPU Unit with unit version 1.02 or later and Sysmac Studio version 1.03 or higher are required to use this variable. For
any previous version combinations, the data type is UINT.
*4 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
Output Variables
Name
Meaning
Data type
Valid range
Description
InCombination
Axes
Combined
BOOL
TRUE or
FALSE
TRUE when axes are combined.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-293
3
Variables
Reference
TypeAuxiliary
MC_CombineAxes
(Reserved)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
InCombination
When combining axes is started.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Busy
When Execute changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Active
When the instruction is started.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Meaning
Data type
Valid range
Description
Master
Master Axis
_sAXIS_REF
---
Specify the master axis.*
Auxiliary
Auxiliary Axis
_sAXIS_REF
---
Specify the auxiliary axis.*
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Precautions for Correct Use
One of the following minor faults will occur if the different axes are not used for the master, slave,
and auxiliary axes.
• Master and Slave Defined as Same Axis (error code 5436 hex)
• Master and Auxiliary Defined as Same Axis (error code 5437 hex)
• Auxiliary and Slave Defined as Same Axis (error code 548E hex)
3-294
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Function
• The MC_CombineAxes instruction starts combining axes when Execute changes to TRUE.
Precautions for Correct Use
MC_CombineAxes
Do not execute the MC_SetPosition instruction for the Master (Master Axis) if you use this
instruction on a CPU Unit with unit version 1.09 or earlier. If the MC_SetPosition instruction is
executed for the Master (Master Axis), the Slave (Slave Axis) may follow the Master (Master
Axis) quickly.
If you want to use the MC_SetPosition instruction for the Master (Master Axis), disable the relationship between the Master (Master Axis) and Slave (Slave Axis) executing the instruction.
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis. This precaution also applies to Auxiliary (Auxiliary Axis) in the same
way as for Master (Master Axis).
3
From the starting point, the relative value of the Auxiliary (Auxiliary Axis) position is added to or subtracted from the relative value of the Master (Master Axis) position and is output as a relative value for
the Slave (Slave Axis) command position.
z CombineMode Set to _mcAddAxes
Slave (Slave Axis) position = Master (Master Axis) position (relative position) + Auxiliary (Auxiliary
Axis) position (relative position)
Master
Velocity
Execute of
MC_CombineAxes
changes to TRUE
Slave
Time
Position: 200
Velocity
Position: 600
Execute of
MC_CombineAxes
changes to TRUE
+
Auxiliary
Velocity
Execute of
MC_CombineAxes changes
to TRUE
Time
Position: 0
Position: 500
Time
Position: 100
Position: 200
NY-series Motion Control Instructions Reference Manual (W561)
3-295
Function
Instruction Details
3 Axis Command Instructions
z CombineMode Set to _mcSubAxes
Slave (Slave Axis) position = Master (Master Axis) position (relative position) − Auxiliary (Auxiliary
Axis) position (relative position)
Master
Velocity
Execute of
MC_CombineAxes
changes to TRUE
Slave
Velocity
Time
Position: 600
Position: 200
Execute of
MC_CombineAxes
changes to TRUE
Auxiliary
Velocity
Execute of
MC_CombineAxes
changes to TRUE
Time
Position: 0
Position: 390
Time
Position: 100
Position: 110
• Adding or subtracting the position is performed as numerical operations without considering the
Unit of Display for the axis in the axis parameters.
• Execute the MC_Stop instruction to end this instruction.
Precautions for Correct Use
Depending on the values for the Master (Master Axis) and Auxiliary (Auxiliary Axis), the travel
distance, velocity, and acceleration of the Slave (Slave Axis) can change rapidly.
Use this setting with care.
z In-position Check
An in-position check is not performed for this instruction.
z Override Factors
You cannot perform an MC_SetOverride (Set Override Factors) override for this instruction.
z ReferenceType (Position Type Selection)
You can select one of the following position types.
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
• _mcLatestCommand: Command position (value calculated in the same task period)
The command position of the master axis that was calculated in the same task period is used.
However, if _mcLatestCommand is selected, the axis numbers of the master axis and auxiliary
axis must be set lower than the axis number of the slave axis. If the axis numbers of the slave axis
or auxiliary axis is lower than the axis number of the master axis, Error will change to TRUE. A
Master/Slave Axis Numbers Not in Ascending Order error (error code: 5438 hex) will be output to
ErrorID. There are no restrictions in the relationship of the axis numbers between the master axis
and the auxiliary axis.
3-296
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
z Relationship between Axis Types and Position Types
shown below.
Axis Type
Servo axis
Encoder axis
Virtual servo axis
Virtual encoder axis
ReferenceType
_mcFeedback
OK
OK
OK
OK
_mcLatestCommand
OK
No*
OK
3
No*
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• InCombination (Axes Combined) changes to TRUE in the period where the combined output starts.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing), Active (Controlling), and InCombination (Axes Combined) change to FALSE.
3-297
Function
* A Position Type Selection Out of Range error (error code: 5430 hex) occurs when the instruction is executed.
NY-series Motion Control Instructions Reference Manual (W561)
MC_CombineAxes
The relationship between the axis types that you can monitor and position types that is monitored is
3 Axis Command Instructions
z CombineMode Set to _mcAddAxes
Execute
InCombination
Busy
Active
Command Aborted
Error
ErrorID
16#0000
Master axis position
Auxiliary axis position
Slave axis position
Time
Time
Time
3-298
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z CombineMode Set to _mcSubAxes
Execute
InCombination
Busy
Active
MC_CombineAxes
Command Aborted
Error
ErrorID
16#0000
Master axis position
3
Time
Slave axis position
Time
Function
Auxiliary axis position
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-299
3 Axis Command Instructions
z When the Instruction Is Aborted
Execute
InCombination
Busy
Active
Command Aborted
Error
ErrorID
16#0000
Master axis position
Time
Auxiliary axis position
Slave axis position
Multi-execution of
another instruction
Time
Operation for multiexecution of instructions
Time
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
To use multi-execution of instructions for this instruction, specify the slave axis.
When performing multi-execution of another instruction while this instruction is in execution, the following limits apply depending on BufferMode (Buffer Mode Selection).
• You can execute another instruction with the Buffer Mode set to Aborting during execution of this
instruction. You cannot specify Buffered or a blending mode.
3-300
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Errors
z Timing Chart When Error Occurs
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. The
axis decelerates to a stop at the maximum deceleration rate that is set in the axis parameters. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
MC_CombineAxes
Execute
InCombination
Busy
Active
3
Command Aborted
Error
16#0000
Function
ErrorID
Error ID
Master axis position
Auxiliary axis position
Time
Slave axis position
Time
Time
Additional Information
• This instruction is not affected by errors in the Master (Master Axis) or the Auxiliary (Auxiliary
Axis).
• After the error is cleared and the Master (Master Axis) or the Auxiliary (Auxiliary Axis) is in
motion, the Slave (Slave Axis) will resume the combined positioning operation. The Master
(Master Axis) or the Auxiliary (Auxiliary Axis) are not affected if an error occurs for the slave
axis during startup or execution of this instruction, but this instruction is aborted.
NY-series Motion Control Instructions Reference Manual (W561)
3-301
3 Axis Command Instructions
If a minor fault level error occurs during instruction execution, CommandAborted will change to
TRUE and the axis will stop.
The axis decelerates to a stop at the maximum deceleration rate that is set in the axis parameters.
You can find out the cause of the error by referring to the value output to the MFalutLvl.Code Axis
Variable for the Slave (Slave Axis).
Execute
InCombination
Busy
Active
Command Aborted
Error
ErrorID
16#0000
Master axis position
Time
Auxiliary axis position
Time
Slave axis position
Error occurs.
Time
3-302
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
If you clear the error for this instruction, the instruction will not start until Execute changes to TRUE
again.
Execute
InCombination
Busy
MC_CombineAxes
Active
Command Aborted
Error reset.
Error
ErrorID
Error code
16#0000
3
Master axis position
Slave axis position
Function
Auxiliary axis position
Time
Time
Time
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-303
3 Axis Command Instructions
MC_Phasing
The MC_Phasing instruction shifts the phase of the master axis currently in synchronized control.
Instruction
MC_Phasing
Name
Shift Master Axis
Phase
FB/FUN
FB
Graphic expression
MC_Phasing_instance
MC_Phasing
Master
Slave
Execute
PhaseShift
Velocity
Acceleration
Deceleration
Jerk
BufferMode
Master
Slave
Done
Busy
Active
CommandAborted
Error
ErrorID
ST expression
MC_Phasing_instance (
Master :=parameter,
Slave :=parameter,
Execute :=parameter,
PhaseShift :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
BufferMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
PhaseShift
Phase Shift
Amount
LREAL
Negative number, positive number, or 0
0
Specify the master axis phase
shift amount. The unit is command units.*1
Velocity
Target
Velocity
LREAL
Positive number
0
Specify the target velocity for the
phase shift amount.*2
Specify the target velocity. The
unit is command units/s.*1
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate.
The unit is command units/s2.*1
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration rate.
The unit is command units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is command units/s3.*1
BufferMode
Buffer Mode
Selection
_eMC_BUFFER_MODE
0: _mcAborting
0*3
Specify the behavior when executing more than one motion
instruction.
0: Aborting
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
3-304
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
*2 Always set the target velocity. A Target Velocity Setting Out of Range error (error code: 5422 hex) occurs when the
instruction is executed if the target velocity is not set.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
3
Variables
Done
MC_Phasing
Done
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3-305
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When phase shift is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Active
When phase shift is started.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When execution of the synchronized control
instruction is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Meaning
Data type
Master
Name
Master Axis
_sAXIS_REF
---
Valid range
Description
Specify the master axis.*
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Precautions for Correct Use
If you specify the same axis for the master axis and slave axis, a Master and Slave Defined as
Same Axis minor fault (error code 5436 hex) will occur.
Function
• Except during execution of the MC_CombineAxes instruction, if the MC_Phasing instruction is executed when single-axis synchronized control is in progress, the phase of the master axis is shifted
according to the settings of the PhaseShift (Phase Shift Amount), Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration (Deceleration Rate).
• The command current position and actual current position of the master axis do not change, and the
relative shift between the command current position and actual current position of the master axis is
taken as the phase of the master axis. The slave axis is synchronized to the shifted master axis
phase.
• Done changes to TRUE when the PhaseShift (Phase Shift Amount) is reached.
3-306
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• Shifting is ended when execution of the synchronized control instruction is completed. If a synchronized control instruction is executed again, the previous amount of shift is not affected.
• You can shift the phase of the master axis for the following synchronized control instructions: MC_CamIn (Start Cam Operation), MC_GearIn (Start Gear Operation), MC_GearInPos (Positioning Gear
Operation), and MC_MoveLink (Synchronous Positioning).
• In the user program, place the MC_Phasing instruction after synchronized control instructions as
shown below.
GEARIN
MC_GearIn
StartGear
G_Num
G_Den
_eMC_REFERENCE_TYPE#_mcCommand
G_Acc
G_Dec
G_Jerk
InG
G_Bsy
G_Act
G_Ca
G_Err
G_ErrID
3
Function
Master
Master
Slave
Slave
Execute
InGear
Busy
RatioNumerator
Active
RatioDenominator
ReferenceType CommandAborted
Acceleration
Error
Deceleration
ErrorID
Jerk
BufferMode
MC_Phasing
MC_Axis000
MC_Axis001
PHASING
MC_Phasing
G_Bsy
StartPhase
MC_Axis000
MC_Axis001
P_Shift
P_Vel
P_Acc
P_Dec
P_Jerk
Master
Slave
Execute
PhaseShift
Velocity
Acceleration
Deceleration
Jerk
BufferMode
Master
Slave
Done
Busy
Active
CommandAborted
Error
ErrorID
P_D
P_Bsy
P_Act
P_Ca
P_Err
P_ErrID
Precautions for Correct Use
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on the master axis.
NY-series Motion Control Instructions Reference Manual (W561)
3-307
3 Axis Command Instructions
Instruction Details
This section describes the instruction in detail.
z Specifying Master (Master Axis) and Slave (Slave Axis)
Specify axes variable names to specify the axes for Master (Master Axis) and Slave (Slave Axis). An
axis specification error will occur if you specify a Master (Master Axis) or Slave (Slave Axis) for which
execution of a synchronized control instruction is not in progress.
z PhaseShift (Phase Shift Amount)
Set the phase shift amount as viewed from the Slave (Slave Axis) as the PhaseShift (Phase Shift
Amount). Specify the phase shift about as a relative value.
z Velocity (Target Velocity), Acceleration (Acceleration Rate), Deceleration
(Deceleration Rate), and Jerk
Set Velocity, Acceleration, Deceleration, and Jerk to specify the target velocity (shift velocity), acceleration rate, deceleration rate, and jerk for the phase shift amount.
The target velocity (shift velocity) as viewed from the Slave (Slave Axis) is the velocity relative to the
Master (Master Axis) velocity.
The target velocity (shift velocity) of the Master (Master Axis) as viewed from the Slave (Slave Axis)
is shown below as specified by the phase shift amount, acceleration rate, deceleration rate, and jerk.
3-308
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Example: Master Axis Phase Shift for an Electronic Cam
The interpolation velocity as viewed from the Slave (Slave Axis) is the velocity relative to the Master
(Master Axis) velocity.
Execute
Done
Busy
MC_Phasing
Active
Command Aborted
Error
ErrorID
16#0000
Master axis position as
viewed from the slave axis
3
Actual master axis position
Function
Master axis velocity as
viewed from the slave axis
Time
Target velocity
Time
Slave axis position
Slave axis position
when phase offset is 0
Time
• If you set the phase shift amount to 0, the phase shift amount of the Master (Master Axis) will be 0
and the instruction ends normally.
• If you set the target velocity (shift velocity) to 0, a Slave (Slave Axis) error will occur because the
value is out of range.
• The sum of the specified target velocity (shift velocity) and the Master (Master Axis) velocity can
exceed the maximum velocity of the Master (Master Axis).
Additional Information
Error detection for the results of the MC_Phasing instruction is performed for the operation of the
synchronized Slave (Slave Axis). Therefore, error detection is not performed for the settings of
the Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration (Deceleration
Rate) variables when the MC_Phasing instruction is executed.
z BufferMode (Buffer Mode Selection)
BufferMode specifies how to join the axis motions for this instruction and the previous instruction.
There is currently only the following setting.
Buffer Mode Selection
Aborting
Description
If this instruction is re-executed, the shift for the instruction is
started immediately.
NY-series Motion Control Instructions Reference Manual (W561)
3-309
3 Axis Command Instructions
Reversing operation for multi-execution of instructions is performed according to the Operation
Selection at Reversing setting for the master axis.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z In-position Check
When the phase shift operation is completed, phase shift output is ended and an in-position check is
not performed.
Re-execution of Motion Instructions
If you re-execute the instruction during instruction execution, you can change the PhaseShift (Phase
Shift Amount), Velocity (Target Velocity), Acceleration (Acceleration Rate), and Deceleration (Deceleration Rate). They are changed in the same way as for relative positioning.
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
You can execute another instruction with the Buffer Mode set to Aborting for the Slave (Slave Axis)
during execution of this instruction.
You cannot specify Buffered Mode or blending.
z Multi-execution of MC_Phasing
You can execute the MC_Phasing instruction even if the MC_Phasing instruction is already in execution for the specified slave axis.
3-310
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Error
If an error occurs during instruction execution, Error will change to TRUE and the slave axis will stop.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
CommandAborted of the MC_Phasing (Shift Master Axis Phase) instruction changes to TRUE when
the Slave (Slave Axis) is released from synchronization due to an error.
The error state of the master axis does not affect the operation of this instruction.
z Timing Chart When Error Occurs
MC_Phasing
MC_CamIn (Start Cam Operation) Instruction
Execute
Busy
3
Active
CommandAborted
Function
Error
ErrorID
16#0000
MC_Phasing (Shift Master Axis Phase) Instruction
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-311
3 Axis Command Instructions
MC_TorqueControl
The MC_TorqueControl instruction uses the Torque Control Mode of the Servo Drive to control the
torque.
Precautions for Correct Use
You cannot use this instruction for an NX-series Pulse Output Unit.
Instruction
FB/
FUN
Name
MC_TorqueControl
Torque
Control
Graphic expression
FB
ST expression
MC_TorqueControl_instance
MC_TorqueControl
Axis
Axis
Execute
InTorque
Busy
Torque
TorqueRamp
Active
CommandAborted
Velocity
Error
Direction
BufferMode
ErrorID
MC_TorqueControl_instance (
Axis :=parameter,
Execute :=parameter,
Torque :=parameter,
TorqueRamp :=parameter,
Velocity :=parameter,
Direction :=parameter,
BufferMode :=parameter,
InTorque =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Execute
Execute
Torque
Data type
BOOL
Valid range
Default
Description
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Target Torque LREAL
0 to 1000.0
300.0
Specify the target torque to output
to the Servo Drive in increments of
0.1%. Specify a percentage of the
rated torque, i.e., the rated torque
is 100.0%.*1 The unit is %.
TorqueRamp
Torque Ramp
LREAL
Non-negative number
0
Specify the change rate of torque
from the current value to the target
torque. The unit is %/s.
Velocity
Velocity Limit
LREAL
Non-negative number
0
Specify the target velocity. The
unit is command units/s.*2
Direction
Direction
_eMC_
DIRECTION
0: _mcPositiveDirection
0*3
Specify the direction of the target
torque.
2: _mcNegativeDirection
0: Positive direction
2: Negative direction
3-312
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
BufferMode
Meaning
Data type
Buffer Mode
Selection
_eMC_BUFFER_
MODE
Valid range
0: _mcAborting
1: _mcBuffered
Default
0*3
Description
Specify the behavior when executing more than one motion instruction.
0: Aborting
1: Buffered
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
3
Data type
Valid range
Description
Target Torque
Reached
BOOL
TRUE or
FALSE
TRUE when the target torque is reached.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axis is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
Variables
InTorque
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
MC_TorqueControl
*1 If a value that is higher than 1,000.0% is specified, it will be treated as 1,000.0%. If a negative value is specified, it will be
treated as 0.0%.
Timing for changing to TRUE
Timing for changing to FALSE
InTorque
When target torque is output.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
• When the instruction is re-executed and
the target torque is changed.
Busy
When Execute changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
Active
When output of the torque command value starts.
• When Error changes to TRUE.
• When CommandAborted changes to
TRUE.
CommandAborted
• When this instruction is aborted because another
motion control instruction was executed with the
Buffer Mode set to Aborting.
• When this instruction is canceled due to an error.
• When this instruction is executed while there is an
error.
• When you start this instruction during MC_Stop
instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
NY-series Motion Control Instructions Reference Manual (W561)
3-313
3 Axis Command Instructions
Name
Timing for changing to TRUE
Error
Timing for changing to FALSE
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_TorqueControl instruction controls the output torque of the Servomotor by directly specifying
the torque command value.
• Set the target torque in increments of 0.1%. If the second decimal place is specified, it will be
rounded off.
• Use MC_Stop instruction to stop the execution of this instruction.
• The Torque Control Mode of the Servo Drive is used to perform torque control.
• The previous Control Mode is maintained until it is changed.
Example: Changing from position control to torque control: Position control is performed until the
Servo Drive changes to torque control.
Changing from torque control to position control: Torque control is performed until the
Servo Drive changes to position control.
z Mapping Data Objects
To use the MC_TorqueControl (Torque Control) instruction, map the following object data in the
Detailed Settings Area of the Axis Basic Settings Display of the Sysmac Studio.
• Target torque (6071 hex)
• Modes of operation (6060 hex)
• Torque actual value (6077 hex)
• Modes of operation display (6061 hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
For details on mapping data objects, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Instruction Details
This section describes the instruction in detail.
z Specifying Axis
Axis specifies the axis for torque control.
3-314
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z TorqueRamp
Specify the slope from the currently specified command torque until the target torque is output.
Example 1: Direction = Positive
Torque
Example 2: Direction = Negative
Torque
Torque
MC_TorqueControl
Time
TorqueRamp
TorqueRamp
Time
Torque
3
Precautions for Correct Use
z Velocity (Velocity Limit)
Velocity limits the maximum velocity of the axis during torque control. When the axis velocity
reaches this velocity limit, the Servo Drive reduces the torque to reduce the axis velocity. The velocity limit function uses the Servo Drive function.
For details, refer to information on the torque control function in the Servo Drive manual.
Precautions for Correct Use
• The axis velocity increases faster during torque control. Make sure that you set Velocity (velocity limit) for safety.
• When you use an OMRON G5-series Servo Drive, set the Velocity Limit Selection (3317 hex)
of the Servo Drive to 1 (velocity limit value via EtherCAT communications). Otherwise, the
velocity limit is not affected. Also, the axis does not stop even if the limit input signal turns ON.
• Process data 607F hex is used for the velocity limit value. When you use an OMRON 1Sseries Servo Drive or G5-series Servo Drive, set the advanced settings in the Axis Parameter
Settings of the Sysmac Studio to use the Velocity Limit Value (607F hex). To use a velocity
limit with a servo drive from another manufacturer, refer to the manual for the servo drive.
z Direction
Direction specifies the direction to output the target torque. If you want to output torque in the positive direction of the axis, set the positive direction. If you want to output torque to the negative direction of the axis, set the negative direction.
z BufferMode (Buffer Mode Selection)
BufferMode specifies how to join the axis motions for this instruction and the previous instruction.
There are two possible settings.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this
instruction.
Buffered
Buffers this instruction and executes it automatically after the
current instruction is completed.
NY-series Motion Control Instructions Reference Manual (W561)
3-315
Function
Set the target torque so that the maximum torque of the motor is not exceeded.
The operation that is performed when the maximum torque of the motor is exceeded depends on
the Servo Drive.
3 Axis Command Instructions
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Stopping Axes during Torque Control
If MC_Stop is executed during MC_TorqueControl execution for an OMRON 1S-series Servo Drive
or G5-series Servo Drive, the deceleration rate that is specified for the MC_Stop instruction is not
used and an immediate stop is performed.
An immediate stop is performed even for errors that normally result in deceleration stops.
z Command Position and Actual Position during Torque Control
The following current positions are given in the system-defined variables for motion control during
torque control for this instruction.
Actual current position:
Contains the value returned by the Servo Drive multiplied by the
gear ratio.
Command current position:
Contains the actual current position from the previous period.
z Applicable Axes and Execution Condition
• For a servo axis, this instruction is ready for execution as soon as Enable for the MC_Power
(Power Servo) instruction changes to TRUE (Servo ON).
• A virtual servo axis will acknowledge this instruction at any time. However, processing to switch
the Control Mode of the Servo Drive is not performed.
• An error occurs if the instruction is executed for an encoder or virtual encoder axis.
z Operation When Servo Turns OFF
Processing to change to CSP Mode is performed by the MC Function Module when the Status output variable from the MC_Power (Power Servo) instruction changes to FALSE.
However, for an OMRON G5-series Servo Drive, commands to change the Control Mode are not
acknowledged from the MC Function Module when the Servo is OFF.
z Axis Variable Status
Status.Continuous (Continuous Motion) in the Axis Variable status changes to TRUE. Also, CST
(Cyclic Synchronous Torque (CST) Control Mode) in DrvStatus (Servo Drive Status) in the Axis Variable changes to TRUE.
z Home Status
Home remains defined.
z Software Limits
The software limits are applied.
They are applied even if one of the following is selected in the axis parameter: Deceleration stopping
enabled for command position or Immediate stopping enabled for command position (stop using
remaining pulses).
z When Count Mode Is Set to Linear Mode
The operation for underflows and overflows is the same as for operations that do not have target
positions.
z Operation Selection at Reversing
If multi-execution is performed and the torque command value is reversed, operation is performed
with TorqueRamp from this instruction and not with the setting of the Operation Selection at Reversing axis parameter.
3-316
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
The operation for reversing for multi-execution of instructions is as follows:
• If the command position reverses for multi-execution of an instruction that uses CSP during execution of this instructions, the operation at reversing is performed according to the Operation Selection at Reversing axis parameter.
• If the torque command value reverses when multi-execution of this instruction is performed during
execution of an instruction that uses CSP or CSV, the torque command reverses according to
TorqueRamp.
Timing Charts
Starting and Stopping the Instruction
Execute
MC_TorqueControl
• If the torque command value reverses when multi-execution of this instruction is performed during
execution of this instruction, the torque command reverses according to TorqueRamp.
3
InTorque
Function
Busy
Active
Stopping with MC_Stop
CommandAborted
Current velocity
Torque control
Position control
Velocity
Axis current velocity
Torque control
Position control
Time
Torque
Command torque
Torque control for the velocity
limit of the Servo Drive
Torque
Current torque
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-317
3 Axis Command Instructions
Instruction Execution to Abort Immediately Preceding Operation
The following timing chart shows an application in which the axis stops and holding is performed
while this instruction is in execution.
Position Control Instruction (First Instruction)
Execute
Done
Busy
Active
CommandAborted
MC_TorqueControl Instruction (Second Instruction)
Execute
InTorque
Busy
Active
CommandAborted
Current velocity
Position control
Torque control
Velocity
Axis current
velocity
When the axis is held
against the workpiece
Position control
Torque control
Time
Torque
Current torque
Command torque
Torque
Time
3-318
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Instruction Execution for Buffered during Immediately Preceding Operation
The following timing chart shows an application in which the axis stops and holding is performed
while this instruction is in execution.
Position Control Instruction (First Instruction)
Execute
Done
MC_TorqueControl
Busy
Active
CommandAborted
MC_TorqueControl Instruction (Second Instruction)
3
Execute
Function
InTorque
Busy
Active
CommandAborted
Current velocity
Velocity
Position control
Torque control
Axis current
velocity
When the axis is held
against the workpiece
Position control
Torque control
Time
Torque
Current torque
Command torque
Torque
Time
z Changing the Control Mode
• If you execute the MC_TorqueControl instruction while a position control instruction, such as the
MC_MoveAbsolute (Absolute Positioning) or MC_MoveRelative (Relative Positioning) instruction,
is in execution, the operation depends on the setting of the BufferMode (Buffer Mode Selection) of
the MC_TorqueControl instruction.
If BufferMode is set to Aborting, the Control Mode changes to Torque Control as soon as the
instruction is executed. If the Buffer Mode is set to Buffered, the Control Mode changes to Torque
Control after the previous operation is completed.
• If the MC_TorqueControl instruction is aborted by other instructions such as MC_MoveAbsolute
(Absolute Positioning), or if an axis error occurs, the Control Mode changes to Position Control at
that point.
• Active (Controlling) changes when the instruction is executed, but it takes several periods for the
Control Mode in the Servo Drive to change. The time that is required for the Control Mode to
change depends on the Servo Drive.
NY-series Motion Control Instructions Reference Manual (W561)
3-319
3 Axis Command Instructions
Criteria for Changing the Control Mode
When you stop an axis for an OMRON 1S-series Servo Drive or G5-series Servo Drive, the MC
Function Module sets the Velocity Limit Value (607F hex) to 0. The Control Mode is changed to CSP
Mode when the following criterion is met for three consecutive periodic tasks after that.
Actual current velocity ≤ Maximum velocity × 0.1
With a servo drive from another manufacturer, the Control Mode of the Servo Drive changes from
CST to CSP Mode and the Servo is turned ON at the actual current position when the mode
changes.
Precautions for Correct Use
Here, the periodic task is the primary periodic task or the priority-5 periodic task.
Failure to Change the Control Mode
If the Servo Drive does not complete switching the Control Mode within 1 second after a Control
Mode switch command is sent from the MC Function Module, an Error in Changing Servo Drive
Control Mode (error code: 7439 hex) occurs and the Servo is turned OFF, i.e., a free-run stop
occurs.
For details on the Error in Changing Servo Drive Control Mode (error code: 7439 hex), refer to the
NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel
PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
If the criteria for changing is not met within 10 seconds after the Velocity Limit Value is set to 0, the
Servo is turned OFF in the same was as given above.
Operation Examples for Changing the Control Mode
The relationship between the command torque and command velocity until the Control Mode
changes is described in the following examples where the Control Mode is changed during axis
operation.
Precautions for Correct Use
An error will occur in some Servo Drives if the Control Mode in the Servo Drive changes during
axis motion.
Changing from Position Control to Torque Control
3-320
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_TorqueControl executed.
Current velocity
Position control
Torque control
Current velocity
Command velocity
Torque
MC_TorqueControl
The command velocity of this
instruction is maintained until
torque control is started.
Time
Position control
Torque control
Command torque
Current torque
Torque
3
Function
Time
The first command torque when this
instruction is executed is the current torque.
Changing from Torque Control to Position Control
Position control instruction is executed.
Current velocity
Torque control
Command velocity
Current velocity
Position control
The first command velocity
when the position control
instruction is executed is the
actual current velocity.
Torque
Time
Torque control
Position control
Command torque
Torque
Current torque
Current torque
Time
The command torque when the
position control instruction is
executed is used until position
control is started.
Re-execution of Motion Instructions
You can change the operation of the instruction if you change the input parameter during torque control
and then change Execute to TRUE again. You can change the input variables Torque (Target Torque),
TorqueRamp, and Velocity (Velocity Limit) by re-executing the motion control instruction. When the
motion control instruction is re-executed to change Torque (Target Torque), InTorque (Target Torque
Reached) operates for the new target torque that was set at re-execution. For details on re-execution of
motion control instructions, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No.
W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No.
W559).
NY-series Motion Control Instructions Reference Manual (W561)
3-321
3 Axis Command Instructions
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of
another instruction. You can buffer one instruction per axis. Specify the operation of this instruction
by using BufferMode (Buffer Mode Selection) for multi-execution of instructions.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
Buffered
Buffers this instruction and executes it automatically after the current instruction is completed.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
If another instruction is executed during execution of this instruction, the BufferMode input variable
to the other instruction must be set to Aborting or Buffered.
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
InTorque
Busy
Active
CommandAborted
Error
ErrorID
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-322
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SetTorqueLimit
The MC_SetTorqueLimit instruction limits the torque output from the Servo Drive through the torque
limit function of the Servo Drive.
MC_SetTorqueLimit
Precautions for Correct Use
• You cannot use this instruction for an NX-series Pulse Output Unit.
Instruction
FB/
FUN
Name
MC_SetTorqueLimit Set Torque
Limit
Graphic expression
FB
ST expression
MC_SetTorqueLimit_instance
MC_SetTorqueLimit
Axis
Enabled
Busy
Error
ErrorID
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Enable
Enable
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Enable is TRUE.
PositiveEnable
Positive
Direction
Enable
BOOL
TRUE or FALSE
FALSE
TRUE: Enables the positive torque
limit.
Positive
Torque Limit
LREAL
0.1 to 1000.0 or 0.0
300.0
Set the torque limit in the positive
direction in increments of 0.1%.
If a value that exceeds the Maximum Positive Torque Limit axis
parameter, the positive torque will
be the Maximum Positive Torque
Limit.
The value will be 0 if 0 or a negative
value is specified.
BOOL
TRUE or FALSE
FALSE
TRUE: Enables the negative torque
limit.
PositiveValue
NegativeEnable Negative
Direction
Enable
FALSE: Disables the positive
torque limit.
NY-series Motion Control Instructions Reference Manual (W561)
FALSE: Disables the negative
torque limit.
3-323
3
Variables
Axis
Enable
PositiveEnable
PositiveValue
NegativeEnable
NegativeValue
MC_SetTorqueLimit_instance (
Axis :=parameter,
Enable :=parameter,
PositiveEnable :=parameter,
PositiveValue :=parameter,
NegativeEnable :=parameter,
NegativeValue :=parameter,
Enabled =>parameter,
Busy =>parameter,
Error =>parameter,
ErrorID =>parameter
);
3 Axis Command Instructions
Name
NegativeValue
Meaning
Negative
Torque Limit
Data type
LREAL
Valid range
0.1 to 1000.0 or 0.0
Default
300.0
Description
Set the torque limit in the negative
direction in increments of 0.1%.
If a value that exceeds the Maximum Negative Torque Limit axis
parameter, the negative torque will
be the Maximum Negative Torque
Limit.
The value will be 0 if 0 or a negative
value is specified.
Output Variables
Name
Meaning
Data type
Valid range
Description
Enabled
Enable
BOOL
TRUE or
FALSE
TRUE when control is in progress.*1
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*2
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
*1 Enabled indicates the status of the instruction. It does not indicate the status of torque control by the Servo Drive.
*2 Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Enabled
• When Enable changes to TRUE.
• When MC_Power is being executed.
• One period after Enable changes to
FALSE.
• When Error changes to TRUE.
• When Enable for MC_Power instruction
changes to FALSE.
Busy
When Enable changes to TRUE.
• When Error changes to TRUE.
• When Enable changes to FALSE.
Error
When there is an error in the execution conditions or
input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_SetTorqueLimit instruction sets the torque limits that are used by the Servo Drive.
• When Enable is TRUE and PositiveEnable (Positive Direction Enable) changes to TRUE, control is
performed with PositiveValue (Positive Torque Limit).
When Enable is TRUE and NegativeEnable (Negative Direction Enable) changes to TRUE, control is
performed with NegativeValue (Negative Torque Limit).
3-324
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• When PositiveEnable (Positive Direction Enable) changes to FALSE, the value of the Maximum Positive Torque Limit is set in the Servo Drive.
When NegativeEnable (Negative Direction Enable) changes to FALSE, the value of the Maximum
Negative Torque Limit is set in the Servo Drive.
• When Enable to this instruction changes to FALSE, the values of the Maximum Positive Torque Limit
and Maximum Negative Torque Limit are set in the Servo Drive. At the same time, Busy (Executing)
and Enabled change to FALSE.
Precautions for Correct Use
Set the Maximum Positive Torque Limit and Maximum Negative Torque Limit axis parameters to
the upper limits of torque control for your Servo Drive.
3
z Mapping Data Objects
• Positive torque limit value (60E0 hex)
• Negative torque limit value (60E1 hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
Precautions for Correct Use
• If you use a servo drive from a different manufacturer, set the servo drive so that the positive
torque limit value (PDO 60E0 hex) and the negative torque limit value (PDO 60E1 hex) are
used as the torque limits.
Refer to the manual for your servo drive for the setting procedure.
• This instruction cannot be used for servo drives from other manufacturers unless the positive
torque limit value and the negative torque limit value can be mapped to PDOs.
If they cannot be set to PDOs, use the support software of the manufacturer or SDO communications to set the torque limits.
For details on mapping data objects, refer to 2-3 PDO Mapping and to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
z Changing the Input Parameters
The following input parameters are continuously updated as long as Enable is TRUE.
• PositiveEnable (Positive Direction Enable)
• NegativeEnable (Negative Direction Enable)
• PositiveValue (Positive Torque Limit)
• NegativeValue (Negative Torque Limit)
z Relation to Holding Operation of the MC_Home or MC_HomeWithParameter
Instruction for OMRON 1S-series Servo Drives or G5-series Servo Drives
Torque limits that are set in the Servo Drive in advance are used for the Proximity Reverse
Turn/Holding Time (12) or No Home Proximity Input/Holding Home Input (13) Homing Operation
Modes to automatically start torque control in the holding direction.
3-325
Function
To use the MC_SetTorqueLimit instruction, map the following object data in the Detailed Settings
Area of the Axis Basic Settings Display of the Sysmac Studio.
NY-series Motion Control Instructions Reference Manual (W561)
MC_SetTorqueLimit
• The torque limits are set as a percentage of the motor torque in 0.1% increments. If the second decimal place is specified, it will be rounded off.
3 Axis Command Instructions
Precautions for Correct Use
The automatic torque limit function of the MC_Home or MC_HomeWithParameter instruction is
not used for servo drives from other manufacturers.
Use the MC_SetTorqueLimit instruction, SDO communications, or the Support Software for the
Servo Drive to set suitable values.
Additional Information
• The torque limits are continued even after a normal completion of homing.
• The torque limits are automatically released when an instruction that moves the axis in the
opposite direction is executed.
For details on homing, refer to MC_Home on page 3-16 and MC_HomeWithParameter on page
3-38.
z Settings for OMRON 1S-series Servo Drives
To use this instruction, you must set the Torque Limit - Switch Selection (3330-01 hex) for the 1Sseries Servo Drive with the Sysmac Studio.
• Set the Torque Limit - Switch Selection to 2 to apply a torque limit in the home input detection
direction during the holding operation for homing and to use the torque limit directions and values
that are set with the MC_SetTorqueLimit instruction for other operation.
In that case, the values of the input variables to the MC_SetTorqueLimit instruction are ignored
during the holding operation for homing.
• If the Torque Limit - Switch Selection is set to 0, the values of the input variables to the MC_SetTorqueLimit instruction are always used. You must set torque limits that are suitable for both for
the holding operation during homing and for other operations.
Torque Limit - Switch Selection (3330-01 hex)
2
Positive
Torque Limit
Negative
Torque Limit
Homing
The Torque Limit - Positive Torque
Limit Value 2 (3330-05 hex) for the
Servo Drive is used.
Operations
other than
Homing
The PositiveValue (Positive Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
Homing
The Torque Limit - Negative Torque
Limit Value 2 (3330-06 hex) for the
Servo Drive is used.
Operations
other than
Homing
The NegativeValue (Negative Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
0
The PositiveValue (Positive Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
The NegativeValue (Negative Torque
Limit) for the MC_SetTorqueLimit
instruction is used.
For details, refer to the AC Servomotors/Servo Drives 1S-series with Built-in EtherCAT Communications User’s Manual (Cat. No. I586).
z Settings for OMRON G5-series Servo Drives
To use this instruction, you must use the Sysmac Studio of the servo drive to set the Torque Limit
Selection (3521 hex) in the Servo Drive.
• Set the Torque Limit Selection to 6 to apply a torque limit in the home input detection direction
during the holding operation for homing and to use the torque limit directions and values that are
set with this instruction for other operation.
In that case, the values of the input variables to this instruction are ignored during the holding
operation for homing.
3-326
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• If the Torque Limit Selection to 4, the values of the input variables to this instruction are always
used. You must set torque limits that are suitable for both for the holding operation during homing
and for other operations.
Torque Limit Selection (3521 hex)
6 (recommended)
Positive Torque
Limit
Homing
4
Torque Limit 3 (3525 hex) is used.
Negative Torque Homing*
Limit
Operations
other than Homing
Torque Limit 4 (3526 hex) is used.
The smaller of the NegativeValue
(Negative Torque Limit) for this
instruction and Torque Limit 2 (3522
hex) is used.
The smaller of the NegativeValue
(Negative Torque Limit) for this
instruction and Torque Limit 2 (3522
hex) is used.
3
* Until the torque limit is automatically released.
z Relationship to the MC_TorqueControl Instruction
The MC_SetTorqueLimit and the MC_TorqueControl instructions can be used together.
z Axes in Axes Groups
This instruction can be used for an axis in an enabled axes group.
z Relation to CPU Unit Operating Modes
The values that are set with this instruction in RUN mode are also used after the operating mode
changes to PROGRAM mode.
z Applicable Axes and Execution Condition
• You can use this instruction for a servo axis.
The status of the Enabled output variable from this instruction, however, depends on the status of
the Servo.
Servo ON
TRUE
Servo OFF
FALSE*
* If Enabled from this instruction is FALSE, the torque limits do not function on the Servo Drive.
• This instruction is acknowledged for a virtual servo axis, but torque is not limited.
• An error occurs if the instruction is executed for an encoder or virtual encoder axis.
z Axis Variable Status (Servo Drive Status)
When the internal limit function in the Servo Drive is in operation, ILA (Drive Internal Limiting) in the
DrvStatus (Servo Drive Status) in the Axis Variable is TRUE.
This variable gives an OR of the following four: torque limits, velocity limit, drive prohibit inputs, and
software limits.
NY-series Motion Control Instructions Reference Manual (W561)
3-327
Function
For details, refer to the AC Servomotors/Servo Drives G5-series with Built-in EtherCAT Communications User’s Manual (Cat. No. I576) or the AC Servomotors/Servo Drives G5-series with Built-in EtherCAT Communications Linear Motor Type User’s Manual (Cat. No. I577).
Status of Enabled
MC_SetTorqueLimit
The smaller of the PositiveValue
(Positive Torque Limit) for this
instruction and Torque Limit 1 (3013
hex) is used.
Operations
The smaller of the PositiveValue
other than Hom- (Positive Torque Limit) for this
ing
instruction and Torque Limit 1 (3013
hex) is used.
3 Axis Command Instructions
Timing Charts
The following chart shows the timing of the torque limits.
Enable
PositiveEnable
NegativeEnable
Busy
Enabled
Error
ErrorID
16#0000
Re-execution of Motion Control Instructions
You cannot re-execute motion instructions with Enable inputs.
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Multi-execution of MC_SetTorqueLimit Instructions
If an instance of this instruction is executed during execution of another instance for the same axis,
the instance that is executed last takes priority in processing.
Enabled will be TRUE for both instructions.
Concretely, the torque limits of the instance that was executed last are valid. If Enable to the
instance that was executed last changes to FALSE, the torque limits are disabled.
3-328
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
MC_SetTorqueLimit
MC_SetTorqueLimit Instruction
Enable
PositiveEnable
NegativeEnable
Busy
3
Enabled
ErrorID 16#0000
Error code
Function
Error
16#0000
MC_Reset Instruction
Execute
Done
Busy
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-329
3 Axis Command Instructions
MC_ZoneSwitch
The MC_ZoneSwitch instruction determines if the command current position or actual current position
of an axis is within a specified zone.
Instruction
MC_ZoneSwitch
Name
Zone Monitor
FB/
FUN
Graphic expression
FB
ST expression
MC_ZoneSwitch_instance
MC_ZoneSwitch
Axis
Enable
FirstPosition
LastPosition
ReferenceType
Axis
Enabled
InZone
Busy
Error
ErrorID
MC_ZoneSwitch_instance (
Axis :=parameter,
Enable :=parameter,
FirstPosition :=parameter,
LastPosition :=parameter,
ReferenceType :=parameter,
Enabled =>parameter,
InZone =>parameter,
Busy =>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Enable
Enable
BOOL
TRUE or FALSE
FALSE
The instruction is executed
while Enable is TRUE.
FirstPosition
First Position
LREAL
Negative number,
positive number, or 0
0
Specify the first position of the
zone range.*1
The unit is command units.*2
LastPosition
Last Position
LREAL
Negative number,
positive number, or 0
0
Specify the last position of the
zone range.*3
The unit is command units.*1
ReferenceType
Position Type
Selection
_eMC_REFERENCE
_TYPE
0: _mcCommand
0*4
Specify the axis information to
monitor.
1: _mcFeedback
0: Command position (value
calculated in the previous
task period*5)
1: Actual position (value
obtained in the same task
period*5)
*1 Set a value that is smaller than the last position.
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*3 Set a value that is larger than the first position.
*4 The default value for an enumeration variable is actually not the number, but the enumerator.
*5 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
3-330
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Enable
BOOL
TRUE or
FALSE
TRUE while the axis is being controlled.
InZone
In Zone
BOOL
TRUE or
FALSE
TRUE when the axes position is within the zone.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
MC_ZoneSwitch
Enabled
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3
z Output Variable Update Timing
Timing for changing to TRUE
Variables
Name
Timing for changing to FALSE
Enabled
When Enable changes to TRUE.
When Enable changes to FALSE.
InZone
When the zone is entered.
• When the zone is exited.
• When Enable changes to FALSE.
Busy
When Enable changes to TRUE.
• When Error changes to TRUE.
• When Enable changes to FALSE.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
NY-series Motion Control Instructions Reference Manual (W561)
3-331
3 Axis Command Instructions
Function
• If the axis command position or actual current position is above the FirstPosition and below the Last
Position (i.e., if it is in the specified zone) when Enable of this instruction is TRUE, the output variable
InZone will change to TRUE.
You can use ReferenceType (Position Type Selection) to set either the command position or actual
position as the axis information to monitor.
• You can perform zone monitoring for any axis type.
• If FirstPosition or LastPosition is changed while Enable is TRUE, the new value is applied in the
period in which it is changed.
• You can set multiple zones for one axis, and these zones can overlap. You can also set zones outside
the software limits.
Precautions for Correct Use
If FirstPosition or LastPosition contains a non-terminating decimal number, e.g., resulting from
division, error may cause unexpected processing results.
Instruction Details
Set the FirstPosition and LastPosition so that the following relationships are established for the Counter
Mode. An error occurs if the relationship is not established.
z Linear Mode
Set FirstPosition to the same value or a smaller value than LastPosition.
FirstPosition
-
LastPosition
0
+
InZone
Zone
z Rotary Mode
In Rotary Mode, there is a difference depending on whether the modulo maximum position and
modulo minimum position setting values are included.
When Maximum/Minimum Position Is Not Included
Set FirstPosition to the same value or a smaller value than LastPosition.
3-332
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Modulo Maximum
Position
LastPosition
FirstPosition
Modulo Minimum
Position
InZone
LastPosition = 330°
−
Zone
MC_ZoneSwitch
Zone
Zone
+
0
Zone
: The positions indicated with
filled dots are included.
3
FirstPosition = 210°
Function
When Maximum/Minimum Position Is Included
Set FirstPosition to a larger value than LastPosition.
Modulo Maximum
Position
FirstPosition
LastPosition
Modulo Minimum
Position
InZone
Zone
FirstPosition = 330°
-
Zone
+
0
Zone
: The positions indicated with
open dots are not included.
LastPosition = 210°
z ReferenceType (Position Type Selection)
You can select one of the following position types.
• _mcCommand: Command position (value calculated in the previous task period)
The master axis command position that was calculated in the previous task period is used for the
current period.
The command value that was calculated for the master axis in the last periodic task is used to calculate the command position of the slave axis in the current period.
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
Precautions for Correct Use
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
NY-series Motion Control Instructions Reference Manual (W561)
3-333
3 Axis Command Instructions
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
Axis Type
Servo axis
Encoder axis
ReferenceType
_mcCommand
OK
_mcFeedback
OK
OK
No*
OK
Virtual servo axis
Virtual encoder axis
OK
OK
No*
* A Position Type Selection Out of Range error (error code: 5430 hex) occurs when the instruction is executed.
Timing Charts
z When the Zone Is Entered during Operation or When Enable Changes to
FALSE Within the Zone
Enable
Enabled
InZone
Enters zone.
Exits zone.
Enters zone.
Enable changes to FALSE.
Busy
z When Inside the Zone before the Instruction Is Executed and Then the Zone Is
Exited
Enable
Enabled
InZone
Exits zone.
Busy
Re-execution of Motion Instructions
You cannot re-execute enable-type motion instructions.
Multi-execution of Motion Instructions
This instruction is executed independently from other instructions. The restrictions for multi-execution of
motion instructions do not apply. For details on multi-execution of motion control instructions, refer to
the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel
PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
Errors
If this instruction cannot be executed, an error occurs and Error of this instruction changes to TRUE.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
3-334
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart When Error Occurs
Enable
Enabled
InZone
Busy
MC_ZoneSwitch
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3
Function
NY-series Motion Control Instructions Reference Manual (W561)
3-335
3 Axis Command Instructions
MC_TouchProbe
The MC_TouchProbe instruction records the position of an axis when a trigger signal occurs.
Instruction
MC_TouchProbe
FB/
FUN
Name
Enable
External
Latch
FB
Graphic expression
ST expression
MC_TouchProbe_instance
MC_TouchProbe_instance (
Axis :=parameter,
TriggerInput :=parameter,
TriggerVariable :=parameter,
Execute :=parameter,
WindowOnly :=parameter,
FirstPosition :=parameter,
LastPosition :=parameter,
ReferenceType :=parameter,
StopMode :=parameter,
Done =>parameter,
Busy =>parameter,
RecordedPosition =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_TouchProbe
Axis
Axis
TriggerInput
TriggerInput
TriggerVariable
TriggerVariable
Execute
Done
Busy
WindowOnly
RecordedPosition
FirstPosition
LastPosition
CommandAborted
ReferenceType
Error
ErrorID
StopMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
WindowOnly
Window
Only
BOOL
TRUE or FALSE
FALSE
Specify whether to enable or
disable the window mask.
FirstPosition
First Position
LREAL
Negative number, positive number, or 0
0
Specify the position to start
accepting the trigger. Use the
type of position that is specified in ReferenceType (Position Type Selection).*1
The unit is command units.*2
LastPosition
Last Position
LREAL
Negative number, positive number, or 0
0
Specify the position to stop
accepting the trigger. Use the
type of position that is specified in ReferenceType (Position Type Selection).*1
The unit is command units.*2
ReferenceType
(Reserved)
Position
Type Selection
_eMC_
REFERENCE_
TYPE
1: _mcFeedback
1*3
(Reserved)
StopMode
Stopping
Mode
Selection
_eMC_STOP_
MODE
1: _mcImmediateStop
4*3
Specify the stopping method.
4: _mcNonStop
1: Perform an immediate stop
4: Do not stop
*1 Refer to WindowOnly on page 3-342 for details.
3-336
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or
NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command units.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
RecordedPosition
Latched Position
LREAL
Negative
Contains the latched position. The unit is in command
number,
units.*1
positive
number, or 0
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*2
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
3
Variables
CommandAborted
MC_TouchProbe
Done
3-337
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
• When the latched position is recorded
and the instruction is completed after the
trigger signal occurs.
• If stopping is specified, when the axis
stops at the latched position after the
latched position is recorded and the
instruction is completed after the trigger
signal occurs.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because • When Execute is TRUE and changes to FALSE.
another motion control instruction was
• After one period when Execute is FALSE.
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• If StopMode is set to _mcImmediateStop, when a change is made to a mode
other than CSP Mode during execution.*
• When the slave is disconnected.
• When a slave communications error
occurs (except during process data communications).
• When the MC_AbortTrigger instruction is
executed.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
* If you use an NX-series CPU Unit, there are no restrictions in the control mode. Therefore, CommandAborted does not
change to TRUE even in modes other than CSP Mode.
In-Out Variables
Name
Meaning
Data type
Valid range
Description
Axis
Axis
_sAXIS_REF
---
Specify the axis.*1
TriggerInput
Trigger Input
Condition
_sTRIGGER_REF
---
Set the trigger condition.*2
TriggerVariable
Trigger
Variable
BOOL
TRUE or
FALSE
Specify a trigger input variable when the
Controller Mode is specified with a trigger
condition.
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Create a user-defined variable with a data type of _sTRIGGER_REF.
3-338
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z _sTRIGGER_REF
Name
Meaning
Mode
Mode
Data type
_eMC_TRIGGER_
MODE
Valid range
Function
0: _mcDrive
Specify the trigger mode.
1: _mcController
0: Drive Mode
1: Controller Mode
LatchID
Latch ID
Selection
_eMC_TRIGGER_
LATCH_ID
0: _mcLatch1
1: _mcLatch2
Specify which of the two latch
functions to use in Drive Mode.
1: Latch 2
InputDrive
Trigger Input
Signal
_eMC_TRIGGER_
INPUT_DRIVE
0: _mcEncoderMark
1: _mcEXT
Specify the Servo Drive trigger
signal to use in Drive Mode.
0: Z-phase signal
MC_TouchProbe
0: Latch 1
1: External input
3
Function
• The position of the axis that is specified with Axis is output to RecordedPosition (Latched Position)
according to the trigger settings.
As trigger settings, you can specify TriggerInput (Trigger Input Condition), WindowOnly, FirstPosition,
LastPosition, and StopMode.
• The output value of RecordedPosition (Latched Position) is held until the axis position is recorded
again by the same MC_TouchProbe (Enable External Latch) instance.
z Mapping Data Objects
You must map the following object data when the MC_TouchProbe (Enable External Latch) instruction is executed with Mode set to Drive Mode. Mapping is performed in the Detailed Setting Area of
the Axis Basic Settings Display of the Sysmac Studio.
Axes Type Set to Servo Axis
• Touch probe function (60B8 hex)
• Touch probe status (60B9 hex)
• Touch probe pos1 pos value (60BA hex)
• Touch probe pos2 pos value (60BC hex)
Axes Type Set to Encoder Axis
• Touch probe function (4020 hex)
• Software Switch of Encoder’s Input Slave (4020 hex)
• Touch probe status (4030 hex)
• Touch probe pos1 pos value (4012 hex)
• Touch probe pos2 pos value (4013 hex)
• Status of Encoder’s Input Slave (4030 hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
For details on mapping data objects, refer to 2-3 PDO Mapping and to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
NY-series Motion Control Instructions Reference Manual (W561)
3-339
Function
• Latching is used to control positioning based on the point where a trigger signal occurs, such as a
signal from a sensor input. The position of the axis is recorded (i.e., latched) when the trigger signal
occurs.
3 Axis Command Instructions
Refer to I/O Entry Mappings in the NX-series Position Interface Units User’s Manual (Cat. No. W524)
for information on using the NX-series Position Interface Units.
Refer to Fixed PDO Mapping in the GX-series EtherCAT Slave Units User’s Manual (Cat. No. W488)
for information on using encoder input slaves.
Instruction Details
This section describes the instruction in detail.
z Specifying Axis
• Axis specifies the axis for which to latch the position.
• If the specified Axis is enabled by the MC_GroupEnable (Enable Axes Group) instruction, the
MC_TouchProbe (Enable External Latch) instruction causes an error and is not executed.
• For each axis, you can specify LatchID to execute up to two MC_TouchProbe (Enable External
Latch) instructions at the same time.
• LatchID is also used to specify the latch to abort for the MC_AbortTrigger (Disable External Latch)
instruction.
Additional Information
• Latching a position is also possible if an encoder axis that is connected to an OMRON GXseries GX-EC02…… EtherCAT Encoder Input Slave is used.
• If you use an NX-series Pulse Output Unit, you can also perform latching with this instruction.
Refer to the NX-series Position Interface Units User’s Manual (Cat. No. W524) for details.
z Trigger Input Condition
Select the trigger conditions with Mode, LatchID, and InputDrive of the TriggerInput (Trigger Input
Conditions) variable.
Mode
• The mode can be set to Drive Mode to specify a signal from the Servo Drive or other device
as the trigger, or to Controller Mode to specify a trigger with TriggerVariable.
• The trigger occurs on the rising edge of the trigger signal. The axis position is latched on the
first trigger (FALSE to TRUE) after the MC_TouchProbe instruction is executed.
• While this instruction is Busy (Executing), a change in TriggerVariable is taken as a trigger
even if Execute is FALSE.
Additional Information
Set Mode to _mcDrive (Servo Drive Mode) if you use an OMRON GX-series GX-EC02…… EtherCAT Encoder Input Slave.
Drive Mode
For trigger detection and latching of the actual position, the latched actual position is more precise in
Drive Mode (which is a function of the Servo Drive or other device) than it is in Controller Mode.
3-340
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Input signal to Servo Drive
Trigger detection
Axis position
Input filter delay
Position (latched position)
Position when trigger signal is input
Precautions for Correct Use
• When using Drive Mode, make sure that you connect the latch signal to the LatchID that you
are going to use.
• The width of the latch signal depends on the performance of the Servo Drive or other device
and other factors.
Set InputDrive to _mcEXT (External Input) if you use an OMRON GX-series GX-EC02…… EtherCAT Encoder Input Slave.
The OMRON GX-series GX-EC02…… EtherCAT Encoder Input Slaves cannot latch on the Z
phase. If you specify _mcEncoderMark (Z phase), an error occurs when the instruction is executed. Error changes to TRUE and a Process Data Object Setting Missing error (error code:
3461 hex) is output to ErrorID when the instruction is executed.
Controller Mode
• You can specify a BOOL variable as the trigger in Controller Mode.
• Specify the BOOL variable that you want to use as a trigger for TriggerVariable.
• The Controller Mode causes a longer delay compared to the Drive Mode. This is due to the
I/O refresh delay that occurs when the trigger input signal is updated in the BOOL variable.
Input signal to Input Unit
BOOL variable assigned to input signal
Axis position
Input filter delay and I/O
refresh delay
Position (latched position)
Position when trigger signal is input
Time
Precautions for Correct Use
If you use Controller Mode, the latch is performed each task period interval. Therefore, the trigger
variable must remain TRUE for at least one task period interval.
Also, one task period is required between when the trigger variable changes to TRUE and the
MC Function Module processes the latch.
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task.
NY-series Motion Control Instructions Reference Manual (W561)
3-341
3
Function
Additional Information
MC_TouchProbe
Time
3 Axis Command Instructions
LatchID
• You can execute up to two MC_TouchProbe instructions per axis. Use LatchID to specify
which of the two latches to use.
• If a LatchID specified for the same axis is already being executed, only the last instruction is
valid. CommandAborted of the previous instruction will change to TRUE.
• LatchIDs indicate latch circuit 1 and latch circuit 2 in the Servo Drive or other device.
For information on latch IDs, refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat.
No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat.
No. W559).
Additional Information
The enumerators correspond to the signal names of the OMRON GX-series GX-EC02…… EtherCAT Encoder Input Slave as shown below.
Enumerator
Signal name on
Encoder Input Terminal
_mcLatch1
External latch input A
_mcLatch2
External latch input B
InputDrive
• You can select _mcEncoderMark (Z phase) or _mcEXT (External Input) as the trigger.
• Select _mcEncoderMark (Z phase) to use the Z phase of the Servo Drive or other device as
the trigger. Select _mcEXT to use an external signal input to the Servo Drive as the trigger.
• For an OMRON 1S-series Servo Drive, there are two options for _mcEXT: Ext1, and Ext2. For
an OMRON G5-series Servo Drive, there are three options for _mcEXT: Ext1, Ext2, and Ext3.
Use Sysmac Studio to make the setting. You can use the same setting for two triggers in the
Servo Drive.
z WindowOnly
• WindowOnly specifies whether the window is enabled or disabled.
• If you specify Disable, triggers are detected for all axis positions.
• If you specify Enable, triggers are detected only when the axis position is within the range specified by FirstPosition and LastPosition.
The following timing chart shows the difference in operation depending on the WindowOnly setting.
WindowOnly Set to Disable
The axis position when the first trigger occurs after Execute changes to TRUE is output to
RecordedPosition (Latched Position).
3-342
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
TriggerInput
Execute
WindowOnly
Done
Busy
0
MC_TouchProbe
RecordedPosition
Position
CommandAborted
Error
ErrorID
16#0000
3
Axis position
Function
LastPosition
FirstPosition
Position
WindowOnly Set to Enable
Only trigger inputs within the window are detected to latch the axis position.
Trigger enabled
TriggerInput
Execute
WindowOnly
Done
Busy
RecordedPosition
0
Position
CommandAborted
Error
ErrorID
16#0000
Axis position
LastPosition
Position
FirstPosition
NY-series Motion Control Instructions Reference Manual (W561)
3-343
3 Axis Command Instructions
Precautions for Correct Use
• Latching is not possible immediately after WindowOnly changes to TRUE and until the latch
function is activated.
• Time is needed until the latch function is activated. If the effective range for WindowOnly is too
small, latching is not possible. The range in which latching is possible depends on the performance of the Servo Drive, Encoder Input Terminal, or Position Interface Unit, and on EtherCAT
communications.
The range that is defined by FirstPosition and LastPosition depends on the Count Mode, as given
below.
Linear Mode
• The valid range of the window is as follows:
FirstPosition must be less than or equal to the window range and the window range must be less
than or equal to LastPosition.
• An error will occur if the FirstPosition is greater than the LastPosition.
• An error will also occur if a position beyond the position range of Linear Mode is specified.
• FirstPosition and LastPosition are LREAL variables. Do not set them to the same values.
Refer to Treatment of REAL and LREAL Data on page 1-12 for information on LREAL data.
The window only range in Linear Mode is shown below.
FirstPosition
LastPosition
0x80000000
0x7fffffff
Window
Window only range
Note The window only range can include the FirstPosition and LastPosition.
Rotary Mode
• The FirstPosition can be less than, equal to, or greater than the LastPosition.
• If the FirstPosition is greater than the LastPosition, the setting range includes the modulo maximum position and modulo minimum position setting values.
• An error will occur if you specify a value beyond the modulo maximum position and modulo minimum position setting values.
FirstPosition ≤ LastPosition
LastPosition
−
+
0
LastPosition
−
+
0
FirstPosition
Window only range
: The positions indicated with
filled dots are included.
FirstPosition
Window only range
3-344
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
FirstPosition > LastPosition
FirstPosition
−
0
+
FirstPosition
−
0
+ Window only range
LastPosition
: The positions indicated with
open dots are not included.
MC_TouchProbe
LastPosition
Window only range
z StopMode
• You can specify the StopMode for the specified Axis when a trigger occurs.
• If _mcNonStop is specified, the axis will not stop even if a trigger occurs.
• If _mcImmediateStop is specified, the axis stops at the latched position when a trigger occurs.
CommandAborted of the instruction that was moving the axis changes to TRUE due to this stop.
• An in-position check is not performed when stopping for _mcImmediateStop.
Additional Information
• When an OMRON 1S-series Servo Drive is used, the operation will be the same as those
described in below for CPU Units with unit version 1.10 or later, regardless of actual unit version of the CPU Unit that you use.
• When an OMRON G5-series Servo Drive is used, the operation will differ depending on the
unit version of the CPU Unit that you use, as described in below.
CPU Units with Unit Version 1.10 or Later
• If an axis error occurs for the axis for which _mcImmediateStop (Immediate Stop) is specified and a
trigger occurs before stopping the axis is completed, the axis will continue to decelerate to a stop.
Also, the trigger will cause CommandAborted (Instruction Aborted) to change to TRUE.
Velocity
Error occurs.
Trigger occurs.
Time
Decelerating to a stop for the error
NY-series Motion Control Instructions Reference Manual (W561)
3-345
Function
• For _mcImmediateStop, Done changes to TRUE as soon as the axis command stops. Busy is
TRUE until the axis stops at the latched position.
3
3 Axis Command Instructions
Precautions for Correct Use
• The MC Function Module performs stop processing for _mcImmediateStop (Immediate Stop).
The axis will stop beyond the latched position, and the axis will then return to the latched position for a command from the Controller.
• If you use _mcImmediateStop (Immediate Stop) with a high command velocity, the distance to
return to the latched position will be long. Make sure that the command velocity is not too high.
• Specify _mcNonStop (No Stop) for an encoder axis. If _mcImmediateStop (Immediate Stop) is
specified, Error will change to TRUE when the instruction is executed. At the same time, an
Enable External Latch Instruction Execution Disabled error (error code: 5492 hex) is output to
ErrorID.
CPU Units with Unit Version 1.09 or Earlier
• If an axis error occurs for an axis for which _mcImmediateStop (Immediate Stop) is specified and a
trigger occurs before the axis is stopped, an immediate stop is performed for the axis by the OMRON
G5-series Servo Drive. Also, the trigger will cause CommandAborted (Instruction Aborted) to change
to TRUE.
• When the MC Function Module detects that the OMRON G5-series Servo Drive has stopped, it stops
the motor immediately. The dotted line in the following figure shows the target path when a trigger
does not occur.
Velocity
Error occurs.
Trigger occurs.
Time
Decelerating to a stop for an error
3-346
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
• _mcImmediateStop (Immediate Stop) functions in CSP Mode.
• If _mcImmediateStop (Immediate Stop) is specified in CSV/CST Mode, an Enable External
Latch Instruction Execution Disabled error (error code 5492 hex) occurs when the instruction
is executed. If you change to CSV/CST Mode during execution for _mcImmediateStop (Immediate Stop), CommandAborted changes to TRUE.
• If you use _mcImmediateStop (Immediate Stop) with a high command velocity, the distance to
return to the latched position will be long. Make sure that the command velocity is not too high.
• If _mcImmediateStop is used and both of the following processes are executed in the same
control period, an OMRON G5-series Servo Drive enters the Target Ignore state.
• Counter latch processing in the Servo Drive when the latch signal turns ON
• Latch release processing when CommandAborted changes to TRUE for the MC_TouchProbe (Enable External Latch) instruction
Make sure that CommandAborted for the instruction does not change to TRUE when the latch
signal turns ON.
z Axis Variable Status
If _mcImmediateStop is specified for StopMode, Status.Stopping (Deceleration Stopping) in the Axis
Variable is TRUE during stop processing for the trigger.
NY-series Motion Control Instructions Reference Manual (W561)
3-347
3
Function
• Specify _mcNonStop (No Stop) for an encoder axis. If _mcImmediateStop is specified, Error
will change to TRUE when the instruction is executed. At the same time, an Enable External
Latch Instruction Execution Disabled error (error code: 5492 hex) is output to ErrorID.
MC_TouchProbe
• For _mcImmediateStop, the function of the Servo Drive or NX-series Pulse Output Unit is used
to stop if an OMRON G5-series Servo Drive or NX-series Pulse Output Unit is used.
The MC Function Module processes the stop if an OMRON 1S-series Servo Drive or a servo
drive from another manufacturer is used. In either case, the axis will stop beyond the latched
position, and the axis will then return to the latched position for a command from the Controller.
3 Axis Command Instructions
Aborting the Instruction
End the MC_TouchProbe (Enable External Latch) instruction with the MC_AbortTrigger (Disable External Latch) instruction. Specify the Axis and the LatchID (Latch ID Selection) to stop for the MC_AbortTrigger instruction and execute it to stop the axis.
MC_TouchProbe Instruction
TriggerInput
Execute
WindowOnly
Done
Busy
RecordedPosition
0
CommandAborted
Error
ErrorID
16#0000
MC_AbortTrigger Instruction
Execute
Done
Busy
CommandAborted
Error
ErrorID
3-348
16#0000
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
An error occurs if Execute changes to TRUE again before the MC_TouchProbe instance completes
reading RecordedPosition (Latched Position).
MC_TouchProbe
TriggerInput
Execute
WindowOnly
Done
3
Busy
RecordedPosition
Function
0
CommandAborted
Error
ErrorID
16#0000
NY-series Motion Control Instructions Reference Manual (W561)
Error code
3-349
3 Axis Command Instructions
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can execute only one trigger at a time for a single LatchID on the same Axis.
If you execute another MC_TouchProbe (Enable External Latch) instance for the same LatchID
while an MC_TouchProbe (Enable External Latch) instruction is in execution, CommandAborted of
the first instruction changes to TRUE and the second instruction is executed.
MC_TouchProbe A
*
TriggerInput
Execute
WindowOnly
Done
Busy
RecordedPosition
0
CommandAborted
Error
ErrorID
16#0000
MC_TouchProbe B
Execute
Done
Busy
CommandAborted
Error
ErrorID
16#0000
* Here, the trigger input signal of the Servo Drive or other device is used.
Additional Information
If _mcImmediateStop is specified for StopMode, CommandAborted for the second instruction
changes to TRUE after the axis stops for the trigger.
3-350
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Error
If an error occurs during execution of the MC_TouchProbe instruction, Error will change to TRUE. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
MC_TouchProbe
Done
Busy
CommandAborted
Error
3
ErrorID
Error code
Sample Programming
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
Sample Programming
This section shows sample programming for position latching control by an external sensor.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Axis Parameters
Axis Type
Axis
Axis Type
Axis 1
Servo axis
Count Mode
Axis
Count Mode
Axis 1
Rotary Mode
Ring Counter
Axis
Axis 1
Modulo maximum position
360
Modulo minimum position
0
Unit of Display
Axis
Axis 1
Unit of Display
degree
NY-series Motion Control Instructions Reference Manual (W561)
3-351
3 Axis Command Instructions
Operation Example
Sensor 1
Servo axis
Axis 1
z Operation Pattern
Axis 1 position
Pos2
Latched position
Pos1
Time
Sensor 1 status
Time
1
Starting the Master Axis
Velocity control is performed for axis 1.
2
Detecting Workpiece
Sensor 1 detects the workpiece.
3
Latching the Position
If the workpiece is detected in the window (Pos1 to Pos2), the position of axis 1 is latched.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
3-352
Data type
_sAXIS_REF
BOOL
Default
--FALSE
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
Pos1
LREAL
---
Comment
This is the Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
This variable specifies the first position of the window.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Name
Data type
LREAL
Default
---
StartPg
BOOL
FALSE
InitFlag
BOOL
FALSE
Pos2
z Sample Programming
If StartPg is TRUE, EtherCAT communications are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
PWR
MC_Power
Lock1
MC_Axis000
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
If the Servo is ON and home is not defined, the Home instruction is executed.
HM
MC_Home
Pwr_Status MC_Axis000.Details.Homed
MC_Axis000
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm_D
Hm_Bsy
Hm_Ca
Hm_Err
Hm_ErrID
3-353
3
Sample Programming
If process data communications are active for axis 1, the Servo is turned ON.
MC_TouchProbe
Comment
This variable specifies the last position of the window.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
3 Axis Command Instructions
The parameters are set for the MC_MoveVelocity (Velocity Control) and MC_TouchProbe (Enable External Latch) instructions.
InitFlag
Note: The contents of the inline ST are given below.
The MC_MoveVelocity (Velocity Control) instruction is executed if home is defined for axis 1.
VEL
MC_Axis000
MC_Axis000.Details.Homed
Vel_Vel
Vel_Acc
Vel_Dec
Vel_Jrk
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_EIrrD
Latch processing is executed after the MC_MoveVelocity (Velocity Control) instruction is started.
T_PROBE
MC_TouchProbe
Vel_Act
MC_Axis000
T_Probe_TrigRef
T_Probe_TrigVar
T_Probe_Wo
T_Probe_FstPos
T_Probe_LstPos
Axis
Axis
TriggerInput
TriggerInput
TriggerVariable TriggerVariable
Execute
Done
Busy
WindowOnly
FirstPosition RecordedPosition
LastPosition CommandAborted
ReferenceType
Error
StopMode
ErrorID
T_Probe_D
T_Probe_Bsy
T_Probe_RecPos
T_Probe_Ca
T_Probe_Err
T_Probe_ErrID
Contents of Inline ST
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#1000.0;
Vel_Dec := LREAL#1000.0;
Vel_Jrk := LREAL#1000.0;
// MC_TouchProbe parameters
T_Probe_TrigRef.Mode
:= _eMC_TRIGGER_MODE#_mcDrive;
T_Probe_TrigRef.LatchID := _eMC_TRIGGER_LATCH_ID#_mcLatch1;
T_Probe_TrigRef.InputDrive := _eMC_TRIGGER_INPUT_DRIVE#_mcEXT;
T_Probe_TrigVar
:= FALSE;
T_Probe_Wo
:= TRUE;
T_Probe_FstPos
:= LREAL#1000.0;
T_Probe_LstPos
:= LREAL#2000.0;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
3-354
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Structured Text (ST)
z Main Variables
Name
MC_Axis000
MC_Axis000.MFaultLvl.Active
MC_Axis000.Details.Homed
Pwr_Status
BOOL
BOOL
FALSE
FALSE
Pos1
LREAL
---
Pos2
LREAL
---
StartPg
BOOL
FALSE
InitFlag
BOOL
FALSE
Comment
This is the Axis Variable for axis 1.
TRUE while there is a minor fault level error for
axis 1.
TRUE when home is defined for axis 1.
This variable is assigned to the Status output
variable from the PWR instance of the MC_Power
instruction. This variable changes to TRUE when
the Servo is turned ON.
This variable specifies the first position of the window.
This variable specifies the last position of the window.
The Servo is turned ON if this variable is TRUE
and EtherCAT process data communications are
established.
This variable indicates if it is necessary to set the
input parameters. Input parameters are set when
this variable is FALSE. When setting the input
parameters is completed, this variable changes to
TRUE.
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#1000.0;
Vel_Dec := LREAL#1000.0;
Vel_Jrk := LREAL#1000.0;
// MC_TouchProbe parameters
T_Probe_TrigRef.Mode
:= _eMC_TRIGGER_MODE#_mcDrive;
T_Probe_TrigRef.LatchID := _eMC_TRIGGER_LATCH_ID#_mcLatch1;
T_Probe_TrigRef.InputDrive := _eMC_TRIGGER_INPUT_DRIVE#_mcEXT;
T_Probe_TrigVar
:= FALSE;
T_Probe_Wo
:= TRUE;
T_Probe_FstPos
:= LREAL#1000.0;
T_Probe_LstPos
:= LREAL#2000.0;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag:=TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo is turned ON.
// If EtherCAT communications are not normal, 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
Pwr_En:=TRUE;
NY-series Motion Control Instructions Reference Manual (W561)
3-355
3
Sample Programming
Default
--FALSE
MC_TouchProbe
Data type
_sAXIS_REF
BOOL
3 Axis Command Instructions
ELSE
Pwr_En:=FALSE;
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
// If the Servo is ON and home is not defined, the Home instruction is executed.
IF (Pwr_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm_Ex:=TRUE;
END_IF;
// After home is defined, MC_MoveVelocity is executed.
IF MC_Axis000.Details.Homed=TRUE THEN
Vel_Ex:=TRUE;
END_IF;
// After MC_MoveVelocity is executed, MC_TouchProbe is executed.
IF Vel_Act=TRUE THEN
T_Probe_Ex:= TRUE;
END_IF;
//MC_Power
PWR(
Axis
:= MC_Axis000,
Enable := Pwr_En,
Status => Pwr_Status,
Busy
=> Pwr_Bsy,
Error
=> Pwr_Err,
ErrorID => Pwr_ErrID
);
//MC_Home
HM(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Jerk
InVelocity
Busy
3-356
:= MC_Axis000,
:= Hm_Ex,
=> Hm_D,
=> Hm_Bsy,
=> Hm_Ca,
=> Hm_Err,
=> Hm_ErrID
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Jrk,
=> Vel_InVel,
=> Vel_Bsy,
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Active
CommandAborted
Error
ErrorID
:= MC_Axis000,
:= T_Probe_TrigRef,
:= T_Probe_TrigVar,
:= T_Probe_Ex,
:= T_Probe_Wo,
:= T_Probe_FstPos,
:= T_Probe_LstPos,
=> T_Probe_D,
=> T_Probe_Bsy,
=> T_Probe_RecPos,
=> T_Probe_Ca,
=> T_Probe_Err,
=> T_Probe_ErrID
3
Sample Programming
NY-series Motion Control Instructions Reference Manual (W561)
MC_TouchProbe
);
//MC_TouchProbe
T_PROBE(
Axis
TriggerInput
TriggerVariable
Execute
WindowOnly
FirstPosition
LastPosition
Done
Busy
RecordedPosition
CommandAborted
Error
ErrorID
);
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
3-357
3 Axis Command Instructions
MC_AbortTrigger
The MC_AbortTrigger instruction aborts a current latch operation.
Instruction
Name
MC_AbortTrigger
Disable
External
Latch
FB/FUN
FB
Graphic expression
ST expression
MC_AbortTrigger_instance
MC_AbortTrigger_instance (
Axis :=parameter,
TriggerInput :=parameter,
Execute :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_AbortTrigger
Axis
TriggerInput
Execute
Axis
TriggerInput
Done
Busy
CommandAborted
Error
ErrorID
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
Valid range
BOOL
TRUE or FALSE
Default
FALSE
Description
The instruction is executed
when Execute changes to
TRUE.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Instruction
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-358
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
• When latching is stopped.
• When this instruction is executed for a
latch that is not in execution and processing ends.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was
executed with the Buffer Mode set to
Aborting.
• When this instruction is canceled due to
an error.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution of
or input parameters for the instruction.
When the error is cleared.
MC_AbortTrigger
Done
3
Variables
In-Out Variables
Name
Meaning
Data type
Valid range
Description
Axis
Axis
_sAXIS_REF
---
Specify the target axis for latching.*1
TriggerInput
Trigger
Selection
_sTRIGGER_REF
---
Use this variable to select the trigger condition.*2
Refer to the following table for _sTRIGGER_REF.
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Create a user-defined variable with a data type of _sTRIGGER_REF.
z _sTRIGGER_REF
Name
Mode
Meaning
Mode
Data type
_eMC_TRIGGER_
MODE
Valid range
Function
0: _mcDrive
Specify the trigger mode.
1: _mcController
0: Drive Mode
1: Controller Mode
LatchID
Latch ID
Selection
_eMC_TRIGGER_
LATCH_ID
0: _mcLatch1
1: _mcLatch2
Specify which of the two latch
functions to use in Drive Mode.
0: Latch 1
1: Latch 2
InputDrive
Trigger Input
Signal
_eMC_TRIGGER_
INPUT_DRIVE
0: _mcEncoderMark
1: _mcEXT
Specify the Servo Drive trigger
signal to use in Drive Mode.
0: Z-phase signal
1: External input
NY-series Motion Control Instructions Reference Manual (W561)
3-359
3 Axis Command Instructions
Function
• The MC_AbortTrigger cancels a latch operation.
• You can specify the latch operation to abort by specifying the Axis and LatchID for the MC_AbortTrigger (Disable External Latch) instruction.
• If you execute MC_AbortTrigger (Disable External Latch) for a trigger for which there is no latch
request, MC_AbortTrigger does nothing and ends normally. This is the same when MC_AbortTrigger
(Enable External Latch) is executed for a MC_TouchProbe instruction for which Done is TRUE.
Precautions for Correct Use
• If the MC_GroupEnable (Enable Axes Group) instruction was executed for the Axis that is
specified for the MC_AbortTrigger (Disable External Latch) instruction, an error occurs for the
MC_AbortTrigger instruction and it is not executed.
• An error occurs for this instruction if the MC_AbortTrigger (Disable External Latch) instruction
is executed during execution of the MC_Home, MC_HomeWithParameter, MC_MoveFeed
(Interrupt Feeding), or MC_MoveLink (Synchronous Positioning) instruction.
3-360
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
• Done for the MC_AbortTrigger (Disable External Latch) instruction changes to TRUE one period after
Execute changes to TRUE.
MC_TouchProbe
TriggerInput
MC_AbortTrigger
Execute
Done
Busy
Command Aborted
3
Error
ErrorID
16#0000
Function
MC_AbortTrigger
Execute
Done
Busy
Command Aborted
Error
ErrorID
16#0000
Re-execution of Motion Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
NY-series Motion Control Instructions Reference Manual (W561)
3-361
3 Axis Command Instructions
Errors
If an error occurs during execution of the MC_AbortTrigger (Disable) instruction. Error will change to
TRUE. You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
MC_AbortTrigger
Execute
Done
Busy
Command Aborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-362
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_AxesObserve
The MC_AxesObserve instruction monitors the deviation between the command position or feedback
position for the specified axis to see if it exceeds the allowed value.
Name
MC_AxesObserve
Monitor Axis
Following
Error
FB/
FUN
FB
ST expression
MC_AxesObserve_instance
MC_AxesObserve_instance (
Master :=parameter,
Slave :=parameter,
Enable :=parameter,
ReferenceType :=parameter,
PermittedDeviation :=parameter,
Enabled =>parameter,
Invalid =>parameter,
Busy =>parameter,
DeviatedValue =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_AxesObserve
Master
Master
Slave
Slave
Enable
Enabled
ReferenceType
Invalid
Busy
PermittedDeviation
DeviatedValue
Error
ErrorID
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Enable
Enable
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Enable is TRUE.
ReferenceType
Position Type
Selection
_eMC_ RERERENCE_TYPE
0: _mcCommand
0*1
Specify the position type.
0: Command position (value
calculated in the previous
task period*2)
1: _mcFeedback
1: Actual position (value
obtained in the same task
period*2)
Permitted
Deviation
Permitted
Following
Error
LREAL
Non-negative number
0
Specify the permitted maximum value of the following
error between the master
and slave axes. The unit is
command units.*3
*1 The default value for an enumeration variable is actually not the number, but the enumerator.
*2 The task period is the primary period if the task is the primary periodic task and the task period of the priority-5 periodic
task if the task is the priority-5 periodic task.
*3 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
NY-series Motion Control Instructions Reference Manual (W561)
3-363
3
Variables
Graphic expression
MC_AxesObserve
Instruction
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Enabled
Enable
BOOL
TRUE or FALSE TRUE when the axis is being controlled.
Invalid
Excessive
Following
Error between
Axes
BOOL
TRUE or FALSE TRUE when the permitted following error between
axes is exceeded.
Busy
Executing
BOOL
TRUE or FALSE TRUE when the instruction is acknowledged.
DeviatedValue
Following
Error between
Axes
LREAL
Negative number, positive
number, or 0
Error
Error
BOOL
TRUE or FALSE TRUE while there is an error.
ErrorID
Error Code
WORD
*2
Contains the difference between the specified master
and slave axes. The unit is command units.*1
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Enabled
When Enable changes to TRUE.
• When Error changes to TRUE.
• When Enable changes to FALSE.
Invalid
When the permitted following error
between axes is exceeded.
• When Error changes to TRUE.
• When Enable changes to FALSE.
• When the permitted following error between axes is
not exceeded.
Busy
When Enable changes to TRUE.
• When Error changes to TRUE.
• When Enable changes to FALSE.
DeviatedValue*
When Enable is TRUE.
---
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
* DeviatedValue does not return to FALSE when Enable changes to FALSE.
In-Out Variables
Meaning
Data type
Master
Name
Master Axis
_sAXIS_REF
---
Valid range
Description
Specify the master axis.*
Slave
Slave Axis
_sAXIS_REF
---
Specify the slave axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Precautions for Correct Use
Assign the master axis and slave axis to the same task. If you specify an axis that is in a different
task as the master axis, an Illegal Master Axis Specification error (error code 5462 hex) occurs.
3-364
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Additional Information
You can also set axes that belong to groups.
Function
• If the command positions of the specified Master (Master Axis) and Slave (Slave Axis) or the difference between the actual positions exceeds the permitted following error, Invalid (Excessive Following
Error between Axes) changes to TRUE.
Invalid (Excessive Following Error between Axes) changes to TRUE when the following conditions
are met.
When |DeviatedValue (Following Error between Axes)| > PermittedDeviation (Permitted Following
Error)
MC_AxesObserve
• The operation of the axis is not affected by this instruction.
3
• Use the state of the Invalid (Excessive Following Error between Axes) output variable to program processes, such as stopping an axis.
Function
Position
Master axis
Slave axis
Monitors whether the difference
between master and slave axes
exceeds a specified value.
0
Time
Precautions for Correct Use
• Use the same Count Mode for the Master (Master Axis) and Slave (Slave Axis).
If a different mode is set, the axes will be compared in Linear Mode.
Even if both axes are in Rotary Mode, comparisons are made in Linear Mode if the ranges set
for the ring counters are not the same.
• If PermittedDeviation (Permitted Following Error) contains a non-terminating decimal number,
e.g., resulting from division, error may cause unexpected processing results.
• With an NX-series CPU Unit, assign Master (Master Axis) and Slave (Slave Axis) to the same
task. If you assign them to different tasks, an Illegal Master Axis Specification error (error code
5462 hex) occurs for Slave (Slave Axis).
• This function is not effective for monitoring an NX-series Pulse Output Unit because the command position equals the actual current position.
Instruction Details
This section describes the instruction in detail.
z ReferenceType (Position Type Selection)
Any of the following position types can be selected for the master axis to which the slave axis is synchronized.
NY-series Motion Control Instructions Reference Manual (W561)
3-365
3 Axis Command Instructions
• _mcCommand: Command position (value calculated in the previous task period)
The master axis command position that was calculated in the previous task period is used for the
current period.
The command value that was calculated for the master axis in the last periodic task is used to calculate the command position of the slave axis in the current period.
• _mcFeedback: Value obtained in the same task period
The actual position of the master axis that was obtained in the same task period is used.
Precautions for Correct Use
Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task. In the same way, the
periodic task is the primary periodic task or the priority-5 periodic task.
z Relationship between Axis Types and Position Types
The relationship between the axis types that you can monitor and position types that is monitored is
shown below.
Axis type
ReferenceType
_mcCommand
_mcFeedback
Servo axis
OK
OK
Encoder axis
No*
OK
Virtual servo axes
OK
OK
Virtual encoder axis
No*
OK
* A Position Type Selection Out of Range error (error code: 5430 hex) occurs when the instruction is executed.
z Calculation Examples for DeviatedValue (Following Error between Axes)
The DeviatedValue (Following Error between Axes) is calculated as described below.
Linear Mode
ReferenceType (Position Type Selection) Set to _mcCommand
DeviatedValue (Following Error between Axes) = Command current position of Master (Master Axis)
− Command current position of Slave (Slave Axis)
ReferenceType (Position Type Selection) Set to _mcFeedback
DeviatedValue (Following Error between Axes) = Actual current position of Master (Master Axis) −
Actual current position of Slave (Slave Axis)
Rotary Mode
ReferenceType (Position Type Selection) Set to _mcCommand
The DeviatedValue (Following Error between Axes) is the shorter distance between the command
current position of the Master (Master Axis) and the command current position of the Slave (Slave
Axis) in the range of the ring counter. The sign of the DeviatedValue (Following Error between Axes)
is the sign for the shorter direction, as given below.
• If the command current position of the Master (Master Axis) is greater than or equal to the command current position of the Slave (Slave Axis), the value is positive.
• If the command current position of the Master (Master Axis) is less than the command current
position of the Slave (Slave Axis), the value is negative.
3-366
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
ReferenceType (Position Type Selection) Set to _mcFeedback
The DeviatedValue (Following Error between Axes) is the shorter distance between the actual current position of the Master (Master Axis) and the actual current position of the Slave (Slave Axis) in
the range of the ring counter. The sign of the DeviatedValue (Following Error between Axes) is the
sign for the shorter direction, as given below.
• If the actual current position of the Master (Master Axis) is greater than or equal to the actual current position of the Slave (Slave Axis), the value is positive.
DeviatedValue (Following Error between Axes) Calculation Example in Rotary Mode when ReferenceType (Position Type Selection) Is Set to _mcCommand
Modulo maximum position
setting value: 100
MC_AxesObserve
• If the actual current position of the Master (Master Axis) is less than the actual current position of
the Slave (Slave Axis), the value is negative.
Master command current position: 50
3
Function
Slave command current position: −20
0
Slave command current position: −20
Modulo minimum position
setting value: −70
70
100
|DeviatedValue| is 70 (because 70 is less than 100).
The sign is positive because the command current position of
the Master is greater than or equal to the command current
position of the Slave, so the DeviatedValue is +70.
If ReferenceType (Position Type Selection) is _mcFeedback in Rotary Mode, the “command current
position” in the above diagram would be the “actual current position.”
Timing Charts
An error for this instruction does not affect the operation of the axis or axes group. A timing chart is
given below for when PermittedDeviation (Permitted Following Error) is 10.0.
Enable
Enabled
Invalid
Busy
Error
Error ID
Deviated Value
0
0
0
0 10 12 -2 3
5 21 20 0
0
0
0
0
0
0
Master axis
command position
20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52
Slave axis
command position
21 20 24 16 16 32 29 29 15 18 40 42 23 25 28 30 31
NY-series Motion Control Instructions Reference Manual (W561)
3-367
3 Axis Command Instructions
Re-execution of Motion Instructions
You cannot re-execute enable-type motion instructions.
Multi-execution of Motion Instructions
There are no restrictions for multi-execution of instructions.
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Errors
• If an error occurs during instruction execution, Error will change to TRUE.
• You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
• Error information for this instruction is output to Minor Fault in the MC Common motion variable.
Enable
Enabled
InValid
Busy
Error
ErrorID
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-368
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SyncMoveVelocity
The MC_SyncMoveVelocity instruction outputs the value set for the target velocity every task period to
the Servo Drive in Cyclic Synchronous Velocity Mode.
• You cannot use this instruction for an NX-series Pulse Output Unit.
• Here, the task period is the primary period if the task is the primary periodic task and the task
period of the priority-5 periodic task if the task is the priority-5 periodic task.
Instruction
FB/
FUN
Name
FB
MC_SyncMoveVelocity_instance
MC_SyncMoveVelocity
Axis
Axis
Execute
InVelocity
Busy
Velocity
CmdPosMode
Active
CommandAborted
BufferMode
Error
ErrorID
3
ST expression
MC_SyncMoveVelocity_
instance (
Axis :=parameter,
Execute :=parameter,
Velocity :=parameter,
CmdPosMode :=parameter,
BufferMode :=parameter,
InVelocity =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when
Execute changes to TRUE.
Velocity
Target Velocity
LREAL
Negative number,
positive number, or 0
0
Set the target velocity.
0: Set the velocity command value
to 0.
Positive value: Move in the positive direction.
Negative value: Move in the negative direction.
The unit is command units/s.*1
CmdPosMode
Command
Current Position Count
Selection
_eMC_CMDPOS_
MODE
0: _mcCount
NY-series Motion Control Instructions Reference Manual (W561)
0*2
0: Use the actual current position
and update the command current
position.
Home remains defined.
3-369
Variables
MC_SyncMoveVelocity Cyclic
Synchronous
Velocity
Control
Graphic expression
MC_SyncMoveVelocity
Precautions for Correct Use
3 Axis Command Instructions
Name
Meaning
BufferMode
Buffer Mode
Selection
Data type
Valid range
_eMC_BUFFER_ 0: _mcAborting
MODE
1: _mcBuffered
Default
0*2
Description
Specify the behavior when executing more than one motion instruction.
0: Aborting
1: Buffered
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
InVelocity
Target Velocity Reached
BOOL
TRUE or
FALSE
TRUE when the command velocity reaches the target
velocity.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when control is in progress.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-370
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the target velocity is reached.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Busy
When Execute changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the instruction is started.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is canceled due to
another instruction.
• When this instruction is canceled due to
an error in another instruction.
• When this instruction is executed while
there is an axis error.
• When you start this instruction during
MC_Stop instruction execution.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
Error
MC_SyncMoveVelocity
InVelocity
3
Function
In-Out Variables
Name
Meaning
Axis
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_SyncMoveVelocity instruction outputs the target velocity from the user program every task
period to the Servo Drive in Cyclic Synchronous Velocity (CSV) Control Mode.
• When Execute changes to TRUE, the Control Mode of the Servo Drive is changed and a command
velocity is output.
• If this instruction is executed in the primary periodic task or a priority-5 periodic task, the target velocity is reached in the next task period.
The following timing charts show an example of the operation for when this instruction is executed in
the primary periodic task. The same information applies when it is used in a priority-5 periodic task.
MC_SyncMoveVelocity Programmed in Primary Periodic Task
Velocity
Command
velocity
Target velocity (black dots)
specified with the input
Command
velocity
Servo
Drive
M
E
Primary period
Time
• If this instruction is executed in the priority-16 periodic task, the target velocity is reached in the next
task period.
NY-series Motion Control Instructions Reference Manual (W561)
3-371
3 Axis Command Instructions
MC_SyncMoveVelocity Programmed in Priority-16 Periodic Task
Velocity
Target velocity (black dots)
specified with the input
Command
Command
velocity
velocity
Servo
Drive
M
E
Primary period
Time
Task period
Precautions for Correct Use
Refer to Precautions for Master and Auxiliary Axes in Synchronized Control on page 1-6 for precautions on using this instruction for the master axis of synchronized control.
Additional Information
The MC_SetOverride (Set Override Factors) instruction is not effective for the MC_SyncMoveVelocity (Cyclic Synchronous Velocity Control) instruction.
z Mapping Data Objects
To use the MC_SyncMoveVelocity (Cyclic Synchronous Velocity Control) instruction, map the following object data in the Detailed Settings Area of the Axis Basic Settings Display of the Sysmac Studio.
• Target velocity (60FF hex)
• Modes of operation (6060 hex)
• Modes of operation display (6061 hex)
If even one of the required objects is not set, a Process Data Object Setting Missing error (error
code 3461 hex) occurs.
For details on mapping data objects, refer to 2-3 PDO Mapping and to the NJ/NX-series CPU Unit
Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC
Motion Control User’s Manual (Cat. No. W559).
Instruction Details
This section describes the instruction in detail.
z Velocity (Target Velocity)
The Velocity (Target Velocity) input variable can be set to LREAL data in reference to 0.
The axis moves in the positive direction for a positive value and in the negative direction for a negative value.
If 0 is set, the command velocity is 0 and Status.Continuous (Continuous Motion) remains TRUE.
You can set Velocity (Target Velocity) from the user program every period.
If the specified target velocity is different from the last period, the new target velocity is used. If the
specified target velocity is the same as the last period, the previous target velocity is used.
Precautions for Correct Use
• When you set the target velocity, make sure that an excessive load is not placed on the
mechanical composition of the system for the change in velocity.
3-372
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
• If the axis that you use in this instruction is the master axis for synchronized control, setting the
target velocity of the master axis may cause the slave axis to move suddenly.
• When the Control Mode is changed, the command current position may change suddenly.
z Command Current Position
Command
current position
Servo Drive CSP
reference position
3
CSV
Function
Actual current
position is used.
CSP
MC_SyncMoveVelocity
If you select _mcCount for the CmdPosMode (Command Current Position Count Selection) input
variable, the command current position will be the actual current position from the previous period
when this instruction is executed. The actual current position is used until the instruction is ended.
While the OMRON 1S-series Servo Drive or G5-series Servo Drive is processing the switch to CSP
Mode, the CSP reference position that was mapped in advance is sent in the PDO. Until processing
to switch from CSV to CSP Mode is completed, this reference position is used as the command current position. When switching to CSP Mode is completed, the command current position is set to the
command position.
Changing
the Control
Mode
CSP
Time
z When Using an OMRON 1S-series Servo Drive
To use the CSP reference position of the Servo Drive when changing the Control Mode, map the
CSP Reference Position (3010-87 hex) to process data.
Map the CSP Reference Position (3010-87 hex) to process data in the PDO Edit Tab Page of the
Sysmac Studio. Then map the CSP Change Reference Position in the MC Function Module and the
CSP Reference Position (3010-87 hex) in the Detailed Settings Area of the Axis Basic Settings Display.
z When Using an OMRON G5-series Servo Drive
To use the CSP reference position of the Servo Drive when changing the Control Mode, map the
CSP Reference Position (4020 hex) to process data. Map the CSP Reference Position (4020 hex) to
process data in the PDO Edit Tab Page of the Sysmac Studio. Then map the CSP Change Reference Position in the MC Function Model and the CSP Reference Position (4020 hex) in the Detailed
Settings Area of the Axis Basic Settings Display.
Precautions for Correct Use
If the CSP Reference Position (4020 hex) is mapped to a PDO, set the primary period or the task
period of the priority-5 periodic task to 1 ms or longer. If the primary period or task period is less
than 1 ms, an error will occur in the G5-series Servo Drive. Refer to the AC Servomotors/Servo
Drives G5-series with Built-in EtherCAT Communications User’s Manual (Cat. No. I576) for
details.
NY-series Motion Control Instructions Reference Manual (W561)
3-373
3 Axis Command Instructions
Additional Information
Of the OMRON G5-series Servo Drives, those for Linear Motors do not support the CSP Reference Position (4020 hex).
z When Using a Servo Drive Other Than an OMRON 1S-series Servo Drive or
G5-series Servo Drive
An error may occur in processing to switch the Control Mode for some Servo Drives when this
instruction is executed or when an instruction that uses CSP Mode is executed during execution of
this instruction.
If that occurs, stop the axis (velocity of 0) and then execute this instruction or use multi-execution of
instructions that use the CSP Mode.
z When Using NX-series Position Interface Units
You cannot use this instruction for NX-series Position Interface Units.
z Stop Processing
The Control Mode and command velocities that are used to stop axis motion are described below.
For a deceleration stop, the target velocity of this instruction is used as the initial velocity and the
axis is decelerated to a stop with the deceleration rate for the specified Stop Mode.
Stopping with the MC_ImmediateStop Instruction
The command velocity is changed to 0. The Control Mode is changed to CSP Mode when the
change criterion that is given below is satisfied.
Stopping with the MC_Stop Instruction
The command velocity is changed to 0 at the deceleration rate of the instruction. The Control Mode
is changed to CSP Mode when the change criterion that is given below is satisfied.
Stopping for a Minor Fault Level Error
The command velocity is changed to 0 at the deceleration rate of each error. The Control Mode is
changed to CSP Mode when the change criterion that is given below is satisfied.
Stopping for a Major Fault Level Error or a Partial Fault Level Error
The command velocity is changed to 0. The Control Mode is changed to CSP Mode when the
change criterion that is given below is satisfied.
However, depending on the error level, it may not be possible to switch the Control Mode normally,
and the axis may stop in CSV Mode.
Stopping by Turning OFF the Servo
The command velocity is changed to 0 with the specified method. The Control Mode is not changed.
Stopping When the Operating Mode of the CPU Unit Changes to PROGRAM
Mode
The command velocity is changed to 0 with the specified method. The Control Mode is changed to
CSP Mode when the change criterion that is given below is satisfied.
3-374
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Change Criterion
Whether it is possible to change the Control Mode depends on Servo Drive specifications.
To ensure that the Control Mode is switched to CSP Mode during stop processing for stop instructions or errors, it is necessary to sufficiently decelerate the Servomotor first.
The Control Mode is changed to CSP Mode when the following criterion is met for three consecutive
periodic tasks after the command velocity changes to 0.
MC_SyncMoveVelocity
Actual current velocity ≤ Maximum velocity × 0.1
Precautions for Correct Use
Here, the periodic task is the primary periodic task or the priority-5 periodic task.
z Recovery to Cyclic Synchronous Position (CSP) Control Mode
z Operation for Failure to Switch Control Mode
If the Servo Drive does not complete switching the Control Mode within 1 second after a Control
Mode switch command is sent to the Servo Drive, a Error in Changing Servo Drive Control Mode
(error code: 7439 hex) occurs.
Also, if the switching criterion is not met within 10 seconds after the command velocity is changed to
0 for a Control Mode switching command to the Servo Drive, an Error in Changing Servo Drive Control Mode (error code: 7439 hex) occurs.
When an Error in Changing Servo Drive Control Mode (error code: 7439 hex) occurs, the command
velocity is changed to 0 and the Servo is turned OFF (free-run stop).
For details on the Error in Changing Servo Drive Control Mode (error code: 7439 hex), refer to the
NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel
PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Applicable Axes and Execution Condition
• You can use this instruction for a servo axis.
To use this instruction, change Enable for the MC_Power instruction to TRUE (Servo ON).
• A virtual servo axis will acknowledge this instruction at any time.
However, processing to switch the Control Mode of the Servo Drive is not performed.
• An error occurs if the instruction is executed for an encoder or virtual encoder axis.
z Axis Variable Status
Status.Continuous (Continuous Motion) in the Axis Variable status changes to TRUE.
Use DrvStatus (Servo Drive Status) in the Axis Variable to check the Control Mode that is set in the
Servo Drive. The Servo Drive status is given in the following table.
Name
CSP
Data type
BOOL
CSV
BOOL
CST
BOOL
Meaning
Cyclic Synchronous Position (CSP) Control Mode
Cyclic Synchronous Velocity (CSV) Control Mode
Cyclic Synchronous Torque (CST) Control
Mode
NY-series Motion Control Instructions Reference Manual (W561)
Description
TRUE when the Servo is ON and the
Servo Drive is in CSP Mode.
TRUE when the Servo is ON and the
Servo Drive is in CSV Mode.
TRUE when the Servo is ON and the
Servo Drive is in CST Mode.
3-375
3
Function
It is not always possible to normally change to CSP Mode for a stop.
For example, it may not be possible when a partial fault level error occurs in the MC Function Module.
Therefore, processing to change to CSP Mode is performed when the Status output variable from
the MC_Power (Power Servo) instruction changes to FALSE.
3 Axis Command Instructions
z Home Status
If CmdPosMode (Command Current Position Count Selection) is set to _mcCount, the home will
remain defined.
z Overrides
Overrides are disabled for this instruction.
z Software Limits
Software limits are enabled for this instruction. These are enabled even for the following axis parameter settings.
• Deceleration stopping enabled for command position
• Immediate stopping enabled for command position (stop using remaining pulses)
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• InVelocity (Target Velocity Reached) changes to TRUE when the command velocity reaches Velocity
(Target Velocity).
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing), Active (Controlling), and InVelocity (Target Velocity Reached) change to FALSE.
• The MC_Stop instruction is used to stop this instruction.
The following timing charts show operation for when this instruction is used in the primary periodic task.
3-376
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SyncMoveVelocity Instruction
Execute
InVelocity
Busy
MC_SyncMoveVelocity
Active
CommandAborted
Error
ErrorID
16#0000
3
MC_Stop Instruction
Execute
Function
Done
Busy
Active
Velocity
Decelerates to a
stop when MC_Stop
is executed.
Target velocity
Time
Target velocity is The target
changed each
velocity does
primary period.
not change.
Control Mode
CSP
CSV
Switched.
CSP
Switched.
CSV
Switched.
Additional Information
The MC Function Module sends a command to the Servo Drive to change the Control Mode as
shown in the above timing chart. The timing of implementing the change in the Servo Drive
depends on Servo Drive specifications.
NY-series Motion Control Instructions Reference Manual (W561)
3-377
3 Axis Command Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can execute this instruction with BufferMode (Buffer Mode Selection) set to Aborting or Buffered
during execution of other instructions in the same as for the MC_MoveVelocity (Velocity Control)
instruction.
The Control Mode is switched when processing the instruction is started.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
You can execute other instructions with BufferMode (Buffer Mode Selection) set to Aborting or Buffered during execution of this instruction in the same as for the MC_MoveVelocity (Velocity Control)
instruction.
If the other instruction is buffered, then it is executed when InVelocity (Target Velocity Reached)
changes to TRUE.
The Control Mode is switched when processing the instruction is started.
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axis will stop.
You can find out the cause of the error by referring to the value output to ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-378
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SyncMoveAbsolute
The MC_SyncMoveAbsolute instruction cyclically outputs the specified target position for the axis.
Name
MC_SyncMove
Absolute
Cyclic Synchronous
Absolute
Positioning
FB/
FUN
FB
Graphic expression
ST expression
MC_SyncMoveAbsolute_instance
MC_SyncMoveAbsolute
Axis
Axis
Execute
InPosition
Busy
Position
Direction
Active
CommandAborted
BufferMode
Error
ErrorID
Version Information
A CPU Unit with unit version 1.03 or later and Sysmac Studio version 1.04 or higher are required
to use this instruction.
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
BOOL
Valid range
TRUE or FALSE
Position
Target
Position
LREAL
Negative number, positive number, or 0
Direction
_eMC_DIRECTION
Direction
Default
Description
FALSE The instruction is executed when
Execute changes to TRUE.
0
Specify the absolute target position.
2: _mcNegativeDirection
The unit is command units.*1
Specify the direction of rotation
when the Count Mode is Rotary
Mode.*3
3: _mcCurrentDirection
0: Positive direction
4: _mcNoDirection
1: Shortest way
0: _mcPositiveDirection
1 *2
1: _mcShortestWay
2: Negative direction
3: Current direction
BufferMode
Buffer
Mode
Selection*2
_eMC_BUFFER_MODE
0: _mcAborting
0 *3
4: No direction specified
Specify the behavior when executing
more than one motion instruction.
0: Aborting
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control Use’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
*3 Refer to Direction for the MC_MoveAbsolute instruction (page 3-49) for how to specify the direction of rotation.
NY-series Motion Control Instructions Reference Manual (W561)
3-379
3
Variables
MC_SyncMoveAbsolute_instance (
Axis :=parameter,
Execute :=parameter,
Position :=parameter,
Direction :=parameter,
BufferMode :=parameter,
InPosition =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_SyncMoveAbsolute
Instruction
3 Axis Command Instructions
Output Variables
Name
InPosition
Meaning
In Position
Data type
Valid range
Description
BOOL
TRUE or FALSE TRUE when the actual current position is within
the in-position range of the target position.
Busy
Active
CommandAborted
Error
ErrorID
Executing
Controlling
Instruction
Aborted
Error
Error Code
BOOL
BOOL
BOOL
TRUE or FALSE TRUE when the instruction is acknowledged.
TRUE or FALSE TRUE when control is in progress.
TRUE or FALSE TRUE when the instruction is aborted.
BOOL
WORD
TRUE or FALSE TRUE while there is an error.
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
InPosition
Timing for changing to TRUE
When the actual current position is within the inposition range of the target position.
Busy
When Execute changes to TRUE.
Active
When the instruction is started.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error in another instruction.
• When this instruction is executed while there is
an axis error.
• When you start this instruction during MC_Stop
instruction execution.
When there is an error in the execution conditions
or input parameters for the instruction.
Error
Timing for changing to FALSE
• When an actual current position is outside of
the in-position range.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid
range
---
Description
Specify the axis. *
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
3-380
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Function
• The MC_GroupSyncMoveAbsolute instruction outputs the target position from the user program
every task period to the Servo Drive or other device in Cyclic Synchronous Position (CSP) Control
Mode. The target position is given as an absolute position.
• If this instruction is executed in the primary periodic task or priority-5 periodic task, the target position
that is specified in the input parameters is output to the Servo Drive in the next task period.
The following timing charts show an example of the operation for when this instruction is executed in
the primary periodic task. The same information applies when it is used in a priority-5 periodic task.
MC_SyncMoveAbsolute Executed in Primary Periodic Task
Position
Target positions (black
dots) specified with the
input parameters
Command
position
Command
position
Servo
Drive
3
M
Function
E
Primary period
Time
• If this instruction is executed in the priority-16 periodic task, the target position that is specified in the
input parameters is output to the Servo Drive in the next periodic task.
MC_SyncMoveAbsolute Executed in Priority-16 Periodic Task
Position
Target positions (black
dots) specified with
the input parameters
Command Command
position
position
Servo
Drive
M
E
Primary period
Time
Task period
Precautions for Correct Use
Specify the target position so that the travel distance to the target position does not cause the
velocity to exceed the value that is specified in the Maximum Velocity axis parameter. If a target
position is specified that cause the maximum velocity to be exceeded, the command velocity will
become saturated and the travel distance will be output so that the maximum velocity is not
exceeded. If this occurs, any insufficient travel distance to the target position is output in the next
period or later. Details.VelLimit (Command Velocity Saturation) in the axis control status changes
to TRUE at this time.
Instruction Details
This section describes the instruction in detail.
z In-position Check
If Position (Target Position) is not changed, InPosition changes to TRUE when the difference between
the target position and the actual position is within the range that is set for the In-position Range axis
parameter.
NY-series Motion Control Instructions Reference Manual (W561)
MC_SyncMoveAbsolute
• The upper limit of the velocity is the value that is set in the Maximum Velocity axis parameter. The
maximum acceleration and deceleration rates are not used.
3-381
3 Axis Command Instructions
Even if the target position is changed while InPosition is TRUE, it will remain TRUE for the remainder of
the period and change to FALSE the next period.
The setting of the In-position Check Time axis parameter is disabled.
z Stop Processing
This section describes the methods that are used to stop axis operations.
Use the MC_Stop or MC_ImmediateStop instruction to stop operation. If one of these instructions is
executed, CommandAborted for this instruction will change to TRUE.
Stopping with the MC_Stop Instruction
An immediate stop is performed.
Stopping with the MC_ImmediateStop Instruction
An immediate stop is performed according to the setting of the Immediate Stop Input Stop Method
axis parameter.
z Stopping Due to Errors
If an error that causes the axes to stop occurs, an immediate stop is performed regardless of any
settings.
z Applicable Axes
• You can use this instruction for a servo axis.
To use this instruction, change Enable for the MC_Power instruction to TRUE (Servo ON).
• A virtual servo axis will acknowledge this instruction at any time.
• An error occurs if the instruction is executed for an encoder or virtual encoder axis.
z Axis Variable Status
Status.Discrete (Discrete Motion) in the axis status in the Axis Variable changes to TRUE.
The Axis Control Status is not affected.
z Overrides
Overrides are disabled for this instruction.
z Changing the Actual Position
When the actual position is changed with the MC_SetPosition instruction, the travel distance from the
new actual position to the target position that is specified for Position (Target Position) is output. If InPosition is TRUE before the actual position is changed, it will change to FALSE the next period after it is
changed.
3-382
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
• Busy (Executing) changes to TRUE at the same time as Execute changes to TRUE. Active (Controlling) changes to TRUE in the next period.
• If another instruction aborts this instruction, CommandAborted changes to TRUE and Busy (Executing), Active (Controlling), and InPosition change to FALSE.
• The MC_Stop instruction is used to stop this instruction.
The following timing charts show operation for when this instruction is executed in the primary periodic
task.
MC_SyncMoveAbsolute instruction
Execute
Position
MC_SyncMoveAbsolute
• InPosition changes to TRUE when the actual current position is within the in-position range from
Position (Target Position).
3
20 30 40 50 60
40
Function
InPosition
Busy
Active
CommandAborted
Error
ErrorID
16#0000
MC_Stop Instruction
Execute
Busy
Active
Done
Command position
60
50
40
30
20
0
Time
Additional Information
The MC Function Module sends a command to the Servo Drive to change the Control Mode as
shown in the above timing chart. The timing of implementing the change in the Servo Drive
depends on Servo Drive specifications.
NY-series Motion Control Instructions Reference Manual (W561)
3-383
3 Axis Command Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Control Instructions
For details on multi-execution of instructions, refer to the NJ/NX-series CPU Unit Motion Control User’s
Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s
Manual (Cat. No. W559).
z Execution during Execution of Other Instructions
You can switch to this instruction or buffer this instruction if you execute it during execution of another
instruction.
You can buffer one instruction per axis.
Specify the operation of this instruction using BufferMode (Buffer Mode Selection) for multi-execution of
instructions.
Buffer Mode Selection
Aborting
Description
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion will be
reversed according to the Operation Selection at Reversing axis parameter.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control
User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control
User’s Manual (Cat. No. W559).
z Execution of Other Instructions during Instruction Execution
If you execute another instruction during execution of this instruction, you can specify only aborting.
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axes will stop.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
3-384
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Timing Chart When Error Occurs
Execute
InPosition
Busy
MC_SyncMoveAbsolute
Active
CommandAborted
Error
ErrorID
16#0000
Error code
z Error Codes
3
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
Function
NY-series Motion Control Instructions Reference Manual (W561)
3-385
3 Axis Command Instructions
MC_Reset
The MC_Reset instruction clears axis errors.
Instruction
MC_Reset
Name
FB/FUN
Reset Axis
Error
Graphic expression
FB
ST expression
MC_Reset_instance (
Axis :=parameter,
Execute :=parameter,
Done =>parameter,
Busy =>parameter,
Failure =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_Reset_instance
MC_Reset
Axis
Execute
Axis
Done
Busy
Failure
Error
ErrorID
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
Valid range
BOOL
TRUE or FALSE
Default
FALSE
Description
The instruction is executed
when Execute changes to
TRUE.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Failure
Failure End
BOOL
TRUE or
FALSE
TRUE when the instruction is not executed normally.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3-386
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When error clear processing is completed
normally.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When Failure changes to TRUE.
Failure
• When an error reset is executed while
decelerating an axis to a stop for an
error.
• When an error reset is executed during
an axis error for an axis common error.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
MC_Reset
Done
3
Name
Axis
Meaning
Axis
Function
In-Out Variables
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• The MC_Reset instruction starts error clear processing for the axis specified by Axis when Execute
changes to TRUE. The error processing resets axis errors and, if errors have occurred in the Servo
Drive, drive errors.
• You can use this instruction for any axis type.
• Error clear processing is executed only for axes with errors.
• If there is a drive error for an axis, the drive error is cleared first. Error clear processing is then performed. Reset processing for the drive error is continued until the drive error is cleared or continues
for the Drive Error Reset Monitoring Time in the axis parameters.
• If this instruction is executed while the axis is decelerating to a stop for an error, the instruction is not
executed and Failure will change to TRUE. Failure will also change to TRUE if an axis error that
results from an MC common error cannot be cleared by this instruction. This is to ensure that the
error is not reset before the axis stops.
MC Common errors include MC Common Partial Faults and MC Common Minor Faults.
• Only errors that existed when Execute changes to TRUE are cleared. Errors that occur while clearing
errors are not cleared.
NY-series Motion Control Instructions Reference Manual (W561)
3-387
3 Axis Command Instructions
Precautions for Correct Use
• The error clear processing that is performed by this instruction sometimes requires more than
one control period.
• If an MC Common Partial Fault or MC Common Minor Fault occurs or the axis is in motion,
Failure (Failure End) from the instruction will change to TRUE. Remove the cause of the error,
and then retry the process until Done changes to TRUE.
• After you remove the cause of the error, execute the instruction only after you confirm that the
axes have stopped completely.
Act.Vel (Actual Current Velocity) in the Axis Variable is 0 if the axis is completely stopped. Use
this to confirm when the axis is completely stopped.
• If you use this instruction for an OMRON G5-series Servo Drive, perform exclusive control of
instructions so that the ResetECError (Reset EtherCAT Error) instruction is not executed at the
same time.
• If this instruction is used for an NX-series Pulse Output Unit, the error in the Servo Drive that is
connected to the Pulse Output Unit is not reset. Refer to the NX-series Position Interface Units
User’s Manual (Cat. No. W524) for details.
Additional Information
The following errors cannot be cleared with this instruction.
• All axis common errors: Execute the ResetMcError (Reset All Errors) instruction.
• All axes group errors: Execute the MC_GroupReset (Group Reset) instruction.
The causes of network errors, such as slave communications error, are not cleared by executing
MC_Reset. Execute the ResetECATError instruction.
Timing Charts
Execute
Done
Busy
Failure
Output parameters during errors
Busy
Error
ErrorID
3-388
Error code
#0000
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Aborting the Instruction
The instruction is aborted if it is not possible to clear errors that occur when the axis is decelerating to a
stop for an error or errors that occur during axis errors resulting from axis common errors.
Execute
Done
Busy
MC_Reset
Failure
Error
Output parameters during errors
3
Error
Error code
Function
ErrorID
Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-389
3 Axis Command Instructions
MC_ChangeAxisUse
The MC_ChangeAxisUse instruction temporarily changes the Axis Use axis parameter.
Instruction
Name
MC_ChangeAxisUse
FB/FUN
Change FB
Axis Use
Graphic expression
ST expression
MC_ChangeAxisUse_instance
MC_ChangeAxisUse_instance (
Axis :=parameter,
Execute :=parameter,
AxisUse :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_ChangeAxisUse
Axis
Execute
AxisUse
Axis
Done
Busy
CommandAborted
Error
ErrorID
Precautions for Correct Use
The values that are written by this instruction are not saved in non-volatile memory in the CPU
Unit. Any values that are written are lost when the power supply to the Controller is turned OFF,
when settings are downloaded, or when the MC Function Module is restarted. They return to the
values that were set from the Sysmac Studio. Use the Sysmac Studio and transfer the parameters to save them to non-volatile memory.
Additional Information
• Use the Synchronize Menu of the Sysmac Studio to download the project.
• Refer to the NJ/NX-series CPU Unit Software User’s Manual (Cat. No. W501) or NY-series
Industrial Panel PC / Industrial Box PC Software User’s Manual (Cat. No. W558) for an application example that uses this instruction.
Version Information
A CPU Unit with unit version 1.04 or later and Sysmac Studio version 1.05 or higher are required
to use this instruction.
Variables
Input Variables
Name
Meaning
Data type
Execute
Execute
BOOL
AxisUse
Axis Use
_eMC_AXIS_USE
Valid range
Default
Description
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
1: _mcUnusedAxis
1*
Specify a used axis or an
unused axis.
2: _mcUsedAxis
1: Unused axis
2: Used axis
* The default value for an enumeration variable is actually not the number, but the enumerator.
3-390
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
MC_ChangeAxisUse
Done
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
3
z Output Variable Update Timing
Timing for changing to TRUE
Function
Name
Timing for changing to FALSE
Done
When the instruction is completed.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
When this instruction is canceled due to an
error in another instruction.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid range
---
Description
Specify the axis.*
* Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default: MC_Axis***)
or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
Function
• When Execute changes to TRUE, the MC_ChangeAxisUse instruction temporarily changes the Axis
Use axis parameter to the specified setting.
• When execution of the instruction is completed, _MC_AX[*].Cfg.AxEnable (Axis Use) in the Axis Variable changes to the specified setting.
• You can change the setting only for axes that have the Axis Use axis parameter set to Unused axis
(changeable to used axis) or Used axis. You cannot change the setting of the Axis Use axis parameter to specify a used axis if that axis is set to Unused axis (unchangeable to used axis).
• You can execute this instruction when home is defined or when home is not defined. If home is
defined and the axis is changed to an unused axis, the home definition is lost.
• If you change an axis that uses an absolute encoder from a used axis to an unused axis, the absolute
encoder home offset value (which is saved to the battery-backup memory in the CPU Unit when the
power supply to the Controller is turned OFF) will be the value from just before the axis was changed
to an unused axis.
NY-series Motion Control Instructions Reference Manual (W561)
3-391
3 Axis Command Instructions
Precautions for Correct Use
• You cannot change an axis to a used axis if the axis number exceeds the highest axis number
that can be controlled by the CPU Unit. The number of real axes that you can change to used
axes is the maximum number of used real axes.
Item
Axis numbers of the axes you
can change to used axes
Maximum number of used real
axes
Item
Axis numbers of the axes you
can change to used axes
NX70117……
16……
0 to 255
0 to 127
256 axes
128 axes
NJ501-/NY5…2…5……
…4…
…3……
0 to 63 0 to 31 0 to 15
NJ30112……
11……
0 to
0 to
14*2
14*1
Maximum number of used real 64 axes 32 axes 16 axes 8 axes
axes
*1 The range is 0 to 7 for a CPU Unit with unit version 1.05 or earlier.
4 axes
NJ10110……
90……
0 to 5
Not
supported.
2 axes 0 axes
*2 The range is 0 to 3 for a CPU Unit with unit version 1.05 or earlier.
• Either _MC_AX[*].Status.Disabled (Axis Disabled) or _MC_AX[*].Status.Standstill (Standstill)
in the Axis Variable must be TRUE to execute this instruction. If both of them are FALSE, an
error will occur when you execute the instruction.
• An error will occur if you execute this instruction when _MC_AX[*].Details.VelLimit (Command
Velocity Saturation) in the Axis Variable is TRUE.
• If the Axis Use variable of an axis is set to _mcUnusedAxis (unused axis), you cannot overwrite the axis parameter settings with the MC_Write (Write MC Setting) instruction. Change
the Axis Use variable of the axis to _mcUsedAxis (used axis) before you execute the
MC_Write (Write MC Setting) instruction.
• An error occurs if you execute the MC_GroupEnable (Enable Axes Group) instruction for an
axes group that contains an axis that was changed to an unused axis with this instruction.
• If an error occurs in executing this instruction for a used axis, an axis error will occur. If an error
occurs in executing this instruction for an unused axis, an MC common error will occur.
• After you change axis usage with this instruction, make sure that the Done output variable
from this instruction is TRUE before you execute any other motion control instructions.
Additional Information
For an NX-series CPU Unit, a variable name that starts with _MC_AX[*] may start with
_MC1_AX[*] or _MC2_AX[*] instead.
3-392
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
MC_ChangeAxisUse Instruction
Execute
Done
MC_ChangeAxisUse
Busy
CommandAborted
Error
ErrorID
16#0000
Re-execution of Motion Control Instructions
3
This instruction cannot be re-executed.
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Errors
If an error occurs during instruction execution, Error will change to TRUE and the setting of the Axis
Use axis parameter will not change. You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
Done
Busy
CommandAborted
Error
ErrorID
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
Precautions for Correct Use
If an error occurs in executing this instruction for a used axis, an axis error will occur. If an error
occurs in executing this instruction for an unused axis, an MC common error will occur.
NY-series Motion Control Instructions Reference Manual (W561)
3-393
Function
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
3 Axis Command Instructions
MC_DigitalCamSwitch
The MC_DigitalCamSwitch instruction turns a digital output ON or OFF according to the axis position.
Instruction
MC_DigitalCamSwitch
Name
Enable
Digital
Cam
Switch
FB/FUN
FB
Graphic expression
MC_DigitalCamSwitch_instance
MC_DigitalCamSwitch
Axis
Axis
Switches
Switches
Outputs
Outputs
TrackOptions
TrackOptions
InOperation
Enable
EnableMask
Busy
ValueSource
Error
ErrorID
ST expression
MC_DigitalCamSwitch_instance (
Axis :=parameter,
Switches :=parameter,
Outputs :=parameter,
TrackOptions :=parameter,
Enable :=parameter,
EnableMask :=parameter,
ValueSource :=parameter,
InOperation =>parameter,
Busy =>parameter,
Error =>parameter,
ErrorID =>parameter
);
Precautions for Safe Use
• Always use the axis at a constant velocity for the MC_DigitalCamSwitch (Enable Digital Cam
Switch) instruction.
• Use the NX_AryDOutTimeStamp (Write Digital Output Array with Specified Time Stamp)
instruction only after you confirm that InOperation from the MC_DigitalCamSwitch (Enable
Digital Cam Switch) instruction is TRUE.
Precautions for Correct Use
• You can use this instruction for an axis that is assigned to an NX-series Position Interface Unit.
The applicable NX Units are as follows: NX-EC0……… and NX-ECS……….
• Always use this instruction together with the NX_AryDOutTimeStamp instruction and with a
Digital Output Unit that supports time stamp refreshing.
Version Information
A CPU Unit with unit version 1.06 or later and Sysmac Studio version 1.07 or higher are required
to use this instruction.
3-394
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Variables
Input Variables
Meaning
Enable
Data type
BOOL
Valid range
TRUE or
FALSE
Default
FALSE
EnableMask
Enable
Tracks
WORD
16#0000 to
FFFF
16#0000
Description
The instruction is executed while Enable is TRUE.
The values in Outputs will not change while Enable is
FALSE.*1
Specify whether to enable or disable each track.
There are a maximum of 16 tracks. Specify enable or
disable for track 0 with bit 00 and track 15 with bit 15.
0: Disable*2
ValueSource
(Reserved)
Input
Information
_sMC_SOURCE
---
---
1: Enable
(Reserved)
3
*2 When the value of a bit for a track number in EnableMask is 0, the elements for that track number in Outputs (Output Signals) will be OFF.
Output Variables
InOperation
Busy
Error
ErrorID
Meaning
In Operation
Executing
Error
Error Code
Data
type
BOOL
BOOL
BOOL
WORD
Valid range
TRUE or FALSE
TRUE or FALSE
TRUE or FALSE
*
Description
TRUE while there are enabled output signals.
TRUE when the instruction is acknowledged.
TRUE while there is an error.
Contains the error code when an error occurs. A
value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
InOperation
Timing for changing to TRUE
When Enable changes to TRUE.
Busy
When Enable changes to TRUE.
Error
When there is an error in the execution conditions
or input parameters for the instruction.
NY-series Motion Control Instructions Reference Manual (W561)
Timing for changing to FALSE
• When Enable changes to FALSE.
• When Error changes to TRUE.
• When Enable changes to FALSE.
• When Error changes to TRUE.
When the error is cleared.
3-395
Variables
*1 The values in Outputs (Output Signals) are retained while Enable is FALSE.
When Enable in the NX_AryDOutTimeStamp instruction is FALSE, the digital output from the Digital Output Unit goes
OFF.
Name
MC_DigitalCamSwitch
Name
Enable
3 Axis Command Instructions
In-Out Variables
Name
Meaning
Data type
Axis
Axis
_sAXIS_REF
Switches
Switches
ARRAY[0..255] OF
_sCAMSWITCH_REF*2
Outputs
Output Signals
TrackOptions Track Options
ARRAY[0..15] OF
_sOUTPUT_REF*2 *3
ARRAY[0..15] OF
_sTRACK_REF*2 *3
Valid
range
-----
---
---
Description
Specify the axis for which to access the position.*1
Specify an array variable of _sCAMSWITCH_REF
switch structures for use as switch ON/OFF pattern
data.
The array element numbers indicate the switch numbers.
Specifies an array variable of _sOUTPUT_REF output signal structures for use as the output destinations for digital ON/OFF time outputs that are
calculated based on switch ON/OFF pattern data.
The array element numbers indicate the track numbers.
You can specify this array variable as an in-out variable for a NX_AryDOutTimeStamp instruction to
actually turn ON and OFF digital outputs.
Specify an array variable of _sTRACK_REF track
option structures for use as switch operating conditions. The array element numbers indicate the track
numbers.
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 An error will occur if the first element number in the array is not 0. An error will also occur if an array with more than one
dimension is specified.
*3 An error will occur if the number of elements in Outputs and the number of elements in TrackOptions are not the same.
Function
• The MC_DigitalCamSwitch instruction outputs the times when the actual position of an axis will reach
positions that are set in Switches as the times for turning a digital output ON and OFF.
• Always use this instruction together with the NX_AryDOutTimeStamp instruction and with a Digital
Output Unit that supports time stamp refreshing.
• The NX_AryDOutTimeStamp instruction turns the specified digital output ON or OFF at the specified
time stamp. If you use time stamp refreshing, you can turn digital output signals ON and OFF at the
required time without being affected by the timing of control processing.
3-396
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
• This instruction is not sufficient to actually turn digital outputs ON and OFF.
• This instruction requires that you use an NX-series Encoder Input Unit and that time stamping
is operating.
Time stamping is not possible in the following cases.
• Object 6010 hex (Time Stamp) in the NX-series Encoder Input Unit is not assigned to a
PDO.
• The distributed clock in the EtherCAT Coupler Unit is disabled.
• An error does not occur for this instruction even if the time stamp is not updated. The ON/OFF
time will be calculated, but the result will not be the intended value.
Use this instruction only after you confirm in the MC Monitor Table or Watch Tab Page of the
Sysmac Studio that the TimeStamp member of the Axis Variable is being updated.
• Set the values of the FirstOnPosition, LastOnPosition, and Duration in the switch structure
variable so that the ON/OFF range of the digital output is larger than the minimum ON/OFF
range. If it is smaller than the minimum ON/OFF range, the actual digital output may not turn
ON or OFF.
• This instruction calculates the time stamp for when the specified position is reached based on
both the current position and current velocity of the axis. The accuracy of the calculated stamp
times is influenced by the encoder resolution and the rotation rate of the axis. The error will
increase if the encoder resolution is low or the rotation rate of the axis is slow. You can calculate a guideline for the maximum error with the following formula.
Maximum error in time stamp (s)
= 180/(Encoder resolution (pulses/rotation) × rotation rate (r/min)
Some examples of the maximum error in time stamps for the encoder resolution and rotation
rate are given in the following table.
Encoder resolution
(pulses/rotation)
Rotation rate (r/min)
Maximum error in calculated
time stamps (μs)
3,600
400
±125.0
800
±62.5
131,072
400
±3.4
800
±1.7
If the axis accelerates or decelerates quickly, the calculation error may increase. Use this
instruction when the axis is at a constant velocity.
Verify operation sufficiently to confirm safety.
• If you specify an unused axis or if the MC Test Run is in progress, Busy will change to TRUE
and InOperation and Error will change to FALSE when Enable changes to TRUE.
• Do not create two instances with the same instance name. If you do, unintentional outputs may
occur.
NY-series Motion Control Instructions Reference Manual (W561)
3-397
3
Function
• If you use this instruction together with the NX_AryDOutTimeStamp instruction and with a Digital Output Unit that supports time stamp refreshing, the minimum ON/OFF range will be proportional to the value of the task period and the value of the rotation rate.
For example, the minimum ON/OFF range would be 5° if one rotation of the rotary table is
360°, the rotation rate is 800 r/min, and the task period is 500 μs. The minimum ON/OFF
range would become 10° if the task period was increased to 1,000 μs.
MC_DigitalCamSwitch
• An Encoder Input Unit or Servo Drive that does not support time stamping is used.
3 Axis Command Instructions
Additional Information
For details on the NX_AryDOutTimeStamp instruction, refer to the NJ/NX-series Controller
Instructions Reference Manual (Cat. No. W502) or NY-series Instructions Reference Manual
(Cat. No. W560).
Instruction Details
You can use this instruction to implement a mechanical cam switch that controls a sensor output signal
according to cam rotation angles in a program in the Controller. One track corresponds to one cam.
Track 2
Track 1
Track 0
Track 0
ON start position
ON start position
ON start position
ON start position
ON start position
ON end position
ON end position
ON end position
ON end position
ON end position
Track 1
ON start position
ON end position
Track 2
ON start position
ON end position
ON start position
ON end position
ON start position
ON end position
Position
TrackNumber corresponds to the cam number. The values of the FirstOnPosition (ON Start Position)
and LastOnPosition (ON End Position) correspond to the shape of the cam. The MC_DigitalCamSwitch
instruction calculates the ON time (OnTime) and OFF time (OffTime) to reach the specified ON start
position and ON end position and stores them in the parameter that is specified for Outputs (Output
Signals).
Outputs[0]
OnTime[0]
OffTime[0]
OnTime[1]
OffTime[1]
OnTime[2]
OffTime[2]
OnTime[3]
OffTime[3]
OnTime[4]
OnTime[0]
OffTime[0]
OffTime[4]
Outputs[1]
Outputs[2]
OnTime[0]
OffTime[0]
OnTime[1]
OffTime[1]
OnTime[2]
OffTime[2]
Time
The NX_AryDOutTimeStamp instruction turns the actual digital outputs ON or OFF according to
ONTime and OffTime in the parameter that is specified for SetDOut (Output Pulses).
For SetDOut (Output Pulses), specify the elements of the array variable that is specified for the parameter for Outputs (Output Signals) in the MC_DigitalCamSwitch instruction.
3-398
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
For DOut (DOut Unit Output Bit), specify as the actual digital output, the device variable that is assigned
to the output bit of the Digital Output Unit that supports time stamp refreshing.
instMC_DigitalCamSwitch
EnableMask
MC_DigitalCamSwitch
Axis
Axis
Switches
Switches
Outputs
Outputs
TrackOptions
TrackOptions
Enable
InOperation
EnableMask
Busy
Error
ValueSource
ErrorID
MC_Axis001
Switches
Outputs
TrackOptions
InOperation
DCS_Busy
DCS_Error
DCS_ErrID
inst_NX_AryDOutTimeStamp1
InOperation
3
Outputs[0]
N3_Output_Bit_00
N3_Output_Bit_00_Time_Stamp
The instruction variables are described next.
z Enable
• The instruction is executed while Enable is TRUE. The values in Outputs will not change while
Enable is FALSE.
z EnableMask (Enable Tracks)
• With EnableMask (Enable Tracks), you can specify whether each track is enabled or disabled
when Enable is TRUE. To turn OFF the output from the Digital Output Unit, disable the corresponding track.
• Bit 00 corresponds to track 0 and bit 15 corresponds to track 15. The corresponding track is
enabled if a bit is set to 1 and disabled if the bit is set to 0. If you change the value of a bit from 1
to 0, the digital output for the corresponding track will be turned OFF.
• The values that are specified in EnableMask are shown in EnableOut for the corresponding track
numbers.
NY-series Motion Control Instructions Reference Manual (W561)
3-399
Function
Outputs[0]
E001_Time_Stamp_of_Synchronous_Output
N3_Output_Bit_00
N3_Output_Bit_00_Time_Stamp
NX_AryDOutTimeStamp
Enable
ENO
SetDOut
SetDOut
SyncOutTime
DOut
DOut
TimeStamp
TimeStamp
MC_DigitalCamSwitch
Vel.Act
MC_Axis001
Switches
Outputs
TrackOptions
3 Axis Command Instructions
z Switch Structure (_sCAMSWITCH_REF Data Type)
The switch structure (_sCAMSWITCH_REF) is used to specify the ON/OFF pattern for the output
signal. You can specify up to 256 ON/OFF patterns for this instruction with an array variable. You can
specify up to 16 ON/OFF patterns for one track.
The following table shows the members of the switch structure.
Name
TrackNumber
FirstOnPosition
LastOnPosition
AxisDirection
CamSwitchMode
Meaning
Track Number
ON Start
Position
Data type
UINT
Valid range
Default
Description
0
Specify the applicable track number.
0 to 15*1
LREAL
Negative number, positive number, or 0
0
ON End Posi- LREAL
tion
Negative number, positive number, or 0
0
Axis Direc_eMC_DItion Selection RECTION
Switch Mode
Selection
_eMC_SWITC
H_MODE
0:_mcPositiveDirection
0*3
Specify the position for the output to
turn ON.*2
Specify the position for the output to
turn OFF.*2
This member is valid when the
Switch Mode Selection is set for position-based operation.
Specify the rotation direction.
2:_mcNegativeDirection
0: Positive direction
4:_mcNoDirection
2: Negative direction
0:_mcSwitchDisable
4: No direction specified (both directions).
Specify the Switch Mode.
0*3
1:_mcPositionBased
0: Switch disabled.
2:_mcTimeBased
1: Position based
2: Time based
Specify the time for the output to turn
ON. This member is valid when the
Switch Mode Selection is set for
time-based operation.
*1 You can specify up to the highest element number for the variable that is specified for Outputs (Output Signals).
Duration
ON Duration
TIME
Positive number or T#0s T#0s
*2 The unit is command units. The command unit is millimeters, micrometers, nanometers, degrees, inches, or pulses. When
the Count Mode is set to Linear Mode, the setting range when the value is converted to pulses is 40 bits (signed integer:
0x8000000000 to 0x7FFFFFFFFF). When the Count Mode is set to Rotary Mode, the setting range is from greater than
or equal to the modulo minimum position to less than the modulo maximum position.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
*4 If you specify 1 (_mcPositionBased), operation is based on the values of FirstOnPosition (ON Start Position) and LastOnPosition (ON End Position). The value of Duration (ON Duration) is ignored.
*5 If you specify 2 (_mcTimeBased), operation is based on the values of FirstOnPosition (ON Start Position) and Duration
(ON Duration). The value of LastOnPosition (ON End Position) is ignored.
Setting Example
Name
TrackNumber
FirstOnPosition
LastOnPosition
Meaning
Track Number
ON Start Position
ON End Position
Switch 0
0
2000.0
3000.0
Switch 1
0
2500.0
3000.0
Switch 2
0
4000.0
1000.0
AxisDirection
Axis Direction
Selection
Switch Mode
Selection
ON Duration
Positive
direction
Position
based
Negative
direction
Position
based
No direction
specified
Position
based
CamSwitchMode
Switch 3
1
3000.0
···
Switch 255
---*1
No direction
specified
Time based
T#1350ms
---*2
---*2
---*2
*1 When the Switch Mode Selection is set for time-based operation, operation is performed with the ON Start Position and
ON Duration. The value of the ON End Position is ignored.
Duration
*2 When the Switch Mode Selection is set for position-based operation, operation is performed with the ON Start Position
and ON End Position. The value of the ON Duration is ignored.
3-400
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
The operation is as shown below when the axis continuously rotates in the positive direction. Here, the
Count Mode is set to Rotary Mode and the ring counter range is set to 0 to 5,000 in the axis parameters.
Track 0 Switch 2
Switch 0
Switch 2
MC_DigitalCamSwitch
1,350 ms
Switch 3
Track 1
Position
1000.0
2000.0
3000.0
4000.0
5000.0
1000.0
The axis continuously rotates in the positive direction.
The operation is as shown below when the axis continuously rotates in the negative direction. The axis
parameter settings are the same as those that are given above.
Function
Switch 1
Track 0 Switch 2
Switch 2
1,350 ms
Switch 3
Track 1
Position
1000.0
2000.0
3000.0
4000.0
5000.0
1000.0
The axis continuously rotates in the negative direction.
z Output Signal Structure (_sOUTPUT_REF Data Type)
The output signal structure (_sOUTPUT_REF) is used to give the ON/OFF times for digital signals
that are calculated based on the switch ON/OFF pattern data. This instruction can handle up to 16
array elements in the Outputs (Output Signals). The array element numbers in Outputs (Output Signals) indicate the track numbers.
The following table shows the members of the output signal structure.
Name
EnableOut
Meaning
Enable
Output
Data type
BOOL
Valid range
TRUE, or FALSE
Description
Specify whether the outputs for the relevant track
numbers are enabled or disabled.
The value of the bit for the same track number in
EnableMask is given.*1
TRUE: The output for the relevant track number is
enabled.
OnTime
ON Time
ARRAY[0..15]
OF ULINT
Non-negative number
OffTime
OFF Time
ARRAY[0..15]
OF ULINT
Non-negative number
FALSE: The output for the relevant track number is
disabled.
The time stamps at which to turn ON the digital output are given. The time stamps are based on the
time in the NX-series Encoder Input Unit. The value
is refreshed every task period. The unit is nanoseconds.
The time stamps at which to turn OFF the digital output are given. The time stamps are based on the
time in the NX-series Encoder Input Unit. The value
is refreshed every task period. The unit is nanoseconds.
*1 The value of bit i in EnableMask is given in Outputs[i].EnableOut.
NY-series Motion Control Instructions Reference Manual (W561)
3
3-401
3 Axis Command Instructions
z Track Option Structure (_sTRACK_REF Data Type)
The switch structure (_sTRACK_REF) is used to specify the operating condition for a switch. You
can specify up to 16 output conditions for this instruction with an array variable.
The variable that is specified for TrackOptions and the variable that is specified for Outputs must
have the same number of array elements.
The following table shows the members of the track option structure.
Name
OnCompensation
Meaning
ON Time
Compensation
Data type
TIME
Valid range
Default
Description
T#0s
This variable compensates the time at
which an output is turned ON. The time is
delayed for a positive value and advanced
for a negative value.
This variable compensates the time at
OffCompensation OFF Time
TIME
T#-1s to T#1s*1 T#0s
which an output is turned OFF. The time is
Compensation
delayed for a positive value and advanced
for a negative value.
*1 If the Count Mode is set to Rotary Mode, the following restrictions exist depending on the unit version of the CPU Unit.
T#-1s to T#1s*1
• For a CPU Unit with unit version 1.09 or later, InOperation will be FALSE if a value is set that exceeds the range for
plus/minus half a rotation of the axis.
• For a CPU Unit with unit version 1.08 or earlier, the valid range is T#-1s to T#0s.
OnCompensation (ON Time Compensation) and OffCompensation (OFF Time Compensation) are
used to correct minor machine operation delays and offsets.
Precautions for Safe Use
Always use the axis at a constant velocity for the MC_DigitalCamSwitch instruction.
If you set the Count Mode to Rotary Mode, the following operation will occur if you use OnCompensation or OffCompensation and the axis velocity changes abruptly.
• If the value of OnCompensation or OffCompensation is equivalent to the time for half a rotation
or more, InOperation will be FALSE.
• If the value of OnCompensation results in exceeding LastOnPosition, the output timing will be
unstable.
FirstOnPosition
LastOnPosition
OnCompensation
FirstOnPosition after compensation
• If the value of OffCompensation results in exceeding FirstOnPosition, the output timing will be
unstable.
FirstOnPosition
LastOnPosition
OffCompensation
LastOnPosition after compensation
3-402
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Precautions for Correct Use
Version Information
If the Count Mode is set to Rotary Mode, the following restrictions exist depending on the unit
version of the CPU Unit.
The valid range is different for a CPU Unit with unit version 1.09 or later and a CPU Unit with unit
version 1.08 or earlier. Check the valid range if you upgrade to a CPU Unit with unit version 1.09
or later.
CPU Unit with Unit Version 1.09 or Later
• Set the value within a range that does not exceed the time for half a rotation of the axis.
For example, for rotation at 500 rpm, the time for one rotation is 120 ms.
The time is for half a rotation, so set OnCompensation (ON Time Compensation) and OffCompensation (OFF Time Compensation) to between −60 and 60 ms.
• If a value is set that exceeds the time for half a rotation of the axis, InOperation will be
FALSE and EnableOut will be FALSE. Always check the status of InOperation during application.
• If a value within the correct range is restored when InOperation is FALSE, InOperation will
change to TRUE.
CPU Unit with Unit Version 1.08 or Earlier
• The valid range is T#-1s to T#0s.
The following figure shows the operation when OnCompensation (ON Time Compensation) is set to
T#5ms and OffCompensation (OFF Time Compensation) is set to T#10ms for the setting example
given on page 3-400.
With compensation (solid line)
Without compensation (dotted line)
Switch 0
5 ms
10 ms
Position
2,000
2,500
3,000
Calculated positions based on actual velocities
The axis continuously rotates in the positive direction.
NY-series Motion Control Instructions Reference Manual (W561)
3-403
3
Function
The valid range is T#-1s to T#1s, but the following restrictions also apply to the setting.
MC_DigitalCamSwitch
If you set the Count Mode to Rotary Mode and use OnCompensation or OffCompensation, set
the parameters so that the relationship between FirstOnPosition and LastOnPosition is not
reversed.
The output timing will be unstable.
Refer to Precautions for Safe Use, above, for operation information.
3 Axis Command Instructions
Timing Charts
A timing chart for execution of the MC_DigitalCamSwitch (Enable Digital Cam Switch) instruction is
shown below.
Enable
InOperation
Busy
Error
ErrorID
16#0000
The following timing chart is for when an unused axis is specified or when an MC Test Run is in progress.
For a CPU Unit with unit version 1.09 or later, the timing chart will be the same if the Count Mode is
Rotary Mode and OnCompensation (ON Time Compensation) or OffCompensation (OFF Time Compensation) is set to a time that exceeds half a rotation of the axis.
Enable
InOperation
Busy
Error
ErrorID
16#0000
Here, EnableOut in Outputs will be FALSE.
Re-execution of Motion Instructions
You cannot re-execute enable-type motion instructions.
Multi-execution of Motion Instructions
Every instance of this instruction is executed independently. The restrictions for multi-execution of
motion control instructions do not apply.
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
3-404
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Errors
If this instruction cannot be executed, an error occurs and Error of this instruction changes to TRUE.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
MC_DigitalCamSwitch
z Timing Chart When Error Occurs
Enable
InOperation
Busy
Error
ErrorID
3
16#0000
Error code
Function
Here, EnableOut in Outputs will be FALSE.
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
3-405
3 Axis Command Instructions
Sample Programming
This section provides sample programming for the example that is given in Setting Example on page 3400.
Configuration Devices
The following devices are used in this sample programming.
Device
EtherCAT Coupler Unit
Model number
NX-ECC201 (Ver.1.1)*1
Pulse Output Unit
NX-PG0122*2
Incremental Encoder Input Unit
NX-EC0122*3
Digital Output Unit
NX-OD2154*4
*1 The node address is 1 and the device name is E001.
*2 The NX Unit number is 1 and the device name is N1. It is assigned to axis 1.
*3 The NX Unit number is 2 and the device name is N2. It is assigned to axis 2.
*4 The NX Unit number is 3 and the device name is N3.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Axis Parameters
Axis Types
Axis
Axis 1
Axis 2
Axis type
Servo axis
Encoder axis
Count Modes
Axis
Axis 1
Axis 2
Count Mode
Rotary Mode
Rotary Mode
Ring Counters
Axis
Axis 1
Axis 2
Modulo maximum position
5000
5000
Modulo minimum position
0
0
Unit of Display
Axis
Axis 1
Axis 2
3-406
Unit of Display
pulse
pulse
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Ladder Diagram
z Main Variables
Name
N3_Output_Bit_00
N3_Output_Bit_00_Time_Stamp
N3_Output_Bit_01
N3_Output_Bit_01_Time_Stamp
Switches
Outputs
Default
-------
BOOL
ULINT
BOOL
ULINT
ARRAY[ 0..3] OF
_sCAMSWITCH_REF
-----------
TrackOptions
ARRAY[ 0..1] OF
_sTRACK_REF
EnableMask
WORD
Device variable*1
Device variable
Device variable
Device variable
Device variable
Input parameter for Switches in-out
variable
The element numbers correspond to
the switch numbers.
Input parameter for Outputs in-out
variable
---
The element numbers correspond to
the track numbers.
Input parameter for TrackOptions inout variable
---
The element numbers correspond to
the track numbers.
Input parameter for EnableMask input
variable
16#0003
Tracks 0 and 1 are enabled.
*1 You must add 0x200A:02 (Time Stamp of Synchronous Output) to the I/O entries for the EtherCAT Coupler Unit.
z Sample Programming
If StartPg input is TRUE, EtherCAT communications are checked to see if process data communications are
normal for axis 1.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
If process data communications are active for axis 1, the Servo is turned ON.
PWR
MC_Power
Lock1
MC_Axis000
Axis
Enable
Axis
Status
Busy
Error
ErrorID
MC_Axis000
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
NY-series Motion Control Instructions Reference Manual (W561)
FaultHandler
FaultHandler
3-407
3
Sample Programming
ARRAY[ 0..1] OF
_sOUTPUT_REF
Comment
Axis Variable for axis 1.
Axis Variable for axis 2.
MC_DigitalCamSwitch
MC_Axis000
MC_Axis001
E001_Time_Stamp_of_Synchronous_Output
Data type
_sAXIS_REF
_sAXIS_REF
ULINT
3 Axis Command Instructions
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed to define home.
HM
MC_Home
MC_Axis000
Pwr_Status
Axis
Execute
MC_Axis000
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm_D
Hm_Bsy
Hm_Ca
Hm_Err
Hm_ErrID
The parameters are set for the MC_MoveVelocity (Velocity Control) instruction and for the Switches variables for the
MC_DigitalCamSwitch (Enable Digital Cam Switch) instruction.
InitFlag
Note: The contents of the inline ST are given below.
The MC_MoveVelocity (Velocity Control) instruction is executed if home is defined for axis 1.
VEL
MC_Axis000.Details.Homed
Hm_D
MC_Axis000
Vel_Vel
Vel_Acc
Vel_Dec
Vel_Jrk
MC_MoveVelocity
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
MC_Axis000
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_ErrID
After the MC_MoveVelocity (Velocity Control) instruction is executed for axis 1, the MC_DigitalCamSwitch (Enable
Digital Cam Switch) instruction is executed for axis 2.
instMC_DigitalCamSwitch
Vel.Act
MC_Axis001
Switches
Outputs
TrackOptions
EnableMask
MC_DigitalCamSwitch
Axis
Axis
Switches
Switches
Outputs
Outputs
TrackOptions
TrackOptions
Enable
InOperation
EnableMask
Busy
Error
ValueSource
ErrorID
MC_Axis001
Switches
Outputs
TrackOptions
InOperation
DCS_Busy
DCS_Error
DCS_ErrID
After the MC_DigitalCamSwitch (Enable Digital Cam Switch) instruction for axis 2 starts operating, the
NX_AryDOutTimeStamp (Write Digital Output Array with Specified Time Stamps) instruction is executed.
inst_NX_AryDOutTimeStamp1
InOperation
Outputs[0]
E001_Time_Stamp_of_Synchronous_Output
N3_Output_Bit_00
N3_Output_Bit_00_Time_Stamp
3-408
NX_AryDOutTimeStamp
Enable
ENO
SetDOut
SetDOut
SyncOutTime
DOut
DOut
TimeStamp
TimeStamp
Outputs[0]
N3_Output_Bit_00
N3_Output_Bit_00_Time_Stamp
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
inst_NX_AryDOutTimeStamp2
InOperation
Outputs[1]
E001_Time_Stamp_of_Synchronous_Output
N3_Output_Bit_01
N3_Output_Bit_01_Time_Stamp
NX_AryDOutTimeStamp
Enable
ENO
SetDOut
SetDOut
SyncOutTime
DOut
DOut
TimeStamp
TimeStamp
Outputs[1]
N3_Output_Bit_01
N3_Output_Bit_01_Time_Stamp
MC_DigitalCamSwitch
Contents of Inline ST
// MC_MoveVelocity parameters
Vel_Vel
:= LREAL#1000.0;
Vel_Acc
:= LREAL#0.0;
Vel_Dec
:= LREAL#0.0;
Vel_Jrk
:= LREAL#1000.0;
InitFlag
:= BOOL#TRUE;
3
Switches[1].TrackNumber
Switches[1].FirstOnPosition
Switches[1].LastOnPosition
Switches[1].AxisDirection
Switches[1].CamSwitchMode
:= UINT#0;
:= LREAL#2500.0;
:= LREAL#3000.0;
:= _eMC_DIRECTION#_mcNegativeDirection;
:= _eMC_SWITCH_MODE#_mcPositionBased;
Switches[2].TrackNumber
Switches[2].FirstOnPosition
Switches[2].LastOnPosition
Switches[2].AxisDirection
Switches[2].CamSwitchMode
:= UINT#0;
:= LREAL#4000.0;
:= LREAL#1000.0;
:= _eMC_DIRECTION#_mcNoDirection;
:= _eMC_SWITCH_MODE#_mcPositionBased;
Switches[3].TrackNumber
Switches[3].FirstOnPosition
Switches[3].Duration
Switches[3].AxisDirection
Switches[3].CamSwitchMode
:= UINT#1;
:= LREAL#3000.0;
:= T#1350ms;
:= _eMC_DIRECTION#_mcNoDirection;
:= _eMC_SWITCH_MODE#_mcTimeBased;
NY-series Motion Control Instructions Reference Manual (W561)
Sample Programming
// MC_DigitalCamSwitch parameters
Switches[0].TrackNumber
:= UINT#0;
Switches[0].FirstOnPosition
:= LREAL#2000.0;
Switches[0].LastOnPosition
:= LREAL#3000.0;
Switches[0].AxisDirection
:= _eMC_DIRECTION#_mcPositiveDirection;
Switches[0].CamSwitchMode := _eMC_SWITCH_MODE#_mcPositionBased;
3-409
3 Axis Command Instructions
Structured Text (ST)
z Main Variables
Name
MC_Axis000
MC_Axis001
E001_Time_Stamp_of_Synchronous_Output
Data type
_sAXIS_REF
_sAXIS_REF
ULINT
Default
-------
BOOL
ULINT
BOOL
ULINT
BOOL
-----------
ARRAY[ 0..3] OF
_sCAMSWITCH_REF
---
N3_Output_Bit_00
N3_Output_Bit_00_Time_Stamp
N3_Output_Bit_01
N3_Output_Bit_01_Time_Stamp
Pwr_En
Switches
Outputs
ARRAY[ 0..1] OF
_sOUTPUT_REF
TrackOptions
ARRAY[ 0..1] OF
_sTRACK_REF
---
---
EnableMask
WORD
16#0003
Hm_Ex
BOOL
FALSE
Vel_Ex
BOOL
FALSE
Comment
Axis Variable for axis 1.
Axis Variable for axis 2.
Device variable*1
Device variable
Device variable
Device variable
Device variable
This variable is assigned to the
Enable input variable from the
PWR instance of the MC_Power
instruction.
Input parameter for Switches inout variable
The element numbers correspond
to the switch numbers.
Input parameter for Outputs in-out
variable
The element numbers correspond
to the track numbers.
Input parameter for TrackOptions
in-out variable
The element numbers correspond
to the track numbers.
Input parameter for EnableMask
input variable
Tracks 0 and 1 are enabled.
The HM instance of MC_Home is
executed when this variable
changes to TRUE.
The VEL instance of MC_MoveVelocity is executed when this variable changes to TRUE.
*1 You must add 0x200A:02 (Time Stamp of Synchronous Output) to the I/O entries for the EtherCAT Coupler Unit.
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel
:= LREAL#1000.0;
Vel_Acc
:= LREAL#0.0;
Vel_Dec
:= LREAL#0.0;
Vel_Jrk
:= LREAL#1000.0;
// MC_DigitalCamSwitch parameters
Switches[0].TrackNumber
Switches[0].FirstOnPosition
Switches[0].LastOnPosition
Switches[0].AxisDirection
Switches[0].CamSwitchMode
Switches[1].TrackNumber
Switches[1].FirstOnPosition
3-410
:= UINT#0;
:= LREAL#2000.0;
:= LREAL#3000.0;
:= _eMC_DIRECTION#_mcPositiveDirection;
:= _eMC_SWITCH_MODE#_mcPositionBased;
:= UINT#0;
:= LREAL#2500.0;
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
:= LREAL#3000.0;
:= _eMC_DIRECTION#_mcNegativeDirection;
:= _eMC_SWITCH_MODE#_mcPositionBased;
:= UINT#0;
:= LREAL#4000.0;
:= LREAL#1000.0;
:= _eMC_DIRECTION#_mcNoDirection;
:= _eMC_SWITCH_MODE#_mcPositionBased;
:= UINT#1;
:= LREAL#3000.0;
:= T#1350ms;
:= _eMC_DIRECTION#_mcNoDirection;
:= _eMC_SWITCH_MODE#_mcTimeBased;
// InitFlag is changed to TRUE after input parameters are set.
InitFlag:=TRUE;
MC_DigitalCamSwitch
Switches[1].LastOnPosition
Switches[1].AxisDirection
Switches[1].CamSwitchMode
Switches[2].TrackNumber
Switches[2].FirstOnPosition
Switches[2].LastOnPosition
Switches[2].AxisDirection
Switches[2].CamSwitchMode
Switches[3].TrackNumber
Switches[3].FirstOnPosition
Switches[3].Duration
Switches[3].AxisDirection
Switches[3].CamSwitchMode
3
END_IF;
// If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
// If the Servo is ON and home is not defined, the Home instruction is executed.
IF (Pwr_Status=TRUE) THEN
Hm_Ex:=TRUE;
END_IF;
// After home is defined, MC_MoveVelocity is executed.
IF MC_Axis000.Details.Homed=TRUE AND Hm_D=TRUE THEN
Vel_Ex:=TRUE;
END_IF;
//MC_Power
PWR(
Axis
:= MC_Axis000,
Enable := Pwr_En,
Status => Pwr_Status,
Busy
=> Pwr_Bsy,
Error
=> Pwr_Err,
ErrorID => Pwr_ErrID
);
//MC_Home
HM(
NY-series Motion Control Instructions Reference Manual (W561)
3-411
Sample Programming
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_RegSlavTbl[MC_Axis000.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]=FALSE) THEN
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
3 Axis Command Instructions
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
:= MC_Axis000,
:= Hm_Ex,
=> Hm_D,
=> Hm_Bsy,
=> Hm_Ca,
=> Hm_Err,
=> Hm_ErrID
);
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Jerk
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Jrk,
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
//MC_DigitalCamSwitch
instMC_DigitalCamSwitch(
Axis
:= MC_Axis001,
Switches
:= Switches,
Outputs
:= Outputs,
TrackOptions := TrackOptions,
Enable
:= Vel_Act,
EnableMask
:= EnableMask,
InOperation
=> InOperation,
Busy
=> DCS_Busy,
Error
=> DCS_Error,
ErrorID
=> DCS_ErrorID );
inst_NX_AryDOutTimeStamp1(
Enable
:= Vel_Act,
SetDOut
:= Outputs[0],
SyncOutTime := E001_Time_Stamp_of_Synchronous_Output,
DOut
:= N3_Output_Bit_00,
TimeStamp
:= N3_Output_Bit_00_Time_Stamp);
inst_NX_AryDOutTimeStamp2(
Enable
:= Vel_Act,
SetDOut
:= Outputs[1],
SyncOutTime := E001_Time_Stamp_of_Synchronous_Output,
DOut
:= N3_Output_Bit_01,
TimeStamp
:= N3_Output_Bit_01_Time_Stamp);
3-412
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_TimeStampToPos
The MC_TimeStampToPos instruction calculates the position of the axis for the specified time stamp.
Name
MC_TimeStampToPos
Time Stamp
to Axis Position Calculation
FB/
FUN
FB
Graphic expression
ST expression
MC_TimestampToPos_instance
MC_TimestampToPos
Axis
Axis
Enable
Enabled
Timestamp
Busy
ValueSource
CalcPosition
Error
ErrorID
Precautions for Correct Use
You can use this instruction for an axis that is assigned to an NX-series Position Interface Unit.
The applicable NX Units are as follows: NX-EC0……… and NX-ECS……….
Version Information
A CPU Unit with unit version 1.06 or later and Sysmac Studio version 1.07 or higher are required
to use this instruction.
Variables
Input Variables
Name
Enable
Meaning
Enable
Data type
BOOL
Valid range
TRUE or FALSE
TimeStamp
Time Stamp
ULINT
Non-negative
number
Default
Description
FALSE The instruction is executed while Enable
is TRUE.
0
Specifies the time stamp for which to calculate the position. A time stamp that is
based on the time in a Digital Input Unit,
Encoder Input Unit, or other Unit that
supports time stamp refreshing is specified.
ValueSource
(Reserved)
Input Information
_sMC_SOURCE
---
---
NY-series Motion Control Instructions Reference Manual (W561)
The unit is nanoseconds.
(Reserved)
3-413
3
Variables
MC_TimeStampToPos_instance (
Axis :=parameter,
Enable :=parameter,
TimeStamp :=parameter,
ValueSource :=parameter,
Enabled =>parameter,
Busy =>parameter,
CalcPosition =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_TimeStampToPos
Instruction
3 Axis Command Instructions
Output Variables
Name
Enabled
Busy
CalcPosition
Error
ErrorID
Meaning
Enable
Executing
Calculated
Position
Error
Error Code
Data
type
BOOL
BOOL
LREAL
BOOL
WORD
Valid range
TRUE or FALSE
TRUE or FALSE
Negative number,
positive number, or
0
TRUE or FALSE
*2
Description
TRUE when the axis is being controlled.
TRUE when the instruction is acknowledged.
Contains the position for the specified time stamp.
The unit is command units.*1
TRUE while there is an error.
Contains the error code when an error occurs. A
value of 16#0000 indicates normal execution.
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Enabled
Timing for changing to TRUE
When Enable changes to TRUE.
Busy
When Enable changes to TRUE.
Error
When there is an error in the execution conditions
or input parameters for the instruction.
Timing for changing to FALSE
• When Enable changes to FALSE.
• When Error changes to TRUE.
• When Enable changes to FALSE.
• When Error changes to TRUE.
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid
range
---
Description
Specify the axis.*1*2
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Specify the encoder axis that is assigned to the NX-series Encoder Input Unit.
Function
• The MC_TimestampToPos instruction calculates the actual current position at the time stamp that is
specified by the input variable based on the actual current position and time stamp of the axis.
• For the axis, specify an NX-series Encoder Input Unit.
• If the Count Mode is set to Linear Mode in the axis parameters and an overflow or underflow occurs
in the calculated position, the calculated value will be the underflow value or the overflow value. In
this case, no error will occur.
3-414
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Position
Current position
Calculated position
Specified time
stamp
Time
Precautions for Correct Use
• This instruction requires that you use an NX-series Encoder Input Unit and that time stamping
is operating.
Time stamping is not possible in the following cases.
• An Encoder Input Unit or Servo Drive that does not support time stamping is used.
• Object 6010 hex (Time Stamp) in the NX-series Encoder Input Unit is not assigned to a
PDO.
• An error does not occur for this instruction even if the time stamp is not updated. The position
will be calculated, but the result will not be the position for the specified time stamp.
Use this instruction only after you confirm in the MC Monitor Table or Watch Tab Page of the
Sysmac Studio that the TimeStamp member of the Axis Variable is being updated.
• This instruction calculates the position for the specified time stamp based on both the current
position and current velocity of the axis. If the axis accelerates or decelerates quickly, the calculation error may increase. Use this instruction when the axis is at a constant velocity.
Verify operation sufficiently to confirm safety.
• If you specify an unused axis or if the MC Test Run is in progress, Busy will change to TRUE
and Enabled and Error will change to FALSE when Enable changes to TRUE.
• Do not create two instances with the same instance name. If you do, unintentional outputs may
occur.
Timing Charts
A timing chart for execution of the MC_TimestampToPos (Convert Time Stamp to Axis Position) instruction is shown below.
Enable
Enabled
Busy
CalcPosition
Undefined.
Updated
Undefined.
Error
ErrorID
16#0000
The following timing chart is for when an unused axis is specified or when an MC Test Run in progress.
NY-series Motion Control Instructions Reference Manual (W561)
3-415
3
Function
• The distributed clock in the EtherCAT Coupler Unit is disabled.
MC_TimeStampToPos
Current time
stamp
3 Axis Command Instructions
Enable
Enabled
Busy
CalcPosition
Undefined.
Error
ErrorID
16#0000
Re-execution of Motion Instructions
You cannot re-execute enable-type motion instructions.
Multi-execution of Motion Instructions
This instruction is executed independently from other instructions. The restrictions for multi-execution of
motion instructions do not apply.
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Errors
If this instruction cannot be executed, an error occurs and Error of this instruction changes to TRUE.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Enable
Enabled
Busy
CalcPosition
Undefined.
Error
ErrorID
16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-416
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Sample Programming
This section shows sample programming that measures the distances between workpieces that move
on a conveyor belt.
MC_TimeStampToPos
Configuration Devices
The following devices are used in this sample programming.
Device
EtherCAT Coupler Unit
Model number
NX-ECC201 (Ver.1.1)*1
Pulse Output Unit
NX-PG0122*2
Incremental Encoder Input Unit
NX-EC0122*3
Digital Input Unit
NX-ID3344*4
*1 The node address is 1 and the device name is E001.
3
Sample Programming
*2 The NX Unit number is 1 and the device name is N1. It is assigned to axis 1.
*3 The NX Unit number is 2 and the device name is N2. It is assigned to axis 2.
*4 The NX Unit number is 3 and the device name is N3.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Axis Parameters
Axis Types
Axis
Axis 1
Axis 2
Axis type
Servo axis
Encoder axis
Count Modes
Axis
Axis 1
Axis 2
Count Mode
Rotary Mode
Rotary Mode
Ring Counters
Axis
Axis 1
Axis 2
Modulo maximum position
360
360
Modulo minimum position
0
0
Unit of Display
Axis
Axis 1
Axis 2
Unit of Display
degree
degree
NY-series Motion Control Instructions Reference Manual (W561)
3-417
3 Axis Command Instructions
Operation Example
The sensor output turns ON when the sensor detects a workpiece. When the workpiece passes, the
sensor output turns OFF. When the sensor detects the next workpiece, the sensor output turns ON
again. The position of the encoder input is calculated based on the time stamp when the sensor output
turns ON. The difference between two positions is the distance between the workpieces.
Ladder Diagram
z Main Variables
Name
MC_Axis000
MC_Axis001
N3_Input_Bit_00
N3_Input_Bit_00_Time_Stamp
Position
Count
FirstPoint
LastPoint
Distance
3-418
Data type
_sAXIS_REF
_sAXIS_REF
BOOL
ULINT
ARRAY[ 0..1] OF
LREAL
ARRAY[ 0..1] OF
ULINT
UINT
UINT
LREAL
Default
-----------
Comment
Axis Variable for axis 1.
Axis Variable for axis 2.
Device variable
Device variable
Stores the calculated positions.
---
Stores the number of rotations.
-------
A variable that is used for processing.
A variable that is used for processing.
The distance between workpieces.
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Sample Programming
If StartPg input is TRUE, EtherCAT communications are checked to see if process data communications are
normal for axis 1.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
PWR
MC_Power
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
MC_Axis000
Pwr_Status
Pwr_Bsy
Pwr_Err
Pwr_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
EN
FaultHandler
FaultHandler
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed to define home.
HM
MC_Home
MC_Axis000
Pwr_Status
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
MC_Axis000
Hm_D
Hm_Bsy
Hm_Ca
Hm_Err
Hm_ErrID
The parameters are set for the MC_MoveVelocity (Velocity Control) instruction.
InitFlag
Note: The contents of inline ST 1 are given below.
The MC_MoveVelocity (Velocity Control) instruction is executed if home is defined for axis 1.
VEL
MC_MoveVelocity
MC_Axis000.Details.Homed
Hm_D
MC_Axis000
Vel_Vel
Vel_Acc
Vel_Dec
Vel_Jrk
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Axis
Execute
InVelocity
Velocity
Busy
Acceleration
Active
Deceleration CommandAborted
Jerk
Error
ErrorID
Direction
Continuous
BufferMode
MC_Axis000
3
Sample Programming
MC_Axis000.MFaultLvl.Active
MC_TimeStampToPos
If process data communications are active for axis 1, the Servo is turned ON.
Vel_InVel
Vel_Bsy
Vel_Act
Vel_Ca
Vel_Err
Vel_ErrID
3-419
3 Axis Command Instructions
After the MC_MoveVelocity (Velocity Control) instruction is executed for axis 1, the MC_TimeStampToPos (Time
Stamp to Axis Position Calculation) instruction is executed for axis 2.
instMC_TimeStampToPos
MC_Axis001
Vel.Act
N3_Input_Bit_00_Time_Stamp
MC_TimeStampToPos
Axis
Axis
Enable
Enabled
TimeStamp
Busy
CalcPosition
ValueSource
Error
ErrorID
MC_Axis001
inst_Enabled
TTP_Busy
CalcPosition
TTP_Err
TTP_ErrID
The number of rotations of the encoder axis is counted. (If the current value is less than the previous value, it is
assumed that the modulo maximum position has been exceeded.)
Note: The contents of inline ST 2 are given below.
CalcPosition (calculated position) is obtained when the sensor output turns ON. (The position is saved alternately in
Position[0] and Position[1].
inst_Enabled N3_Input_Bit_00
Note: The contents of inline ST 3 are given below.
After two workpieces are detected, the distance between the workpieces is calculated.
Finish
Note: The contents of inline ST 4 are given below.
3-420
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Contents of Inline ST 1
// MC_MoveVelocity parameters
Vel_Vel
:= LREAL#1000.0;
Vel_Acc
:= LREAL#0.0;
Vel_Dec
:= LREAL#0.0;
Vel_Jrk
:= LREAL#1000.0;
InitFlag
:= BOOL#TRUE;
MC_TimeStampToPos
Contents of Inline ST 2
IF MC_Axis001.Act.Pos=LREAL#0.0 THEN
Inc(RotaryCount);
END_IF;
Contents of Inline ST 3
IF Index < USINT#2 THEN
Position[Index] := CalcPosition;
Count[Index] := RotaryCount;
Index := Index + UINT#1;
END_IF;
IF Index >= USINT#2 THEN
Finish := BOOL#TRUE;
Index := UINT#0;
END_IF;
3
Sample Programming
Contents of Inline ST 4
// First comparison: Workpiece 1= Position[0] and workpiece 2 = Position[1]
// Second comparison: Workpiece 2= Position[1] and workpiece 3 = Position[0]
// Third comparison: Workpiece 3 = Position[0] and workpiece 4 = Position[1]
//…
FirstPoint := (Index+UINT#1) MOD UINT#2;
LastPoint :=Index;
DiffCount := Count[1] - Count[0];
Distance := (ABS( DiffCount) -LINT#1)* 360.0 +
(360.0 + Position[FirstPoint] - Position[LastPoint]);
NY-series Motion Control Instructions Reference Manual (W561)
3-421
3 Axis Command Instructions
Structured Text (ST)
z Main Variables
Name
Data type
_sAXIS_REF
_sAXIS_REF
BOOL
ULINT
BOOL
Default
--------FALSE
Vel_Ex
BOOL
FALSE
PreN3InputBit00
BOOL
-----
Count
FirstPoint
ARRAY[0..1] OF
LREAL
ARRAY[0..1] OF ULINT
UINT
-----
LastPoint
UINT
---
Distance
LREAL
---
MC_Axis000
MC_Axis001
N3_Input_Bit_00
N3_Input_Bit_00_Time_Stamp
Hm_Ex
Position
Comment
Axis Variable for axis 1.
Axis Variable for axis 2.
Device variable
Device variable
The HM instance of MC_Home is
executed when this variable
changes to TRUE.
The VEL instance of MC_MoveVelocity is executed when this variable changes to TRUE.
The previous value of the N3_Input_Bit_00 device variable.
Stores the calculated positions.
Stores the number of rotations.
A variable that is used for processing.
A variable that is used for processing.
The distance between workpieces.
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MC_MoveVelocity parameters
Vel_Vel := LREAL#1000.0;
Vel_Acc := LREAL#0.0;
Vel_Dec := LREAL#0.0;
Vel_Jrk := LREAL#1000.0;
// InitFlag is changed to TRUE after input parameters are set.
InitFlag:=TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_RegSlavTbl[MC_Axis000.Cfg.NodeAddress]=TRUE)
AND (_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]=FALSE) THEN
Pwr_En:=TRUE;
ELSE
Pwr_En:=FALSE;
END_IF;
// If a minor fault level error occurs for axis 1, the error handler for the device (FaultHandler) is executed.
// Program the FaultHandler according to the device.
IF MC_Axis000.MFaultLvl.Active=TRUE THEN
FaultHandler();
END_IF;
3-422
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
// If the Servo is ON and home is not defined, the Home instruction is executed.
IF (Pwr_Status=TRUE) THEN
Hm_Ex:=TRUE;
END_IF;
// The number of rotations of the encoder axis is counted.
// (If the current value is less than the previous value, it is assumed that the modulo maximum position has been exceeded.)
IF MC_Axis001.Act.Pos<PreAxis001ActPos THEN
Inc(RotaryCount);
END_IF;
PreAxis001ActPos := MC_Axis001.Act.Pos;
// CalcPosition (calculated position) is obtained when the sensor output turns ON.
// (The position is saved alternately in Position[0] and Position[1].
IF inst_Enabled THEN
IF PreN3InputBit00=FALSE AND N3_Input_Bit_00=TRUE THEN
IF Index < UINT#2 THEN
Position[Index] := CalcPosition;
Count[Index] := RotaryCount;
Index := Index + UINT#1;
END_IF;
IF Index >= UINT#2 THEN
Finish := BOOL#TRUE;
Index := UINT#0;
END_IF;
END_IF;
END_IF;
PreN3InputBit00 := N3_Input_Bit_00;
// After two workpieces are detected, the distance between the workpieces is calculated.
// First comparison: Workpiece 1= Position[0] and workpiece 2 = Position[1]
// Second comparison: Workpiece 2= Position[1] and workpiece 3 = Position[0]
// Third comparison: Workpiece 3 = Position[0] and workpiece 4 = Position[1]
//…
IF Finish THEN
FirstPoint := (Index+UINT#1) MOD UINT#2;
LastPoint :=Index;
DiffCount := Count[1] - Count[0];
Distance := (ABS( DiffCount) -LINT#1)* 360.0 +
(360.0 + Position[FirstPoint] - Position[LastPoint]);
END_IF;
NY-series Motion Control Instructions Reference Manual (W561)
3
Sample Programming
//MC_TimeStampToPos
instMC_TimeStampToPos(
Axis
:= MC_Axis001,
Enable
:= Vel_Ex,
TimeStamp
:= TimeStamp,
Enabled
=> inst_Enabled,
Busy
=> TSTP_Busy,
CalcPosition
=> CalcPosition,
Error
=> TSTP_Error,
ErrorID
=> TSTP_ErrorID );
MC_TimeStampToPos
// After home is defined, MC_MoveVelocity is executed.
IF MC_Axis000.Details.Homed=TRUE AND Hm_D=TRUE THEN
Vel_Ex:=TRUE;
END_IF;
3-423
3 Axis Command Instructions
//MC_Power
PWR(
Axis
Enable
Status
Busy
Error
ErrorID
);
//MC_Home
HM(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
//MC_MoveVelocity
VEL(
Axis
Execute
Velocity
Acceleration
Deceleration
Jerk
InVelocity
Busy
Active
CommandAborted
Error
ErrorID
);
3-424
:= MC_Axis000,
:= Pwr_En,
=> Pwr_Status,
=> Pwr_Bsy,
=> Pwr_Err,
=> Pwr_ErrID
:= MC_Axis000,
:= Hm_Ex,
=> Hm_D,
=> Hm_Bsy,
=> Hm_Ca,
=> Hm_Err,
=> Hm_ErrID
:= MC_Axis000,
:= Vel_Ex,
:= Vel_Vel,
:= Vel_Acc,
:= Vel_Dec,
:= Vel_Jrk,
=> Vel_InVel,
=> Vel_Bsy,
=> Vel_Act,
=> Vel_Ca,
=> Vel_Err,
=> Vel_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
MC_SyncOffsetPosition
The MC_SyncOffsetPosition instruction compensates the position of a slave axis currently in synchronized control.
Name
MC_SyncOffsetPosition
Cyclic Synchronous Position
Offset Compensation
FB/
FUN
FB
ST expression
MC_SyncOffsetPosition_instance
MC_SyncOffsetPosition_instance (
Axis :=parameter,
Execute :=parameter,
OffsetPosition :=parameter,
BufferMode :=parameter,
MoveMode :=parameter,
OutputtedOffsetPosition =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted =>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_SyncOffsetPosition
Axis
Axis
Execute
OutputtedOffsetPosition
OffsetPosition
Busy
BufferMode
Active
MoveMode
CommandAborted
Error
ErrorID
Version Information
A CPU Unit with unit version 1.10 or later and Sysmac Studio version 1.12 or higher are required
to use this instruction.
Variables
Input Variables
Execute
Execute
Data
type
BOOL
OffsetPosition
Position Offset
LREAL
Negative number,
positive number, or 0
BufferMode
Buffer Mode
Selection
_eMC_BUFF
ER_MODE
_eMC_MOV
E_MOD
E
0: _mcAborting
Name
MoveMode
Meaning
Travel Mode
Valid range
Default
Description
TRUE or FALSE
FALSE
The instruction is executed when Execute changes to TRUE.
Specify the position offset to add to the
command current position.
0
0 *2
The unit is command units.*1
Specify the behavior when executing
more than one motion instruction.
0: Aborting
1: _mcRelative
0 *2
Select the travel method.
1: Relative positioning
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 The default value for an enumeration variable is actually not the number, but the enumerator.
NY-series Motion Control Instructions Reference Manual (W561)
3-425
3
Variables
Graphic expression
MC_SyncOffsetPosition
Instruction
3 Axis Command Instructions
Output Variables
Name
Meaning
OutputtedOffsetPosition
Position Offset Output
Value
Busy
Active
CommandAborted
Error
ErrorID
Executing
Controlling
Instruction
Aborted
Error
Error Code
Data
type
LREAL
Valid range
Negative number,
positive number, or
0
BOOL
BOOL
BOOL
TRUE or FALSE
TRUE or FALSE
TRUE or FALSE
BOOL
WORD
TRUE or FALSE
*1
Description
Contains the position offset that was added to the
command current position.
The value is updated when Active is TRUE.
Updating is stopped and the value is retained when
CommandAborted or Error is TRUE.
TRUE when the instruction is acknowledged.
TRUE while the axis is being controlled.
TRUE when the instruction is aborted.
TRUE while there is an error.
Contains the error code when an error occurs.
A value of 16#0000 indicates normal execution.
*1 Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Busy
Name
Timing for changing to TRUE
When Execute changes to TRUE.
Active
When the instruction is started.
CommandAborted
• When execution of the synchronized control
instruction is stopped.
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error in another instruction.
• When this instruction is executed while there is
an axis error.
• When you start this instruction during MC_Stop
instruction execution.
When there is an error in the execution conditions
or input parameters for the instruction.
Error
Timing for changing to FALSE
When Error changes to TRUE.
When CommandAborted changes to TRUE.
When Error changes to TRUE.
When CommandAborted changes to TRUE.
When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
•
•
•
•
•
When the error is cleared.
In-Out Variables
Name
Axis
Meaning
Axis
Data type
_sAXIS_REF
Valid
range
---
Description
Specify the axis.*1, *2
*1 Specify a user-defined Axis Variable that was created in the Axis Basic Settings of the Sysmac Studio (default:
MC_Axis***) or a system-defined axis variable name (_MC_AX[*], _MC1_AX[*], or _MC2_AX[*]).
*2 Specify the encoder axis that is assigned to the NX-series Encoder Input Unit.
3-426
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Function
• The MC_SyncOffsetPosition instruction adds an offset that is calculated based on the value of the
OffsetPosition (Position Offset) input variable to the command current position and outputs the result
to the Servo Drive.
• The starting point for this instruction is used as the starting point for OffsetPosition (Position Offset)
as long as Active (Controlling) of this instruction is TRUE. Refer to Repeatedly Starting and Stopping
this Instruction on page 3-429 for details.
Switch 1
Command position
after addition of offset
MC_SyncOffsetPosition
• You can change the value of the OffsetPosition (Position Offset) input variable while the Active (Controlling) output variable is TRUE.
First position
Target position
Command position
before addition of offset
Motion instruction
+
Servo Drive
(CSP)
+
Function
MC_SyncOffsetPosition instruction
Previous position offset
Offset
Position offset
+
0
Switch 2
• Switch 1 is turned ON only once when Execute of the motion instruction is changed to TRUE.
• Switch 2 is ON while Active (Controlling) of the MC_SyncOffsetPosition instruction is TRUE.
• When switch 2 is OFF, the offset that is added to the command position is 0.
• You can execute this instruction only for a slave axis that is currently in synchronized control.
• After execution of this instruction is started, CommandAborted (Instruction Aborted) changes to
TRUE after Done, CommandAborted (Instruction Aborted), or Error of the target synchronized control
instruction changes to TRUE.
• If CommandAborted (Instruction Aborted) or Error of this instruction changes to TRUE, the offset that
was previously added to the command position is retained.
NY-series Motion Control Instructions Reference Manual (W561)
3
3-427
3 Axis Command Instructions
• The following timing chart shows execution of this instruction while execution of the MC_GearIn (Start
Gear Operation) instruction is in progress in the primary periodic task and then CommandAborted
(Instruction Aborted) of the MC_GearIn (Start Gear Operation) instruction changes to TRUE.
MC_GearIn Instruction
Execute
Active
CommandAborted
MC_GearOut Instruction
Execute
Done
MC_SyncOffsetPosition Instruction
Execute
OffsetPosition
0
-10
0
10
20
Active
CommandAborted
OutputtedOffsetPosition
0
Offset
0
-10
-10
0
0
10
10
20
0 10
0
Solid line: After position offset is added
Command position
Primary period
+20
+20
+20
Dotted line: Before position offset is added
+10
+10
-10
-10
-10
Time
3-428
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Repeatedly Starting and Stopping this Instruction
If you execute this instruction again after it is aborted, 0 is used as the starting point for the OffsetPosition (Position Offset) input variable. If you specify 0 for OffsetPosition (Position Offset) when you execute the instruction the second time, the offset that is added to the command position is 0.
MC_SyncOffsetPosition Instruction
Execution started the second time
MC_SyncOffsetPosition
Execute
OffsetPosition
0
20
40
60
0
Active
CommandAborted
OutputtedOffsetPosition
0
Offset
0
20
40
60
20 0 20 0 20
0
3
0
Function
Command position
(increased or decreased by offset)
+60
+40
+20
Time
If you want to use the same starting point when you re-execute a previously aborted instruction, use
OutputtedOffsetPosition (Position Offset Output Value).
As shown in this programming sample, OutputtedOffsetPosition (Position Offset Output Value) is used
to access the position offset when execution was aborted and it is subtracted from the variable for the
input parameter specified for this instruction.
OffsetResetFlag
MOVE
EN
ENO
0
In
Out
Execute
Busy
EN
In1
In2
InputOffsetPos
PreviousOffsetPos
PreviousOffsetPos
SUB
ENO
OffsetPosition
SyncOffsetPos
MC_SyncOffsetPosition
Execute
MC_Axis000
OffsetPosition
Axis
Axis
OutputtedOffsetPosition
Execute
Busy
OffsetPosition
Active
BufferMode
CommandAborted
MoveMode
Error
ErrorID
CA
Error
OutputtedOffsetPos
PreviousOffsetPos
NY-series Motion Control Instructions Reference Manual (W561)
EN
In1
In2
MC_Axis000
OutputtedOffsetPos
Busy
CA
Error
ADD
ENO
PreviousOffsetPos
3-429
3 Axis Command Instructions
InputOffsetPosition
0
20
PreviousOffsetPos
40
60
0
60
MC_SyncOffsetPosition Instruction
Execute
OffsetPosition
0
20
40
60
0
Active
CommandAborted
OutputtedOffsetPosition
0
Offset
0
20
40
20 0 20 0 20
60
0
0
Command position
(increased or decreased by offset)
+60
+40
+20
Time
z Executable Axis Status
You can execute this instruction for any axis for which Status.Synchronized (Synchronized Motion) in
the status of the axis specified for Axis is TRUE. An error will occur if the instruction is executed for an
axis in any other status.
z Command Position Handling
The value after the position offset is added is managed as the command position of the axis. Therefore,
the following errors may occur depending on the value that you set for the position offset.
• Operation Settings in Axis Parameters
• Maximum Velocity
• Maximum Acceleration
• Maximum Deceleration
• Velocity Warning Value
• Acceleration Warning Value
• Deceleration Warning Value
• In-position Check Time
• Limit Settings in Axis Parameters
• Software Limits
• Following Error Over Value
• Following Error Warning Value
• Command Position Overflow
• Command Position Underflow
3-430
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
Timing Charts
The following timing charts show when the position offset is applied when this instruction is executed.
The position offset that is specified for the input is output to the Servo Drive during the next task period.
The following timing chart shows an example of the operation for when this instruction is executed in the
primary periodic task. The same information applies when it is used in a priority-5 periodic task.
MC_SyncOffsetPosition Instruction
MC_SyncOffsetPosition
z When this Instruction Is Executed in the Primary Periodic Task or Priority-5
Periodic Task
Execute
3
Active
10
20
Command position
Solid line: After position offset is added
Primary period
+20
+20
Dotted line: Before position offset is added
+20
+10
Time
z When this Instruction Is Executed in the Priority-16 Periodic Task
The position offset that is specified for the input is output to the Servo Drive one primary period after the
next priority-16 periodic task.
MC_SyncOffsetPosition Instruction
Execute
Active
OffsetPosition
10
20
Solid line: After position offset is added
Command position
Primary period
Task period
+20
+10
+10 Dotted line: Before position offset is added
+10
+10
Time
NY-series Motion Control Instructions Reference Manual (W561)
3-431
Function
OffsetPosition
3 Axis Command Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted.
Multi-execution of Motion Control Instructions
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
z Multi-execution of Instructions for the Target Synchronized Control Instructions
If you perform multi-execution of instructions for the synchronized control instruction for which this
instruction is being executed, CommandAborted (Instruction Aborted) of this instruction changes to
TRUE. If blending is used for multi-execution of two MC_CamIn (Start Cam Operation) instructions,
CommandAborted (Instruction Aborted) of this instruction remains FALSE and processing is continued.
In this case, the value of OffsetPosition (Position Offset) is added to the initial velocity.
The following timing chart shows the operation when this instruction is executed for an MC_GearIn
(Start Gear Operation) instruction and multi-execution of instructions is performed for another instance
of MC_GearIn (Start Gear Operation) before execution of the first instance is completed.
MC_GearIn Instruction 1
Execute
Active
CommandAborted
MC_GearIn Instruction 2
Execute
Done
MC_SyncOffsetPosition Instruction
Execute
Active
CommandAborted
OffsetPosition
Command position
0
10
The position offset is added to the initial velocity
for multi-execution of instructions.
Solid line: When this instruction is executed
Dotted line: When this instruction is not executed
After multi-execution of instructions
Time
3-432
NY-series Motion Control Instructions Reference Manual (W561)
3 Axis Command Instructions
z Multi-execution of MC_SyncOffsetPosition Instructions
A timing chart for multi-execution of MC_SyncOffsetPosition instructions is shown below.
MC_SyncOffsetPosition Instruction 1
Execute
OffsetPosition
0
MC_SyncOffsetPosition
If you perform multi-execution of MC_SyncOffsetPosition instructions, CommandAborted (Instruction
Aborted) of the instance for which execution is currently in progress changes to TRUE and the next
instance is executed. The starting point for instances that are executed later is found by adding the
position offset that was output one cycle before the previous instance was aborted. There are no other
instructions for which execution is aborted when multi-execution of instructions is used for this instruction.
10
3
Active
CommandAborted
Function
MC_SyncOffsetPosition Instruction 2
Execute
OffsetPosition
0
20
30
Active
Command position
Solid line: After position offset is added
+30
+30 Dash-dot line:
Starting point for multi-execution of instructions
+30
+10
+20
+10 Dotted line: Before position offset is added
+10
+20
+10
+20
+10
+10
Primary period
+10
+10
After multi-execution of instructions
+10
Time
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axes will stop.
You can find out the cause of the error by referring to the value output by ErrorID (Error Code).
z Timing Chart When Error Occurs
Execute
Busy
Active
CommandAborted
Error
ErrorID
16#0000
NY-series Motion Control Instructions Reference Manual (W561)
Error code
3-433
3 Axis Command Instructions
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
3-434
NY-series Motion Control Instructions Reference Manual (W561)
Axes Group Instructions
This section describes the instructions to perform multi-axes coordinated control for the
MC Function Module.
MC_GroupEnable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
MC_GroupDisable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
MC_MoveLinear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-10
MC_MoveLinearAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-36
MC_MoveLinearRelative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-39
MC_MoveCircular2D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-42
MC_GroupStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-66
MC_GroupImmediateStop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-75
MC_GroupSetOverride . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-79
MC_GroupReadPosition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-83
MC_ChangeAxesInGroup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-87
MC_GroupSyncMoveAbsolute . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-91
MC_GroupReset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-97
NY-series Motion Control Instructions Reference Manual (W561)
4-1
4
4 Axes Group Instructions
MC_GroupEnable
The MC_GroupEnable instruction enables an axes group.
Instruction
MC_GroupEnable
Name
Enable Axes
Group
FB/
FUN
FB
Graphic expression
ST expression
MC_GroupEnable_instance
MC_GroupEnable_instance (
AxesGroup :=parameter,
Execute :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_GroupEnable
AxesGroup
Execute
AxesGroup
Done
Busy
CommandAborted
Error
ErrorID
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
BOOL
Valid range
TRUE or FALSE
Default
FALSE
Description
The instruction is executed when
Execute changes to TRUE.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
4-2
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the instruction is completed.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
When this instruction is canceled.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution con- When the error is cleared.
ditions or input parameters for the instruction.
MC_GroupEnable
Done
In-Out Variables
Name
Meaning
AxesGroup
Axes Group
Data type
Valid range
_sGROUP_REF
---
Description
4
Specify the axes group.*
Function
Before describing the function of this instruction, the different states of axes groups are explained.
• Axes groups have two states, the GroupEnable and GroupDisable states.
State
Description
GroupEnable
Multi-axes coordinated control is enabled.
You can execute any multi-axes coordinated control instructions except for the
MC_ChangeAxesInGroup (Change Axes In Group) instruction.
GroupDisable
Multi-axes coordinated control is disabled. You can execute only the following multi-axes
coordinated control instructions.
•
•
•
•
•
•
MC_GroupEnable (Enable Axes Group) instruction
MC_GroupDisable (Disable Axes Group) instruction
MC_GroupReset (Reset Axes Group Errors) instruction
MC_GroupSetOverride (Set Group Overrides) instruction
MC_GroupReadPosition (Read Axes Group Position) instruction
MC_ChangeAxesInGroup (Change Axes in Group) instruction
• To perform multi-axes coordinated control, an axes group must be in a GroupEnable state.
You can monitor the Axes Group Variables in the system-defined variables for motion control to see if
axes groups are enabled or disabled.
Here, the Axes Group Variables are described using _MC_GRP[*] as an example. The same information applies to _MC1_GRP[*] and _MC2_GRP[*].
Name
Meaning
Description
_MC_GRP*.Status.Ready
Axes Group
Enabled
TRUE when the axes group is stopped and preparations
to execute an axes group instruction are completed.
_MC_GRP*.Status.Disabled
Axes Group Disabled
TRUE when the axes group is disabled and stopped.
Note * in _MC_GRP* is replaced by a number between 0 and 63 for the NX-series, and a number between 0 and
31 for the NJ/NY-series.
NY-series Motion Control Instructions Reference Manual (W561)
4-3
Function
* Specify a user-defined Axes Group Variable that was created in the Axes Group Basic Settings of the Sysmac Studio
(default: MC_Group***) or a system-defined axes group variable name (_MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*]).
4 Axes Group Instructions
Basic Function
• The MC_GroupEnable (Enable Axes Group) instruction places the axes group specified by AxesGroup into the GroupEnable state.
• When an axes group is in the GroupEnable state, you can execute any multi-axes coordinated control
instructions for the axes group.
• You can set only servo axes and virtual servo axes in an axes group. An error will occur if you include
other axis types.
• All axes that belong to an axes group must be in a stopped state to enable the group.
An axis is stopped if the Status.Disabled (Axis Disabled) or Status.Standstill (Standstill) in the Axis
Variable is TRUE.
• If there are axes that already belong to another axes group and the other axes group is enabled, the
MC_GroupEnable instruction is not executed and an error will occur if you attempt to execute it.
• When an axes group is enabled, the axes in the axes group change to Coordinated Motion status.
Status.Coordinated (Coordinated Motion) in the Axis Variable changes to TRUE.
• An axes group is disabled if the MC_GroupDisable (Disable Axes Group) instruction is executed, if
operation is stopped by changing to PROGRAM mode, or if a MC Test Run is started.
Precautions for Correct Use
• To use an axes group, create an axes group on the Sysmac Studio and download the settings
to the CPU Unit. You cannot change the axes in an axes group from the user program.
For a CPU Unit with unit version 1.01 or later and Sysmac Studio version 1.02 or higher, you
can use the MC_ChangeAxesInGroup (Change Axes in Group) instruction to temporarily
change axes groups.
• Use the Synchronize Menu of the Sysmac Studio to download the project.
Timing Charts
Execute
Done
Busy
CommandAborted
Error
ErrorID
Axes group state
4-4
16#0000
GroupDisable
GroupEnable
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Errors
If an error occurs during execution of the MC_GroupEnable instruction, Error will change to TRUE. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
Busy
Done
CommandAborted
Additional Information
MC_GroupEnable
Errors do not occur for individual axes in an axes group even if an error occurs for the axes
group.
4
Error
ErrorID
Error code
Function
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
4-5
4 Axes Group Instructions
MC_GroupDisable
The MC_GroupDisable instruction disables an axes group.
Instruction
MC_GroupDisable
Name
Disable Axes
Group
FB/
FUN
FB
Graphic expression
ST expression
MC_GroupDisable_instance
MC_GroupDisable_instance (
AxesGroup :=parameter,
Execute :=parameter,
Done =>parameter,
Busy =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_GroupDisable
AxesGroup
Execute
AxesGroup
Done
Busy
CommandAborted
Error
ErrorID
Variables
Input Variables
Name
Execute
Meaning
Execute
Data type
Valid range
BOOL
TRUE or FALSE
Data type
Valid range
Default
FALSE
Description
The instruction is executed when
Execute changes to TRUE.
Output Variables
Name
Meaning
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
4-6
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When the axes group state is changed to
GroupDisable.
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
Never changes to TRUE. (Reserved)
• When Execute is TRUE and changes to FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution
conditions or input parameters for the
instruction.
When the error is cleared.
MC_GroupDisable
Done
In-Out Variables
Name
Meaning
Data type
AxesGroup
Axes Group
_sGROUP_REF
Valid range
---
Description
4
Specify the axes group.*
Function
• The MC_GroupDisable instruction disables an axes group. For details on the axes group states, refer
to Function on page 4-3.
• The MC_GroupDisable (Disable Axes Group) instruction places the axes group specified by AxesGroup into the GroupDisable state. When an axes group is in the GroupDisable state, the axes group
stops acknowledging multi-axes coordinated control instructions.
• Any buffered instruction of the specified AxesGroup is cleared when the axes group state changes to
GroupDisable.
• The axes group is disabled even while operation is stopped.
When an axes group is disabled, the status of the axes in the axes group changes from TRUE for
Status.Coordinated (Coordinated Motion) to the status of each axis.
Use Status (Axis Status) in the Axis Variable to determine the status of each axis.
Timing Charts
Execute
Done
Busy
CommandAborted
Error
ErrorID
Axes group state
16#0000
GroupEnable
NY-series Motion Control Instructions Reference Manual (W561)
GroupDisable
4-7
Function
* Specify a user-defined Axes Group Variable that was created in the Axes Group Basic Settings of the Sysmac Studio
(default: MC_Group***) or a system-defined axes group variable name (_MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*]).
4 Axes Group Instructions
If you execute the MC_GroupDisable instruction for an AxisGroup that is under multi-axes coordinated
control, CommandAborted of multi-axes coordinated control instruction will change to TRUE. CommandAborted of any buffered multi-axes coordinated control instruction will also change to TRUE. If the
axes are moving, they will decelerate to a stop at the maximum deceleration rate for each axis.
Multi-axes Coordinated Control 1 (Example: MC_MoveLinearAbsolute)
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
Multi-axes Coordinated Control 2 (Example: MC_MoveLinearAbsolute with Buffered)
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
16#0000
MC_GroupDisable
Execute
Done
Busy
CommandAborted
Error
ErrorID
Axes group state
16#0000
GroupEnable
GroupDisable
Axes group velocity
4-8
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Errors
If an error occurs during execution of the MC_GroupDisable instruction, Error will change to TRUE. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
Done
Busy
Error
MC_GroupDisable
ErrorID
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
4
Function
NY-series Motion Control Instructions Reference Manual (W561)
4-9
4 Axes Group Instructions
MC_MoveLinear
The MC_MoveLinear instruction performs linear interpolation.
Instruction
MC_MoveLinear
FB/
FUN
Name
Linear Interpolation
FB
Graphic expression
ST expression
MC_MoveLinear_instance
MC_MoveLinear_instance (
AxesGroup :=parameter,
Execute :=parameter,
Position :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
CoordSystem :=parameter,
BufferMode :=parameter,
TransitionMode
:=parameter,
MoveMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
CommandAborted
Acceleration
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Variables
Input Variables
Default
Description
Execute
Name
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed
when Execute changes to
TRUE.
Position
Target
Position
ARRAY [0..3]
OF LREAL
Negative number, positive number, or 0
0
Specify the target position
for linear interpolation. The
unit is command units.*1
Velocity*2
Target
Velocity
LREAL
Positive number
0
Specify the target velocity.
The unit is command
units/s.*1
Acceleration
Acceleration Rate
LREAL
Non-negative number
0
Specify the acceleration
rate. The unit is command
units/s2.*1
Deceleration
Deceleration Rate
LREAL
Non-negative number
0
Specify the deceleration
rate. The unit is command
units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit is
command units/s3.
CoordSystem
Coordinate
System
_eMC_
COORD_
SYSTEM
0: _mcACS
0*3
Specify the coordinate system.
0: Axis coordinate system
(ACS)
4-10
Meaning
Data type
Valid range
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Name
BufferMode
Meaning
Buffer Mode
Selection
Data type
_eMC_
BUFFER_
MODE
Valid range
0: _mcAborting
Default
0*3
1: _mcBuffered
2: _mcBlendingLow
Description
Specify the behavior when
executing more than one
motion instruction.
0: Aborting
3: _mcBlendingPrevious
1: Buffered
4: _mcBlendingNext
2: Blending low
5: _mcBlendingHigh
3: Blending previous
4: Blending next
5: Blending high
TransitionMode
_eMC_
TRANSITION_
MODE
0: _mcTMNone
Travel Mode _eMC_MOVE_
MODE
0: _mcAbsolute
0*3
10: _mcTMCornerSuperimposed
Specify the path of motion.
0: Transition disabled
10: Superimpose corners
1: _mcRelative
0*3
Select the travel method.
0: Absolute positioning
1: Relative positioning
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or FALSE
TRUE when the axes group is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A
value of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
4
Variables
*2 Always set the target velocity. If the axes are moved without setting a target velocity, an error will occur.
MC_MoveLinear
MoveMode
Transition
Mode
4-11
4 Axes Group Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the axes move.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error.
• When this instruction is executed while there
is an error.
• When you start this instruction during
MC_GroupStop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
Meaning
AxesGroup
Axes Group
Data type
_sGROUP_REF
Valid range
---
Description
Specify the axes group.*
* Specify a user-defined Axes Group Variable that was created in the Axes Group Basic Settings of the Sysmac Studio
(default: MC_Group***) or a system-defined axes group variable name (_MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*]).
Function
• The MC_MoveLiner instruction performs linear interpolation for 2 to 4 axes.
Precautions for Correct Use
• An Instruction Execution Error with Undefined Home (error code: 5466 hex) occurs if home is
undefined for any of the composition axes in the axes group.
• You cannot execute an instruction to perform linear interpolation if a limit input is ON for any of
the logical axes that belong to the axes group.
Instruction Details
This section describes the instruction in detail.
z Linear Interpolation Procedure
Use the following procedure to perform linear interpolation.
4-12
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
1
Registering Axes Groups for Interpolation
• Select the axes group to perform interpolation.
An axes group is represented by _MC_GRP[*], or by _MC1_GRP[*] and _MC2_GRP[*].
• Specify the axis composition with Composition in the Axis Group Variable. You can specify
two to four axes.
• Specify the combination of axes to perform interpolation with the Axis Selection Axes Group
Variable.
• Use logical axes (axis A0 to A3) for the axes, and not axis numbers (axis 0 to 255).
• Specify axis numbers 0 to 255 for the logical axes A0 to A3 in order from the lowest number
using the Axis Selection Axes Group Variable.
Logical axis
Axis number*1
Axis 0 to Axis 255
Axis A1
Axis 0 to Axis 255
Axis A2
Axis 0 to Axis 255
Axis A3
Axis 0 to Axis 255
MC_MoveLinear
Axis A0
*1 The Axis number is “Axis 0 to Axis 63” in the case of NJ/NY-series.
Precautions for Correct Use
An Instruction Not Allowed for Encoder Axis Type error (543D hex) will occur and operation will
end if an encoder axis or virtual encoder axis is included in the axes group. Make sure that you
select only servo axes or virtual servo axes.
2
Enabling the Axes Group
• Turn ON the Servo for the composition axes of the axes group, and then define home for each
of the composition axes.
• Execute the MC_GroupEnable instruction to enable the registered axes group.
Using the Linear Interpolation instruction is now enabled.
NY-series Motion Control Instructions Reference Manual (W561)
4-13
4
Function
• In the Axes Group Basic Settings of the Sysmac Studio, select the axis composition to use
and assign an axis number to the logical axis. The following example shows a 3-axis axes
group that is called MC_Group000 with the following axes registered in it: MC_Axis000,
MC_Axis001, and MC_Axis002.
4 Axes Group Instructions
z Position (Target Position)
• Set the target position in Position (Target Position) for all of the axes specified in the Axis Selection
Axes Group Variable.
• You must create a 1×4 array variable in the Sysmac Studio to assign Position (A0, A1, A2, and
A3). You can use any variable name.
Assign the target positions for the axis to the elements of that array.
Always create a 1×4 array even if there are fewer than four axes in the axes group.
An example is shown below when the Pos1 array variable is declared on the Sysmac Studio.
The following example shows assigning the target positions to Pos1 with inline ST.
In the figure, target positions (1000.0, 2000.0, 3000.0) are assigned to axes A0 to A2.
EnterVariable
1 Pos1[0] : =LREAL#1000.0; (* A0 *)
2 Pos1[1] : =LREAL#2000.0; (* A1 *)
3 Pos1[2] : =LREAL#3000.0; (* A2 *)
• If an axis with the Count Mode set to Rotary Mode is set as an interpolation axis and you specify
absolute position, the target value will be the same as if Direction was set to No direction specified.
For details, refer to Direction on page 3-50.
4-14
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Velocity (Target Velocity), Acceleration (Acceleration Rate), Deceleration
(Deceleration Rate), and Jerk
Set Velocity, Acceleration, Deceleration, and Jerk to specify the interpolation velocity, acceleration
rate, deceleration rate, and jerk for linear interpolation. Linear interpolation separates the interpolated motion into motion on each axis. As an example, the following figure shows linear interpolation
of 2 axes from point A to point B.
Y
B
L
MC_MoveLinear
La1
Td
F
Fa1
4
Ta
Function
A
La0
X
Fa0
Axis A1 motion
Axis A0 motion
Ta
Td
For linear interpolation of four axes, the interpolation velocity and travel distance of each axis determine
the target velocities as shown below.
F: Specified interpolation feeding velocity
Fa0: Interpolation feeding velocity based on expansion of F to axis A0
Fa1: Interpolation feeding velocity based on expansion of F to axis A1
Fa2: Interpolation feeding velocity based on expansion of F to axis A2
Fa3: Interpolation feeding velocity based on expansion of F to axis A3
Ta: Interpolation acceleration time
Td: Interpolation deceleration time
L: Travel distance on the specified path
La0, La1, La2, and La3: Travel distances of axis A0, axis A1, axis A2, and axis A3.
NY-series Motion Control Instructions Reference Manual (W561)
4-15
4 Axes Group Instructions
L, Fa0, Fa1, Fa2, and Fa3 can be expressed with the following formulas.
Fa0 = F
×
Fa1 = F
×
Fa2 = F
×
Fa3 = F
×
L=
2
La0
L
La1
L
La2
L
La3
L
2
2
2
La0 + La1 + La2 + La3
Velocity (Target Velocity)
• An interpolation velocity specification error will occur if Velocity (Target Velocity) is set to 0. All
axes will stop if an axis in the specified axes group is in operation.
• If any of the calculated target velocities Fa0 to Fa3 for Velocity (Target Velocity) exceed the maximum velocity, the Velocity (Target Velocity) will be automatically adjusted so that one of the axes
operates at the maximum velocity.
Jerk
The relationships between Acceleration (Acceleration Rate), Deceleration (Deceleration Rate), and
Velocity (Target Velocity) when Jerk is set to 0 and when it is set to any other value are shown below.
• Jerk Set to 0
The command value for the velocity is created with acceleration rate At and deceleration rate Dt.
Interpolation velocity
Vt
Time
Acceleration rate At
Time
Deceleration rate -Dt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate.
4-16
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
• Short Travel Distance When Jerk Is 0
The interpolation velocity will not reach the specified Vt (Target Velocity).
Interpolation velocity
Vt
Time
Time
Deceleration rate -Dt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate.
Interpolation velocity
Vt
Time
Acceleration rate At
Deceleration rate -Dt
Time
Jt
Jerk
Time
-Jt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate,
Jt: Specified jerk
NY-series Motion Control Instructions Reference Manual (W561)
4-17
4
Function
• Jerk Set to Value Other Than 0
The command value for the velocity is created with At as the upper acceleration limit and Dt as the
upper deceleration limit.
MC_MoveLinear
Acceleration rate At
4 Axes Group Instructions
• Short Travel Distance When Jerk Is Not 0
The interpolation velocity will not reach the specified Vt (Target Velocity).
Interpolation velocity
Vt
Time
Acceleration rate
At
Deceleration rate
-Dt
Time
Jt
Jerk
Time
-Jt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate,
Jt: Specified jerk
Additional Information
• If 0 is specified for Acceleration (Acceleration Rate), the specified Velocity (Target Velocity) is
used immediately.
• If 0 is specified for Deceleration (Deceleration Rate), the axis stops immediately. However, if
the Buffer Mode is set to a blending mode, axis operation will change to the target velocity
specified by the next operation without stopping. For details, refer to BufferMode (Buffer Mode
Selection) on page 4-19.
• When the Acceleration (Acceleration Rate) or Deceleration (Deceleration Rate) is 0, the jerk
setting is disabled.
z CoordSystem (Coordinate System)
CoordSystem specifies the coordinate system to use for linear interpolation. Only an axis coordinate
system (ACS) consisting of two or more axes is supported.
4-18
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z BufferMode (Buffer Mode Selection)
• BufferMode specifies how to join the axis motions for this interpolation instruction and the previous
interpolation instruction.
• There are the following six settings.
Buffer Mode Selection
Description
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion
will be reversed according to the Operation Selection at Reversing axis
parameter.
Buffered
Buffers this instruction and executes it automatically after the current instruction is completed.
Blending
Starts the buffered instruction at the velocity (transit velocity) at which the current instruction reaches the target position. The operation of the current
instruction is changed so that the axes reach the target position at the transit
velocity. There are four methods to specify the transit velocity. These are
described below. You can also specify a Transition Mode as an option to the
Blending Mode (see below).
Blending low
The lower of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
Blending previous
The target velocity of the current instruction is used as the transit velocity.
The target velocity of the buffered instruction is used as the transit velocity.
Blending high
The higher of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z TransitionMode
• TransitionMode specifies how to combine the paths created by the previous interpolation operation and the next interpolation operation.
• Set the TransitionMode to either _mcTMNone (Transition Disabled) or _mcTMCornerSuperimposed (Superimpose Corners).
• TransitionMode is enabled when blending is specified for BufferMode.
• An error will occur if you do not set TransitionMode to _mcTMNone (Transition Disabled) when
blending is not used.
NY-series Motion Control Instructions Reference Manual (W561)
4-19
4
Function
Blending next
MC_MoveLinear
Aborting
4 Axes Group Instructions
Transition Disabled
The path is given priority when creating the velocity command value, so velocity command values of
the axes may change rapidly when switching from one operation to the next.
Operation Example
The Velocity (Target Velocity), BufferMode, and TransitionMode when transitioning from P1 to P2,
and from P2 to P3 are shown below.
• Motion from P1 to P2: Velocity = F, BufferMode = Aborting, TransitionMode = _mcTMNone (Transition Disabled)
• Motion from P2 to P3: Velocity = F, BufferMode = Blend with next, TransitionMode = _mcTMNone
(Transition Disabled)
• The motion starts from position P1 and goes through position P2. Linear interpolation is performed to position P3.
• The linear interpolation velocity F is maintained when passing position P2. Because of this, the
velocity is discontinuous at position P2 as shown in the following figure.
A1
P3
Interpolation
velocity F
The velocity is
discontinuous.
P1
P2
The velocity is
discontinuous.
A0
Velocity of axis A1
Velocity of axis A0
4-20
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Superimpose Corners
Use the superimpose corners specification when you want make the axes command velocities continuous.
Operation Example
The Velocity (Target Velocity), BufferMode, and TransitionMode when transitioning from P1 to P2,
and from P2 to P3 are shown below.
• Motion from P1 to P2: Velocity = F, BufferMode = Aborting, TransitionMode = _mcTMNone (Transition Disabled)
• Motion from P2 to P3: Velocity = F, BufferMode = Blend with next, TransitionMode = _mcTMCornerSuperimposed (Superimpose Corners)
• To make the axes command velocities continuous, the deceleration range of the previous motion
and the acceleration range of the current motion are combined to create the command velocity.
For this reason, the acceleration time of the current motion is the same as the deceleration time of
the previous motion.
A1
P3
MC_MoveLinear
• The motion starts from position P1 and passes near position P2. Linear interpolation is performed
to position P3.
4
Function
The velocity is
continuous.
The path goes
near P2.
The velocity command is
made continuous by
combining the deceleration
range of the previous
motion and the acceleration
range of the current motion.
P1
P2
A0
Velocity of axis A1
Velocity of axis A0
The combined path passes near P2.
The distance from P2 to the path is longer when the interpolation velocity is faster or the deceleration rate of the previous instruction is smaller. It is shorter when the interpolation velocity is slower or
the deceleration rate of the previous instruction is larger.
Additional Information
The Jerk settings are disabled in the region with superimposed corners.
NY-series Motion Control Instructions Reference Manual (W561)
4-21
4 Axes Group Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed. A Motion Control Instruction Re-execution Disabled error (error
code: 543B hex) occurs if re-execution is attempted, and all axes in the linear interpolation motion stop.
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID
Error code
16#0000
Interpolation velocity
Time
Multi-execution of Motion Control Instructions
A restriction applies to the instructions that can be used while this instruction is in execution.
For details on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion
Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion
Control User’s Manual (Cat. No. W559).
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axes will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID 16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
4-22
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Sample Programming
This section shows sample programming for linear interpolation with periodic multi-execution of instructions.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
MC_MoveLinear
Axis Types
Axis
Axis Type
Axis 1
Servo axis
Axis 2
Servo axis
Count Modes
Axis
4
Count Mode
Linear Mode
Axis 2
Linear Mode
Sample Programming
Axis 1
Units of Display
Axis
Unit of Display
Axis 1
mm
Axis 2
mm
z Axes Group Parameter Settings
Axis Composition
Two axes are set.
Axis Selection
Axis 1 and axis 2 are set.
NY-series Motion Control Instructions Reference Manual (W561)
4-23
4 Axes Group Instructions
Operation Example
The following is an example of operation that performs linear interpolation automatically and
then returns to home and stops. Linear interpolations (2) to (7) are executed with multi-execution of instructions while linear interpolation (1) is being executed. Set the Buffer Mode
Selection to Buffered. In this sample, multi-execution of instructions is performed for (2) to
(7) if the Active (Controlling) output variable from linear interpolation (1) is TRUE. For multiaxes coordinated operation, multi-execution is possible for up to seven instructions.
z Operation Pattern
Axis 2 (mm)
Positive direction
25.00
(5)
20.00
(4)
15.00
(3)
(6)
10.00
(2)
5.00
(1)
0.00
(7)
50.00
Positive direction
Axis 1 (mm)
Positioning is performed using linear interpolations in the order (Axis1, Axis2) = (50.00 mm, 5.00
mm) → (0.00 mm, 10.00 mm) → (50.00 mm, 15.00 mm) → (0.00 mm, 20.00 mm) → (50.00 mm,
25.00 mm) → (50.00 mm, 0.00 mm) → (0.00 mm, 0.00 mm), then stop.
Ladder Diagram
z Main Variables
Name
MC_Group000
Default
---
MC_Group000.MFaultLvl.Active
Data type
_sGROUP
_REF
BOOL
MC_Group000.Status.Disabled
BOOL
FALSE
MC_Axis000
MC_Axis000.Details.Homed
MC_Axis000.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
MC_Axis001
MC_Axis001.Details.Homed
MC_Axis001.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
BOOL
FALSE
Pwr1_Status
4-24
FALSE
Comment
This is the Axes Group Variable for axes group
0.
TRUE while there is a minor fault level error for
axes group 0.
The value is TRUE when axes group 0 is disabled.
This is the Axis Variable for axis 1.
TRUE when home is defined for axis 1.
TRUE while there is a minor fault level error for
axis 1.
This is the Axis Variable for axis 2.
TRUE when home is defined for axis 2.
TRUE while there is a minor fault level error for
axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Name
Data type
BOOL
Default
FALSE
StartPg
BOOL
FALSE
InitFlag
BOOL
FALSE
Pwr2_Status
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_PDSlavTbl[MC_Axis001.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
PWR1
MC_Power
Lock1
MC_Axis000
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
PWR2
MC_Power
Lock2
MC_Axis001
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
MC_Group000.MFaultLvl.Active
NY-series Motion Control Instructions Reference Manual (W561)
4-25
4
Sample Programming
If process data communications are active, the Servo is turned ON for the axes.
MC_MoveLinear
Comment
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servos for the axes in the axes group are
turned ON if this variable is TRUE and EtherCAT process data communications are established.
This variable indicates if it is necessary to set
the input parameters. Input parameters are set
when this variable is FALSE. When setting the
input parameters is completed, this variable
changes to TRUE.
4 Axes Group Instructions
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed to define home.
HM1
MC_Home
Pwr1_Status
MC_Axis000
MC_Axis000.Details.Homed
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed to define home.
HM2
MC_Home
Pwr2_Status
MC_Axis001
MC_Axis001.Details.Homed
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
After home is defined for axis 1 and axis 2, the axes group is enabled.
GRP_EN
Hm1_D Hm2_D MC_Group000.Status.Disabled MC_Group000
MC_GroupEnable
AxesGroup
AxesGroup
Done
Execute
Busy
CommandAborted
Error
ErrorID
Grp_En_D
Grp_En_Bsy
Grp_En_Ca
Grp_En_Err
Grp_En_ErrID
The parameters are set for linear interpolation.
InitFlag
Note: The contents of the inline
ST are given below.
If the axes group is enabled, linear interpolation (1) is executed.
MV_LIN1
Grp_En_D
MC_Group000
Mv_Lin1_Pos
Mv_Lin1_Vel
Mv_Lin1_Acc
Mv_Lin1_Dec
Mv_Lin1_Mm
4-26
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Lin1_D
Mv_Lin1_Bsy
Mv_Lin1_Act
Mv_Lin1_Ca
Mv_Lin1_Err
Mv_Lin1_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Linear interpolation (2) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN2
Mv_Lin1_Act
MC_Group000
Mv_Lin2_Pos
Mv_Lin2_Vel
Mv_Lin2_Acc
Mv_Lin2_Dec
Mv_Lin2_Bm
Mv_Lin2_D
Mv_Lin2_Bsy
Mv_Lin2_Act
Mv_Lin2_Ca
Mv_Lin2_Err
Mv_Lin2_ErrID
MC_MoveLinear
Mv_Lin2_Mm
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Linear interpolation (3) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN3
Mv_Lin1_Act
MC_Group000
Mv_Lin3_Bm
Mv_Lin3_Mm
Mv_Lin3_D
4
Mv_Lin3_Bsy
Mv_Lin3_Act
Mv_Lin3_Ca
Mv_Lin3_Err
Mv_Lin3_ErrID
Sample Programming
Mv_Lin3_Pos
Mv_Lin3_Vel
Mv_Lin3_Acc
Mv_Lin3_Dec
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Linear interpolation (4) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN4
Mv_Lin1_Act
MC_Group000
Mv_Lin4_Pos
Mv_Lin4_Vel
Mv_Lin4_Acc
Mv_Lin4_Dec
Mv_Lin4_Bm
Mv_Lin4_Mm
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Lin4_D
Mv_Lin4_Bsy
Mv_Lin4_Act
Mv_Lin4_Ca
Mv_Lin4_Err
Mv_Lin4_ErrID
4-27
4 Axes Group Instructions
Linear interpolation (5) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN5
MC_Group000
Mv_Lin1_Act
Mv_Lin5_Pos
Mv_Lin5_Vel
Mv_Lin5_Acc
Mv_Lin5_Dec
Mv_Lin5_Bm
Mv_Lin5_Mm
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Lin5_D
Mv_Lin5_Bsy
Mv_Lin5_Act
Mv_Lin5_Ca
Mv_Lin5_Err
Mv_Lin5_ErrID
Linear interpolation (6) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN6
MC_Group000
Mv_Lin1_Act
Mv_Lin6_Pos
Mv_Lin6_Vel
Mv_Lin6_Acc
Mv_Lin6_Dec
Mv_Lin6_Bm
Mv_Lin6_Mm
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Lin6_D
Mv_Lin6_Bsy
Mv_Lin6_Act
Mv_Lin6_Ca
Mv_Lin6_Err
Mv_Lin6_ErrID
Linear interpolation (7) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN7
MC_Group000
Mv_Lin1_Act
Mv_Lin7_Pos
Mv_Lin7_Vel
Mv_Lin7_Acc
Mv_Lin7_Dec
Mv_Lin7_Bm
Mv_Lin7_Mm
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Lin7_D
Mv_Lin7_Bsy
Mv_Lin7_Act
Mv_Lin7_Ca
Mv_Lin7_Err
Mv_Lin7_ErrID
Contents of Inline ST
4-28
// MV_LIN1 parameters
Mv_Lin1_Pos[0]
Mv_Lin1_Pos[1]
Mv_Lin1_Vel
Mv_Lin1_Acc
Mv_Lin1_Dec
Mv_Lin1_Mm
:= LREAL#50.0;
:= LREAL#5.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN2 parameters
Mv_Lin2_Pos[0]
Mv_Lin2_Pos[1]
Mv_Lin2_Vel
Mv_Lin2_Acc
:= LREAL#0.0;
:= LREAL#10.0;
:= LREAL#100.0;
:= LREAL#100.0;
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Mv_Lin2_Dec
Mv_Lin2_Bm
Mv_Lin2_Mm
:= LREAL#100.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
:= LREAL#50.0;
:= LREAL#15.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN4 parameters
Mv_Lin4_Pos[0]
Mv_Lin4_Pos[1]
Mv_Lin4_Vel
Mv_Lin4_Acc
Mv_Lin4_Dec
Mv_Lin4_Bm
Mv_Lin4_Mm
:= LREAL#0.0;
:= LREAL#20.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN5 parameters
Mv_Lin5_Pos[0]
Mv_Lin5_Pos[1]
Mv_Lin5_Vel
Mv_Lin5_Acc
Mv_Lin5_Dec
Mv_Lin5_Bm
Mv_Lin5_Mm
:= LREAL#50.0;
:= LREAL#25.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN6 parameters
Mv_Lin6_Pos[0]
Mv_Lin6_Pos[1]
Mv_Lin6_Vel
Mv_Lin6_Acc
Mv_Lin6_Dec
Mv_Lin6_Bm
Mv_Lin6_Mm
:= LREAL#50.0;
:= LREAL#0.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN7 parameters
Mv_Lin7_Pos[0]
Mv_Lin7_Pos[1]
Mv_Lin7_Vel
Mv_Lin7_Acc
Mv_Lin7_Dec
Mv_Lin7_Bm
Mv_Lin7_Mm
:= LREAL#0.0;
:= LREAL#0.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= LREAL#100.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
MC_MoveLinear
// MV_LIN3 parameters
Mv_Lin3_Pos[0]
Mv_Lin3_Pos[1]
Mv_Lin3_Vel
Mv_Lin3_Acc
Mv_Lin3_Dec
Mv_Lin3_Bm
Mv_Lin3_Mm
4
Sample Programming
// InitFlag is changed to TRUE after input parameters are set.
InitFlag := TRUE;
NY-series Motion Control Instructions Reference Manual (W561)
4-29
4 Axes Group Instructions
Structured Text (ST)
z Main Variables
Name
MC_Group000
Default
---
MC_Group000.MFaultLvl.Active
Data type
_sGROUP
_REF
BOOL
MC_Group000.Status.Disabled
BOOL
FALSE
MC_Axis000
MC_Axis000.Details.Homed
MC_Axis000.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
MC_Axis001
MC_Axis001.Details.Homed
MC_Axis001.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
Pwr1_Status
BOOL
FALSE
Pwr2_Status
BOOL
FALSE
StartPg
BOOL
FALSE
InitFlag
BOOL
FALSE
FALSE
Comment
This is the Axes Group Variable for axes group
0.
TRUE while there is a minor fault level error for
axes group 0.
The value is TRUE when axes group 0 is disabled.
This is the Axis Variable for axis 1.
TRUE when home is defined for axis 1.
TRUE while there is a minor fault level error for
axis 1.
This is the Axis Variable for axis 2.
TRUE when home is defined for axis 2.
TRUE while there is a minor fault level error for
axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servos for the axes in the axes group are
turned ON if this variable is TRUE and EtherCAT process data communications are established.
This variable indicates if it is necessary to set
the input parameters. Input parameters are set
when this variable is FALSE. When setting the
input parameters is completed, this variable
changes to TRUE.
z Sample Programming
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MV_LIN1 parameters
Mv_Lin1_Pos[0]
:= LREAL#50.0;
Mv_Lin1_Pos[1]
:= LREAL#5.0;
Mv_Lin1_Vel
:= LREAL#100.0;
Mv_Lin1_Acc
:= LREAL#100.0;
Mv_Lin1_Dec
:= LREAL#100.0;
Mv_Lin1_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
4-30
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
// MV_LIN2 parameters
Mv_Lin2_Pos[0]
:= LREAL#0.0;
Mv_Lin2_Pos[1]
:= LREAL#10.0;
Mv_Lin2_Vel
:= LREAL#100.0;
Mv_Lin2_Acc
:= LREAL#100.0;
Mv_Lin2_Dec
:= LREAL#100.0;
Mv_Lin2_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin2_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
MC_MoveLinear
// MV_LIN3 parameters
Mv_Lin3_Pos[0]
:= LREAL#50.0;
Mv_Lin3_Pos[1]
:= LREAL#15.0;
Mv_Lin3_Vel
:= LREAL#100.0;
Mv_Lin3_Acc
:= LREAL#100.0;
Mv_Lin3_Dec
:= LREAL#100.0;
Mv_Lin3_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin3_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN4 parameters
Mv_Lin4_Pos[0]
:= LREAL#0.0;
Mv_Lin4_Pos[1]
:= LREAL#20.0;
Mv_Lin4_Vel
:= LREAL#100.0;
Mv_Lin4_Acc
:= LREAL#100.0;
Mv_Lin4_Dec
:= LREAL#100.0;
Mv_Lin4_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin4_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
4
Sample Programming
// MV_LIN5 parameters
Mv_Lin5_Pos[0]
:= LREAL#50.0;
Mv_Lin5_Pos[1]
:= LREAL#25.0;
Mv_Lin5_Vel
:= LREAL#100.0;
Mv_Lin5_Acc
:= LREAL#100.0;
Mv_Lin5_Dec
:= LREAL#100.0;
Mv_Lin5_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin5_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN6 parameters
Mv_Lin6_Pos[0]
:= LREAL#50.0;
Mv_Lin6_Pos[1]
:= LREAL#0.0;
Mv_Lin6_Vel
:= LREAL#100.0;
Mv_Lin6_Acc
:= LREAL#100.0;
Mv_Lin6_Dec
:= LREAL#100.0;
Mv_Lin6_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin6_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN7 parameters
Mv_Lin7_Pos[0]
:= LREAL#0.0;
Mv_Lin7_Pos[1]
:= LREAL#0.0;
Mv_Lin7_Vel
:= LREAL#100.0;
Mv_Lin7_Acc
:= LREAL#100.0;
Mv_Lin7_Dec
:= LREAL#100.0;
Mv_Lin7_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin7_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, the Servo is turned OFF.
IF (StartPg=TRUE)
AND (_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]=TRUE)
NY-series Motion Control Instructions Reference Manual (W561)
4-31
4 Axes Group Instructions
AND (_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]=FALSE) THEN
Pwr1_En:=TRUE;
// Turn ON the Servo for axis 1.
ELSE
Pwr1_En:=FALSE;
// Turn OFF the Servo for axis 1.
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo for axis 2.
ELSE
Pwr2_En:=FALSE;
// Turn OFF the Servo for axis 2.
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF (MC_Axis000.MFaultLvl.Active=TRUE) OR (MC_Axis001.MFaultLvl.Active=TRUE) OR
(MC_Group000.MFaultLvl.Active=TRUE)THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed.
IF (Pwr1_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed.
IF (Pwr2_Status=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// If axes group 0 is disabled while home is defined for axis 1 and axis 2, it is enabled.
IF (Hm1_D=TRUE) AND (Hm2_D=TRUE) AND (MC_Group000.Status.Disabled=TRUE) THEN
Grp_En_Ex:= TRUE;
END_IF;
// After the MC_GroupEnable (Enable Axes Group) instruction is completed, linear interpolation (1) is executed.
IF Grp_En_D=TRUE THEN
Mv_Lin1_Ex:=TRUE;
END_IF;
// Linear interpolations (2) to (7) are executed with multi-execution of instructions while the Active output
variable for linear interpolation (1) is TRUE.
IF Mv_Lin1_Act=TRUE THEN
Mv_Lin2_Ex:=TRUE;
Mv_Lin3_Ex:=TRUE;
Mv_Lin4_Ex:=TRUE;
Mv_Lin5_Ex:=TRUE;
Mv_Lin6_Ex:=TRUE;
Mv_Lin7_Ex:=TRUE;
END_IF;
// MC_Power for axis 1
PWR1(
Axis
:= MC_Axis000,
Enable
:= Pwr1_En,
Status
=> Pwr1_Status,
Busy
=> Pwr1_Bsy,
Error
=> Pwr1_Err,
ErrorID
=> Pwr1_ErrID
);
// MC_Power for axis 2
4-32
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
PWR2(
Axis
Enable
Status
Busy
Error
ErrorID
);
:= MC_Axis001,
:= Pwr2_En,
=> Pwr2_Status,
=> Pwr2_Bsy,
=> Pwr2_Err,
=> Pwr2_ErrID
4
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
Sample Programming
// MC_Home for axis 2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
MC_MoveLinear
// MC_Home for axis 1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
// Axes group 0 is enabled.
GRP_EN(
AxesGroup
:= MC_Group000,
Execute
:= Grp_En_Ex,
Done
=> Grp_En_D,
Busy
=> Grp_En_Bsy,
CommandAborted => Grp_En_Ca,
Error
=> Grp_En_Err,
ErrorID
=> Grp_En_ErrID
);
// Linear interpolation (1)
MV_LIN1(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin1_Ex,
Position
:= Mv_Lin1_Pos,
Velocity
:= Mv_Lin1_Vel,
Acceleration
:= Mv_Lin1_Acc,
Deceleration
:= Mv_Lin1_Dec,
MoveMode
:= Mv_Lin1_Mm,
Done
=> Mv_Lin1_D,
Busy
=> Mv_Lin1_Bsy,
Active
=> Mv_Lin1_Act,
CommandAborted => Mv_Lin1_Ca,
Error
=> Mv_Lin1_Err,
ErrorID
=> Mv_Lin1_ErrID
);
// Linear interpolation (2)
MV_LIN2(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin2_Ex,
Position
:= Mv_Lin2_Pos,
NY-series Motion Control Instructions Reference Manual (W561)
4-33
4 Axes Group Instructions
Velocity
Acceleration
Deceleration
BufferMode
MoveMode
Done
Busy
Active
CommandAborted
Error
ErrorID
:= Mv_Lin2_Vel,
:= Mv_Lin2_Acc,
:= Mv_Lin2_Dec,
:= Mv_Lin2_Bm,
:= Mv_Lin2_Mm,
=> Mv_Lin2_D,
=> Mv_Lin2_Bsy,
=> Mv_Lin2_Act,
=> Mv_Lin2_Ca,
=> Mv_Lin2_Err,
=> Mv_Lin2_ErrID
);
// Linear interpolation (3)
MV_LIN3(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin3_Ex,
Position
:= Mv_Lin3_Pos,
Velocity
:= Mv_Lin3_Vel,
Acceleration
:= Mv_Lin3_Acc,
Deceleration
:= Mv_Lin3_Dec,
BufferMode
:= Mv_Lin3_Bm,
MoveMode
:= Mv_Lin3_Mm,
Done
=> Mv_Lin3_D,
Busy
=> Mv_Lin3_Bsy,
Active
=> Mv_Lin3_Act,
CommandAborted => Mv_Lin3_Ca,
Error
=> Mv_Lin3_Err,
ErrorID
=> Mv_Lin3_ErrID
);
// Linear interpolation (4)
MV_LIN4(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin4_Ex,
Position
:= Mv_Lin4_Pos,
Velocity
:= Mv_Lin4_Vel,
Acceleration
:= Mv_Lin4_Acc,
Deceleration
:= Mv_Lin4_Dec,
BufferMode
:= Mv_Lin4_Bm,
MoveMode
:= Mv_Lin4_Mm,
Done
=> Mv_Lin4_D,
Busy
=> Mv_Lin4_Bsy,
Active
=> Mv_Lin4_Act,
CommandAborted => Mv_Lin4_Ca,
Error
=> Mv_Lin4_Err,
ErrorID
=> Mv_Lin4_ErrID
);
// Linear interpolation (5)
MV_LIN5(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin5_Ex,
Position
:= Mv_Lin5_Pos,
Velocity
:= Mv_Lin5_Vel,
Acceleration
:= Mv_Lin5_Acc,
Deceleration
:= Mv_Lin5_Dec,
BufferMode
:= Mv_Lin5_Bm,
MoveMode
:= Mv_Lin5_Mm,
Done
=> Mv_Lin5_D,
Busy
=> Mv_Lin5_Bsy,
Active
=> Mv_Lin5_Act,
CommandAborted => Mv_Lin5_Ca,
Error
=> Mv_Lin5_Err,
ErrorID
=> Mv_Lin5_ErrID
4-34
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
);
4
Sample Programming
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveLinear
// Linear interpolation (6)
MV_LIN6(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin6_Ex,
Position
:= Mv_Lin6_Pos,
Velocity
:= Mv_Lin6_Vel,
Acceleration
:= Mv_Lin6_Acc,
Deceleration
:= Mv_Lin6_Dec,
BufferMode
:= Mv_Lin6_Bm,
MoveMode
:= Mv_Lin6_Mm,
Done
=> Mv_Lin6_D,
Busy
=> Mv_Lin6_Bsy,
Active
=> Mv_Lin6_Act,
CommandAborted => Mv_Lin6_Ca,
Error
=> Mv_Lin6_Err,
ErrorID
=> Mv_Lin6_ErrID
);
// Linear interpolation (7)
MV_LIN7(
AxesGroup
:= MC_Group000,
Execute
:= Mv_Lin7_Ex,
Position
:= Mv_Lin7_Pos,
Velocity
:= Mv_Lin7_Vel,
Acceleration
:= Mv_Lin7_Acc,
Deceleration
:= Mv_Lin7_Dec,
BufferMode
:= Mv_Lin7_Bm,
MoveMode
:= Mv_Lin7_Mm,
Done
=> Mv_Lin7_D,
Busy
=> Mv_Lin7_Bsy,
Active
=> Mv_Lin7_Act,
CommandAborted => Mv_Lin7_Ca,
Error
=> Mv_Lin7_Err,
ErrorID
=> Mv_Lin7_ErrID
);
4-35
4 Axes Group Instructions
MC_MoveLinearAbsolute
The MC_MoveLinearAbsolute instruction performs linear interpolation for a specified absolute position.
Instruction
Name
MC_MoveLinearAbsolute Absolute
Linear
Interpolation
FB/
FUN
FB
Graphic expression
ST expression
MC_MoveLinearAbsolute_instance
MC_MoveLinearAbsolute_
instance (
AxesGroup :=parameter,
Execute :=parameter,
Position :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
CoordSystem :=parameter,
BufferMode :=parameter,
TransitionMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveLinearAbsolute
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
CommandAborted
Acceleration
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when Execute
changes to TRUE.
Position
Target
Position
ARRAY [0..3]
OF LREAL
Negative number, positive number, or 0
0
Specify the target position
for linear interpolation.
The unit is command
units.*1
Velocity*2
Target
Velocity
LREAL
Positive number
0
Specify the target velocity.
The unit is command
units/s.*1
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration
rate. The unit is command
units/s2.*1
Deceleration
Deceleration
Rate
LREAL
Non-negative number
0
Specify the deceleration
rate. The unit is command
units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The unit
is command units/s3.*1
4-36
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Name
CoordSystem
BufferMode
Meaning
Coordinate
System
Buffer Mode
Selection
Data type
Valid range
_eMC_
COORD_
SYSTEM
0: _mcACS
_eMC_
BUFFER_
MODE
0: _mcAborting
Default
0*3
Description
Specify the coordinate
system.
0: Axis coordinate system (ACS)
0*3
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
Specify the behavior
when executing more
than one motion instruction.
MC_MoveLinearAbsolute
0: Aborting
4: _mcBlendingNext
1: Buffered
5: _mcBlendingHigh
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
TransitionMode
Transition
Mode
_eMC_
0: _mcTMNone
TRANSITION_ 10: _mcTMCornerSuperimposed
MODE
0*3
Specify the path of
motion.
0: Transition disabled
10: Superimpose corners
*2 Always set the target velocity. If the axes are moved without setting a target velocity, an error will occur.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axes group is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
NY-series Motion Control Instructions Reference Manual (W561)
4-37
Variables
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
4
4 Axes Group Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the axis starts moving.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error.
• When this instruction is executed while there
is an error.
• When you start this instruction during
MC_GroupStop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
AxesGroup
Meaning
Data type
Axes Group
_sGROUP_REF
Valid range
---
Description
Specify the axes group.*
* Specify a user-defined Axes Group Variable that was created in the Axes Group Basic Settings of the Sysmac Studio
(default: MC_Group***) or a system-defined axes group variable name (_MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*]).
Function
• The MC_MoveLinearAbsolute instruction performs linear interpolation for 2 to 4 axes.
• The target position is specified as an absolute position.
Other specifications are the same as those for the MC_MoveLinear (Linear Interpolation) instruction.
For details, refer to Function on page 4-12.
Precautions for Correct Use
• An Instruction Execution Error with Undefined Home (error code: 5466 hex) occurs if home is
undefined for any of the composition axes in the axes group.
• You cannot execute an instruction to perform linear interpolation if a limit input is ON for any of
the logical axes that belong to the axes group.
4-38
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
MC_MoveLinearRelative
The MC_MoveLinearRelative instruction performs linear interpolation for a specified relative position.
Instruction
Name
MC_MoveLinearRelative
FB
ST expression
MC_MoveLinearRelative_instance
MC_MoveLinearRelative_
instance (
AxesGroup :=parameter,
Execute :=parameter,
Distance :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
CoordSystem :=parameter,
BufferMode :=parameter,
TransitionMode
:=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveLinearRelative
AxesGroup
AxesGroup
Done
Execute
Busy
Distance
Velocity
Active
CommandAborted
Acceleration
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when Execute
changes to TRUE.
Distance
Travel
Distance
ARRAY [0..3]
OF LREAL
Negative number, positive number, or 0
0
Specify the target
position for linear
interpolation. The unit
is command units.*1
Velocity*2
Target
Velocity
LREAL
Positive number
0
Specify the target
velocity. The unit is
command units/s.*1
Acceleration
Acceleration Rate
LREAL
Non-negative number
0
Specify the acceleration rate. The unit is
command units/s2.*1
Deceleration
Deceleration Rate
LREAL
Non-negative number
0
Specify the deceleration rate. The unit is
command units/s2.*1
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The
unit is command
units/s3.*1
NY-series Motion Control Instructions Reference Manual (W561)
4-39
4
Variables
Graphic expression
MC_MoveLinearRelative
Relative
Linear
Interpolation
FB/
FUN
4 Axes Group Instructions
Name
CoordSystem
BufferMode
Meaning
Coordinate
System
Buffer Mode
Selection
Data type
Valid range
_eMC_
COORD_
SYSTEM
0: _mcACS
_eMC_
BUFFER_
MODE
0: _mcAborting
Default
0*3
Description
Specify the coordinate
system.
0: Axis coordinate
system (ACS)
0*3
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
Specify the behavior
when executing more
than one motion
instruction.
0: Aborting
4: _mcBlendingNext
1: Buffered
5: _mcBlendingHigh
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
TransitionMode
Transition
Mode
_eMC_
TRANSITION_
MODE
0: _mcTMNone
0*3
10: _mcTMCornerSuperimposed
Specify the path of
motion.
0: Transition disabled
10: Superimpose corners
*1 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*2 Always set the target velocity. If the axes are moved without setting a target velocity, an error will occur.
*3 The default value for an enumeration variable is actually not the number, but the enumerator.
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axes group is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
4-40
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the axis starts moving.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error.
• When this instruction is executed while there
is an error.
• When you start this instruction during
MC_GroupStop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
Error
4
Function
In-Out Variables
Name
AxesGroup
Meaning
Data type
Axes Group
_sGROUP_REF
Valid range
---
Description
Specify the axes group.*
* Specify a user-defined Axes Group Variable that was created in the Axes Group Basic Settings of the Sysmac Studio
(default: MC_Group***) or a system-defined axes group variable name (_MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*]).
Function
• The MC_MoveLinearRelative instruction performs linear interpolation for 2 to 4 axes.
• The target position is specified as a relative position.
Other specifications are the same as those for the MC_MoveLinear (Linear Interpolation) instruction.
For details, refer to Function on page 4-12.
Precautions for Correct Use
• An Instruction Execution Error with Undefined Home (error code: 5466 hex) occurs if home is
undefined for any of the composition axes in the axes group.
• You cannot execute an instruction to perform linear interpolation if a limit input is ON for any of
the logical axes that belong to the axes group.
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveLinearRelative
Done
4-41
4 Axes Group Instructions
MC_MoveCircular2D
The MC_MoveCircular2D instruction performs circular interpolation for two axes.
FB/
FUN
Instruction
Name
MC_MoveCircular2D
Circular 2D
Interpolation
FB
Graphic expression
ST expression
MC_MoveCircular2D_instance
MC_MoveCircular2D_instance (
AxesGroup :=parameter,
Execute :=parameter,
CircAxes :=parameter,
CircMode :=parameter,
AuxPoint :=parameter,
EndPoint :=parameter,
PathChoice :=parameter,
Velocity :=parameter,
Acceleration :=parameter,
Deceleration :=parameter,
Jerk :=parameter,
CoordSystem :=parameter,
BufferMode :=parameter,
TransitionMode :=parameter,
MoveMode :=parameter,
Done =>parameter,
Busy =>parameter,
Active =>parameter,
CommandAborted
=>parameter,
Error =>parameter,
ErrorID =>parameter
);
MC_MoveCircular2D
AxesGroup
AxesGroup
Done
Execute
Busy
CircAxes
CircMode
Active
CommandAborted
AuxPoint
Error
EndPoint
PathChoice
ErrorID
Velocity
Acceleration
Deceleration
Jerk
CoordSystem
BufferMode
TransitionMode
MoveMode
Variables
Input Variables
Name
Meaning
Data type
Valid range
Default
Description
Execute
Execute
BOOL
TRUE or FALSE
FALSE
The instruction is executed when Execute
changes to TRUE.
CircAxes
Circular
Axes
ARRAY [0,1] OF
UINT
0 to 3
0
Specify the axes for
circular interpolation.
0: Axis A0
1: Axis A1
2: Axis A2
3: Axis A3
CircMode
Circular
Interpolation
Mode
_eMC_CIRC_
MODE
0: _mcBorder
1: _mcCenter
2: _mcRadius
0*1
Specify the method
for circular interpolation.
0: Border point
1: Center
2: Radius
4-42
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Name
Meaning
Data type
Valid range
Default
Description
AuxPoint
Auxiliary
Point
ARRAY [0,1] OF
LREAL
Negative number, positive number,
or 0
0
Specify the border
point, center, or
radius. The unit is
command units.*2
EndPoint
End Point
ARRAY [0,1] OF
LREAL
Negative number, positive number,
or 0
0
Specify the target
position. The unit is
command units.*2
PathChoice
Path Choice
_eMC_CIRC_
PATHCHOICE
0: _mcCW
0*1
Specify the path
direction.
1: _mcCCW
1: CCW
Velocity*3
Target
Velocity
LREAL
Positive number
0
Specify the target
velocity. The unit is
command units/s.*2
Acceleration
Acceleration
Rate
LREAL
Non-negative number
0
Specify the acceleration rate. The unit is
command units/s2.*2
Deceleration
Deceleration Rate
LREAL
Non-negative number
0
Specify the deceleration rate. The unit is
command units/s2.*2
4
Jerk
Jerk
LREAL
Non-negative number
0
Specify the jerk. The
unit is command
units/s3.*2
Variables
MC_MoveCircular2D
0: CW
CoordSystem
Coordinate
System
_eMC_
COORD_
SYSTEM
0: _mcACS
0*1
Specify the coordinate system.
_eMC_
BUFFER_
MODE
0: _mcAborting
BufferMode
Buffer Mode
Selection
0: Axis coordinate
system (ACS)
0*1
1: _mcBuffered
2: _mcBlendingLow
3: _mcBlendingPrevious
Specify the behavior
when executing more
than one motion
instruction.
0: Aborting
4: _mcBlendingNext
1: Buffered
5: _mcBlendingHigh
2: Blending low
3: Blending previous
4: Blending next
5: Blending high
TransitionMode
Transition
Mode
_eMC_
TRANSITION_MODE
0: _mcTMNone
0*1
10: _mcTMCornerSuperimposed
Specify the path of
motion.
0: Transition disabled
10: Superimpose corners
MoveMode
Travel Mode
_eMC_MOVE_MODE
0: _mcAbsolute
0*1
1: _mcRelative
0: Absolute positioning
1: Relative positioning
*1 The default value for an enumeration variable is actually not the number, but the enumerator.
*2 Refer to Unit Conversion Settings in the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NYseries Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559) for information on command
units.
*3 Always set the target velocity. If the axes are moved without setting a target velocity, an error will occur.
NY-series Motion Control Instructions Reference Manual (W561)
4-43
4 Axes Group Instructions
Output Variables
Name
Meaning
Data type
Valid range
Description
Done
Done
BOOL
TRUE or
FALSE
TRUE when the instruction is completed.
Busy
Executing
BOOL
TRUE or
FALSE
TRUE when the instruction is acknowledged.
Active
Controlling
BOOL
TRUE or
FALSE
TRUE when the axes group is being controlled.
CommandAborted
Command
Aborted
BOOL
TRUE or
FALSE
TRUE when the instruction is aborted.
Error
Error
BOOL
TRUE or
FALSE
TRUE while there is an error.
ErrorID
Error Code
WORD
*
Contains the error code when an error occurs. A value
of 16#0000 indicates normal execution.
* Refer to the NY-series Troubleshooting Manual (Cat. No. W564).
z Output Variable Update Timing
Name
Timing for changing to TRUE
Timing for changing to FALSE
Done
When positioning is completed.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Busy
When Execute changes to TRUE.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
Active
When the axis starts moving.
• When Done changes to TRUE.
• When Error changes to TRUE.
• When CommandAborted changes to TRUE.
CommandAborted
• When this instruction is aborted because
another motion control instruction was executed with the Buffer Mode set to Aborting.
• When this instruction is canceled due to an
error.
• When this instruction is executed while there
is an error.
• When you start this instruction during
MC_GroupStop instruction execution.
• When Execute is TRUE and changes to
FALSE.
• After one period when Execute is FALSE.
Error
When there is an error in the execution conditions or input parameters for the instruction.
When the error is cleared.
In-Out Variables
Name
AxesGroup
Meaning
Data type
Axes Group
_sGROUP_REF
Valid range
---
Description
Specify the axes group.*
* Specify a user-defined Axes Group Variable that was created in the Axes Group Basic Settings of the Sysmac Studio
(default: MC_Group***) or a system-defined axes group variable name (_MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*]).
4-44
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Function
• The MC_MoveCircular2D instruction performs 2D circular interpolation for two axes.
Precautions for Correct Use
• An Instruction Execution Error with Undefined Home (error code: 5466 hex) occurs if home is
undefined for any of the composition axes in the axes group.
• You cannot execute an instruction to perform circular 2D interpolation if a limit input is ON for
any of the logical axes that belong to the axes group.
MC_MoveCircular2D
Instruction Details
This section describes the instruction in detail.
z Circular Interpolation Procedure
Use the following procedure to perform circular interpolation.
Registering Axes Groups for Interpolation
Function
1
4
• Determine the axes group to perform interpolation.
An axes group is represented by _MC_GRP[*], _MC1_GRP[*], or _MC2_GRP[*].
• Specify the axis composition with the Composition Axes Group Variable.
• Specify the combination of axes to perform interpolation with the Axis Selection Axes Group
Variable.
• Use logical axes (axis A0 to A3) for the axes, and not axis numbers (axis 0 to 255).
• Specify axis numbers 0 to 255 for the logical axes A0 to A3 in order from the lowest number
using the Axis Selection Axes Group Variable.
Logical axis
Axis number*1
Axis A0
Axis 0 to Axis 255
Axis A1
Axis 0 to Axis 255
Axis A2
Axis 0 to Axis 255
Axis A3
Axis 0 to Axis 255
*1 The Axis number is “Axis 0 to Axis 63” in the case of NJ/NY-series.
Example: The following specifications are used to specify axis numbers 0 and 1 for axes A0 and
A1 with a 2-axis composition.
Logical axis
Axis number
Axis A0
Axis 0
Axis A1
Axis 1
Description
Specify axis numbers to the logical axes from axis A0
in order from the lowest number.
Precautions for Correct Use
An Instruction Not Allowed for Encoder Axis Type error (543D hex) will occur and operation will
end if an encoder axis or virtual encoder axis is included in the axes group. Make sure that you
select only servo axes or virtual servo axes.
2
Enabling the Axes Group
NY-series Motion Control Instructions Reference Manual (W561)
4-45
4 Axes Group Instructions
• Turn ON the Servo for the composition axes of the axes group, and then define home for each
of the composition axes.
• Execute MC_GroupEnable (Enable Axes Group) instruction to enable the registered axes
group.
Using the Circular Interpolation instruction is now enabled.
z CircAxes (Circular Axes)
Circular interpolation uses the X axis and Y axis.
Y
CCW
CW
CW: Clockwise rotation
CCW: Counterclockwise rotation
X
Specify the axes to use as the X axis and Y axis with CircAxes (Circular Axes). Use logical axes
(axis A0 to A3) for the axes, and not axis numbers (axis 0 to 255).
Precautions for Correct Use
Specify the Count Mode to Linear Mode for the axes that you use for the X axis and Y axis. If you
specify Rotary Mode, an Instruction Execution Error Caused by Count Mode Setting (error code:
544A hex) will occur at execution.
z CircMode (Circular Interpolation Mode)
There are three methods of circular interpolation: border point, center, and radius. You can specify
one of these methods with CircMode (Circular Interpolation Mode). Absolute positioning or relative
positioning can be used to specify the position with these methods. You can specify absolute or relative positioning with MoveMode (Travel Mode).
MoveMode
Description
Absolute positioning
The border point for a border point specification or the center point and end point for a
center point specification are specified as absolute positions from home in the axis
coordinate system.
Relative positioning
The border point for a border point specification or the center point and end point for a
center point specification are specified as relative positions from the start point.
The difference between absolute positioning and relative positioning using a border point is
described below as an example.
4-46
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Circular Interpolation Method: Border Point Specification
with Absolute Positioning
Y
Circular Interpolation Method: Border Point Specification
with Relative Positioning
Y
AuxPoint(X, Y)
AuxPoint(X, Y)
EndPoint(X, Y)
EndPoint(X, Y)
Start point
Start point
X
The following sections describe the operation assuming that absolute positioning has been specified
as the MoveMode (Travel Mode).
Border point
The current position is the starting point. Circular
interpolation is performed through the border point
AuxPoint(X,Y) to the end point EndPoint(X,Y).
Y
AuxPoint(X, Y)
4
Start point
X
If the start point, border point, and end point are along Y
the same line, if the border point and the end point are
at the same point, or if the start point and the border
point are the same point, linear interpolation is performed from the start point to the end point.
EndPoint(X, Y)
AuxPoint(X, Y)
Start point
X
Precautions for Correct Use
• The points are considered to be on a straight line if the distance between the border point and
the line that connects the start and end point is less than one pulse for both the X and Y coordinates.
• An error occurs if the start point, border point, and end point are the same point.
The start point, border point, and end point are considered to be the same point if the command positions are the same for the command unit. If the command positions in the command
unit are different, the points are not considered to be the same point and an error does not
occur even if the positions are the same when they are converted to pulses.
4-47
Function
EndPoint(X, Y)
NY-series Motion Control Instructions Reference Manual (W561)
MC_MoveCircular2D
X
4 Axes Group Instructions
If the start point and the end point are the same point,
a complete circle is drawn with the start point and the
border point as the diameter. PathChoice is specified
as the circular interpolation direction.
Y
AuxPoint(X, Y)
Start point, EndPoint(X, Y)
X
Center
The current position is the starting point. Circular
interpolation is performed for circle specified by the
center point AuxPoint(X,Y) to the end point EndPoint(X,Y). PathChoice is used to specify the circular
interpolation direction. A complete circle is drawn
when the start point and end point are at the same
point. If the radius from the specified center to the
start point is different to the radius to the end point,
the average of the two radiuses is used to perform
circular interpolation. In this case, the center is calculated in the same way as specifying the radius, and
the calculated radius and center are used.
Y
AuxPoint(X, Y)
EndPoint(X, Y)
Start point
X
Precautions for Correct Use
If the Correction Allowance Ratio axes group parameter is set to any value other than 0 and the
specified center point exceeds the circle that is calculated with the following formula, a Circular
Interpolation Center Specification Position Out of Range error (error code: 5449 hex) will occur.
The radius of the circle in which the center point must be positioned is the calculated radius
multiplied by the percentage that is set for the center point specification check method
divided by 100. (The radius calculated from the corrected center point is taken as 100%.)
Radius
The current position is the starting point. Circular
interpolation is performed for the circle specified by
the radius AuxPoint(X,Y) to the end point EndPoint(X,Y). The radius is specified by the first element
in AuxPoint(X,Y). The second element is not used.
For example, for a radius of 100, set AuxPoint(X,Y) to
AuxPoint(100,0). If the sign of the radius is negative,
a circle with a long arc will be drawn. If the sign is
positive, a circle with a short arc will be drawn. PathChoice is used to specify the circular interpolation
direction.
Y
Negative radius
EndPoint(X, Y)
Positive radius
Start point
X
Precautions for Correct Use
• If the start point and the end point are the same, a same circular interpolation start and end
point error will occur and operation will stop for all axes in the group.
• If the specified radius is less than half the length of the distance between the start point and
end point, a circle is impossible and an error will occur.
4-48
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Velocity (Target Velocity), Acceleration (Acceleration Rate), Deceleration
(Deceleration Rate), and Jerk
Set Velocity, Acceleration, Deceleration, and Jerk to specify the interpolation velocity, acceleration
rate, deceleration rate, and jerk for circular interpolation. If you set the interpolation velocity for circular interpolation to 0, a velocity specification error will occur and operation will stop for all axes in the
group. If the specified interpolation velocity exceeds the maximum velocity of an axis, the following
operation is executed.
If only one axis exceeds the maximum velocity:
This axis moves at the maximum velocity and the interpolation velocity is adjusted accordingly.
MC_MoveCircular2D
If both axes exceed the maximum velocity:
The interpolation velocity is automatically adjusted so that the axes move at the maximum velocity of
the two axes that is slower.
4
Function
NY-series Motion Control Instructions Reference Manual (W561)
4-49
4 Axes Group Instructions
Jerk
The relationships between Acceleration (Acceleration Rate), Deceleration (Deceleration Rate), and
Velocity (Target Velocity) when Jerk is set to 0 and when it is set to any other value are shown below.
• Jerk Set to 0
The command value for the velocity is created with acceleration rate At and deceleration rate Dt.
Interpolation velocity
Vt
Time
Acceleration rate At
Time
Deceleration rate -Dt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate.
• Short Travel Distance When Jerk Is 0
The interpolation velocity will not reach the specified Vt (Target Velocity).
Interpolation velocity
Vt
Time
Acceleration rate At
Deceleration rate -Dt
Time
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate.
4-50
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
• Jerk Set to Value Other Than 0
The command value for the velocity is created with At as the upper acceleration limit and Dt as the
upper deceleration limit.
Interpolation velocity
Vt
Acceleration rate At
MC_MoveCircular2D
Time
Time
Deceleration rate -Dt
4
Jt
Time
-Jt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate,
Jt: Specified jerk
• Short Travel Distance When Jerk Is Other Than 0
The interpolation velocity will not reach the specified Vt (Target Velocity).
Interpolation velocity
Vt
Time
Acceleration rate
At
Deceleration rate -Dt
Time
Jt
Jerk
Time
-Jt
Vt: Specified interpolation velocity, At: Specified acceleration rate, Dt: Specified deceleration rate,
Jt: Specified jerk
NY-series Motion Control Instructions Reference Manual (W561)
4-51
Function
Jerk
4 Axes Group Instructions
Precautions for Correct Use
• If 0 is specified for Acceleration (Acceleration Rate), the specified interpolation velocity is used
immediately.
• If 0 is specified for Deceleration (Deceleration Rate), the axis stops immediately. However, if
the Buffer Mode is set to Blending, axis operation will change to the interpolation velocity specified by the next operation without stopping. For details, refer to BufferMode (Buffer Mode
Selection) on page 4-52.
• When the Acceleration (Acceleration Rate) or Deceleration (Deceleration Rate) is 0, the setting of Jerk is disabled.
z CoordSystem (Coordinate System)
• CoordSystem specifies the coordinate system to use for circular interpolation.
• Only an axis coordinate system (ACS) consisting of two or more axes is supported.
z BufferMode (Buffer Mode Selection)
• BufferMode specifies how to join the axis motions for this interpolation instruction and the previous
interpolation instruction.
• There are the following six settings.
Buffer Mode Selection
Description
Aborting
Aborts the instruction being executed and switches to this instruction.
If the direction of axis motion is reversed by switching instructions, the motion will
be reversed according to the Operation Selection at Reversing axis parameter.
Buffered
Buffers this instruction and executes it automatically after the current instruction
is completed.
Blending
Starts the buffered instruction at the velocity (transit velocity) at which the current
instruction reaches the target position. The operation of the current instruction is
changed so that the axes reach the target position at the transit velocity. There
are four methods to specify the transit velocity. These are described below. You
can also specify a Transition Mode as an option to the Blending Mode (see
below).
Blending low
The lower of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
Blending previous
The target velocity of the current instruction is used as the transit velocity.
Blending next
The target velocity of the buffered instruction is used as the transit velocity.
Blending high
The higher of the target velocities of the current instruction and the buffered
instruction is used as the transit velocity.
For details on BufferMode (Buffer Mode Selection), refer to the NJ/NX-series CPU Unit Motion Control User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control User’s Manual (Cat. No. W559).
z TransitionMode
• TransitionMode specifies how to join the motions for this interpolation instruction and the previous
interpolation instruction.
• If BufferMode (Buffer Mode Selection) is set to Blending, TransitionMode is enabled.
• An error will occur if you do not set TransitionMode to _mcTMNone (Transition Disabled) when
blending is not used.
For details, refer to TransitionMode on page 4-19.
4-52
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Re-execution of Motion Control Instructions
This instruction cannot be re-executed.
A Motion Control Instruction Re-execution Disabled error (error code: 543B hex) occurs if re-execution
is attempted, and all axes in the circular interpolation motion stop.
Execute
Done
Busy
MC_MoveCircular2D
Active
CommandAborted
Error
ErrorID
16#0000
Error code
4
Interpolation velocity
Function
Time
Multi-execution of Motion Control Instructions
A restriction applies to the instructions that can be used while this instruction is in execution. For details
on multi-execution of motion control instructions, refer to the NJ/NX-series CPU Unit Motion Control
User’s Manual (Cat. No. W507) or NY-series Industrial Panel PC / Industrial Box PC Motion Control
User’s Manual (Cat. No. W559).
Errors
If an error occurs during instruction execution, Error will change to TRUE and the axes will stop. You
can find out the cause of the error by referring to the value output by ErrorID (Error Code).
Execute
Done
Busy
Active
CommandAborted
Error
ErrorID 16#0000
Error code
z Error Codes
Refer to the NY-series Troubleshooting Manual (Cat. No. W564) for instruction errors.
NY-series Motion Control Instructions Reference Manual (W561)
4-53
4 Axes Group Instructions
Sample Programming
This section shows sample programming for circular interpolation with multi-execution of instructions.
Parameter Settings
The minimum settings required for this sample programming are given below.
z Setting Axis Parameters
Axis Types
Axis
Axis Type
Axis 1
Servo axis
Axis 2
Servo axis
Count Modes
Axis
Count Mode
Axis 1
Linear Mode
Axis 2
Linear Mode
Units of Display
Axis
Unit of Display
Axis 1
mm
Axis 2
mm
z Axes Group Parameter Settings
Axis Composition
Two axes are set.
Axis Selection
Axis 1 and axis 2 are set.
Operation Example
The following is an example of operation where the axes automatically perform positioning by using linear interpolation and circular interpolation. The axes move to the final target position (20.00 mm, 20.00
mm) using linear interpolation and circular interpolation. The Buffer Mode is set to Buffered and multiexecution of instructions is used. In this sample, multi-execution of instructions is performed for (2) to
(4) if the Active output variable from linear interpolation (1) is TRUE. For multi-axes coordinated operation, multi-execution is possible for up to seven instructions.
4-54
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Operation Pattern
Axis 2 (mm)
(4)
20.00
15.00
MC_MoveCircular2D
(3)
10.00
(2)
5.00
(1)
0
15.00
4
20.00
Execution
When you turn ON the operation start switch at home, the axes move to the point (10.00 mm,
5.00 mm) via linear interpolation.
2
Continuous Motion
The axes continue to move to the point (15.00 mm, 10.00 mm) via circular interpolation, to the
point (15.00 mm, 15.00 mm) via linear interpolation, and to the point (20.00 mm, 20.00 mm) via
circular interpolation. Here, the velocity is 10.00 mm/s.
Ladder Diagram
z Main Variables
Name
MC_Group000
Default
---
MC_Group000.MFaultLvl.Active
Data type
_sGROUP
_REF
BOOL
MC_Group000.Status.Disabled
BOOL
FALSE
MC_Axis000
MC_Axis000.Details.Homed
MC_Axis000.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
MC_Axis001
MC_Axis001.Details.Homed
MC_Axis001.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
BOOL
FALSE
Pwr1_Status
NY-series Motion Control Instructions Reference Manual (W561)
FALSE
Comment
This is the Axes Group Variable for axes group
0.
TRUE while there is a minor fault level error for
axes group 0.
The value is TRUE when axes group 0 is disabled.
This is the Axis Variable for axis 1.
TRUE when home is defined for axis 1.
TRUE while there is a minor fault level error for
axis 1.
This is the Axis Variable for axis 2.
TRUE when home is defined for axis 2.
TRUE while there is a minor fault level error for
axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
4-55
Sample Programming
1
Axis 1 (mm)
10.00
4 Axes Group Instructions
Name
Data type
BOOL
Default
FALSE
StartPg
BOOL
FALSE
InitFlag
BOOL
FALSE
Pwr2_Status
4-56
Comment
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servos for the axes in the axes group are
turned ON if this variable is TRUE and EtherCAT process data communications are established.
This variable indicates if it is necessary to set
the input parameters. Input parameters are set
when this variable is FALSE. When setting the
input parameters is completed, this variable
changes to TRUE.
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
z Sample Programming
If StartPg is TRUE, EtherCAT communications for the axes are checked to see if process data communications are normal.
StartPg
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis000.Cfg.NodeAddress]
Lock1
_EC_PDSlavTbl[MC_Axis000.Cfg.NodeAddress]
_EC_CommErrTbl[MC_Axis001.Cfg.NodeAddress]
Lock2
If process data communications are active, the Servo is turned ON.
PWR1
MC_MoveCircular2D
MC_Power
MC_Axis000
Lock1
Axis
Enable
Axis
Status
Busy
Error
ErrorID
Pwr1_Status
Pwr1_Bsy
Pwr1_Err
Pwr1_ErrID
PWR2
4
MC_Power
MC_Axis001
Lock2
Axis
Enable
Pwr2_Status
Pwr2_Bsy
Pwr2_Err
Pwr2_ErrID
Sample Programming
Axis
Status
Busy
Error
ErrorID
If a minor fault level error occurs for the axis composition, the error handler for the device (FaultHandler) is executed.
Program the FaultHandler according to the device.
MC_Axis000.MFaultLvl.Active
EN
FaultHandler
FaultHandler
MC_Axis001.MFaultLvl.Active
MC_Group000.MFaultLvl.Active
If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed.
HM1
MC_Home
Pwr1_Status
MC_Axis000.Details.Homed
MC_Axis000
Axis
Execute
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm1_D
Hm1_Bsy
Hm1_Ca
Hm1_Err
Hm1_ErrID
If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed.
HM2
MC_Home
Pwr2_Status
MC_Axis001.Details.Homed
MC_Axis001
Axis
Execute
NY-series Motion Control Instructions Reference Manual (W561)
Axis
Done
Busy
CommandAborted
Error
ErrorID
Hm2_D
Hm2_Bsy
Hm2_Ca
Hm2_Err
Hm2_ErrID
4-57
4 Axes Group Instructions
After home is defined for axis 1 and axis 2, the axes group is enabled.
GRP_EN
Hm1_D Hm2_D
MC_Group000
MC_Group000.Status.Disabled
MC_GroupEnable
AxesGroup
AxesGroup
Done
Execute
Busy
CommandAborted
Error
ErrorID
Grp_En_D
Grp_En_Bsy
Grp_En_Ca
Grp_En_Err
Grp_En_ErrID
The parameters are set for linear interpolation and circular interpolation.
InitFlag
Note: The contents of the inline ST
are given below.
If the axes group is enabled, linear interpolation (1) is executed.
MV_LIN1
Grp_En_D
MC_Group000
Mv_Lin1_Pos
Mv_Lin1_Vel
Mv_Lin1_Acc
Mv_Lin1_Dec
Mv_Lin1_Mm
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Lin1_D
Mv_Lin1_Bsy
Mv_Lin1_Act
Mv_Lin1_Ca
Mv_Lin1_Err
Mv_Lin1_ErrID
Circular interpolation (2) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_CIRC1
Mv_Lin1_Act
MC_Group000
Mv_Circ1_CircAxes
Mv_Circ1_CircMode
Mv_Circ1_AuxPoint
Mv_Circ1_EndPoint
Mv_Circ1_Pc
Mv_Circ1_Vel
Mv_Circ1_Acc
Mv_Circ1_Dec
Mv_Circ1_Bm
Mv_Circ1_Mm
4-58
MC_MoveCircular2D
AxesGroup
AxesGroup
Done
Execute
Busy
CircAxes
Active
CircMode
AuxPoint
CommandAborted
EndPoint
Error
PathChoice
ErrorID
Velocity
Acceleration
Deceleration
Jerk
CoordSystem
BufferMode
TransitionMode
MoveMode
Mv_Circ1_D
Mv_Circ1_Bsy
Mv_Circ1_Act
Mv_Circ1_Ca
Mv_Circ1_Err
Mv_Circ1_ErrID
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Linear interpolation (3) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_LIN2
MC_Group000
Mv_Lin1_Act
Mv_Lin2_Pos
Mv_Lin2_Vel
Mv_Lin2_Acc
Mv_Lin2_Dec
Mv_Lin2_Bm
Mv_Lin2_D
Mv_Lin2_Bsy
Mv_Lin2_Act
Mv_Lin2_Ca
Mv_Lin2_Err
Mv_Lin2_ErrID
MC_MoveCircular2D
Mv_Lin2_Mm
MC_MoveLinear
AxesGroup
AxesGroup
Done
Execute
Busy
Position
Velocity
Active
Acceleration CommandAborted
Deceleration
Error
Jerk
ErrorID
CoordSystem
BufferMode
TransitionMode
MoveMode
Circular interpolation (4) is executed with multi-execution of instructions after linear interpolation (1) is started.
MV_CIRC2
MC_Group000
Mv_Lin1_Act
Mv_Circ2_Bm
Mv_Circ2_Mm
Mv_Circ2_D
4
Mv_Circ2_Bsy
Mv_Circ2_Act
Mv_Circ2_Ca
Mv_Circ2_Err
Mv_Circ2_ErrID
Sample Programming
Mv_Circ2_CircAxes
Mv_Circ2_CircMode
Mv_Circ2_AuxPoint
Mv_Circ2_EndPoint
Mv_Circ2_Pc
Mv_Circ2_Vel
Mv_Circ2_Acc
Mv_Circ2_Dec
MC_MoveCircular2D
AxesGroup
AxesGroup
Done
Execute
Busy
CircAxes
CircMode
Active
CommandAborted
AuxPoint
Error
EndPoint
PathChoice
ErrorID
Velocity
Acceleration
Deceleration
Jerk
CoordSystem
BufferMode
TransitionMode
MoveMode
Contents of Inline ST
// MV_CIRC1 parameters
Mv_Circ1_CircAxes[0]
Mv_Circ1_CircAxes[1]
Mv_Circ1_CircMode
Mv_Circ1_AuxPoint[0]
Mv_Circ1_AuxPoint[1]
Mv_Circ1_EndPoint[0]
Mv_Circ1_EndPoint[1]
Mv_Circ1_Pc
Mv_Circ1_Vel
Mv_Circ1_Acc
Mv_Circ1_Dec
Mv_Circ1_Bm
Mv_Circ1_Mm
:= UINT#0;
:= UINT#1;
:= _eMC_CIRC_MODE#_mcRadius;
:= LREAL#5.0;
:= LREAL#0.0;
:= LREAL#15.0;
:= LREAL#10.0;
:= _eMC_CIRC_PATHCHOICE#_mcCCW;
:= LREAL#100.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_CIRC2 parameters
Mv_Circ2_CircAxes[0]
:= UINT#0;
Mv_Circ2_CircAxes[1]
:= UINT#1;
Mv_Circ2_CircMode
:= _eMC_CIRC_MODE#_mcCenter;
Mv_Circ2_AuxPoint[0]
:= LREAL#15.0;
Mv_Circ2_AuxPoint[1]
:= LREAL#20.0;
Mv_Circ2_EndPoint[0]
:= LREAL#20.0;
Mv_Circ2_EndPoint[1]
:= LREAL#20.0;
Mv_Circ2_Pc
:= _eMC_CIRC_PATHCHOICE#_mcCW;
Mv_Circ2_Vel
:= LREAL#100.0;
Mv_Circ2_Acc := LREAL#20.0;
NY-series Motion Control Instructions Reference Manual (W561)
4-59
4 Axes Group Instructions
Mv_Circ2_Dec
Mv_Circ2_Bm
Mv_Circ2_Mm
:= LREAL#20.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN1 parameters
Mv_Lin1_Pos[0]
Mv_Lin1_Pos[1]
Mv_Lin1_Vel
Mv_Lin1_Acc
Mv_Lin1_Dec
Mv_Lin1_Mm
:= LREAL#10.0;
:= LREAL#5.0;
:= LREAL#100.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN2 parameters
Mv_Lin2_Pos[0]
Mv_Lin2_Pos[1]
Mv_Lin2_Vel
Mv_Lin2_Acc
Mv_Lin2_Dec
Mv_Lin2_Bm
Mv_Lin2_Mm
:= LREAL#15.0;
:= LREAL#15.0;
:= LREAL#100.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
Structured Text (ST)
z Main Variables
Name
MC_Group000
4-60
Default
---
MC_Group000.MFaultLvl.Active
Data type
_sGROUP
_REF
BOOL
MC_Group000.Status.Disabled
BOOL
FALSE
MC_Axis000
MC_Axis000.Details.Homed
MC_Axis000.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
MC_Axis001
MC_Axis001.Details.Homed
MC_Axis001.MFaultLvl.Active
_sAXIS_REF
BOOL
BOOL
--FALSE
FALSE
Pwr1_Status
BOOL
FALSE
Pwr2_Status
BOOL
FALSE
StartPg
BOOL
FALSE
FALSE
Comment
This is the Axes Group Variable for axes group
0.
TRUE while there is a minor fault level error for
axes group 0.
The value is TRUE when axes group 0 is disabled.
This is the Axis Variable for axis 1.
TRUE when home is defined for axis 1.
TRUE while there is a minor fault level error for
axis 1.
This is the Axis Variable for axis 2.
TRUE when home is defined for axis 2.
TRUE while there is a minor fault level error for
axis 2.
This variable is assigned to the Status output
variable from the PWR1 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
This variable is assigned to the Status output
variable from the PWR2 instance of the
MC_Power instruction. This variable changes to
TRUE when the Servo is turned ON.
The Servos for the axes in the axes group are
turned ON if this variable is TRUE and EtherCAT process data communications are established.
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
Name
Data type
BOOL
Default
FALSE
Hm1_Ex
BOOL
FALSE
Hm2_Ex
BOOL
FALSE
Grp_En_Ex
BOOL
FALSE
Mv_Lin1_Ex
BOOL
FALSE
Mv_Lin2_Ex
BOOL
FALSE
Mv_Circ1_Ex
BOOL
FALSE
Mv_Circ2_Ex
BOOL
FALSE
Comment
This variable indicates if it is necessary to set
the input parameters. Input parameters are set
when this variable is FALSE. When setting the
input parameters is completed, this variable
changes to TRUE.
The HM1 instance of MC_Home is executed
when this variable changes to TRUE.
The HM2 instance of MC_Home is executed
when this variable changes to TRUE.
The GRP_EN instance of MC_GroupEnable is
executed when this variable changes to TRUE.
The MV_LIN1 instance of MC_MoveLinear is
executed when this variable changes to TRUE.
The MV_LIN2 instance of MC_MoveLinear is
executed when this variable changes to TRUE.
The MV_CIRC1 instance of MC_MoveCircular
is executed when this variable changes to
TRUE.
The MV_CIRC2 instance of MC_MoveCircular
is executed when this variable changes to
TRUE.
// Processing when input parameters are not set
IF InitFlag=FALSE THEN
// MV_CIRC1 parameters
Mv_Circ1_CircAxes[0]
Mv_Circ1_CircAxes[1]
Mv_Circ1_CircMode
Mv_Circ1_AuxPoint[0]
Mv_Circ1_AuxPoint[1]
Mv_Circ1_EndPoint[0]
Mv_Circ1_EndPoint[1]
Mv_Circ1_Pc
Mv_Circ1_Vel
Mv_Circ1_Acc
Mv_Circ1_Dec
Mv_Circ1_Bm
Mv_Circ1_Mm
:= UINT#0;
:= UINT#1;
:= _eMC_CIRC_MODE#_mcRadius;
:= LREAL#5.0;
:= LREAL#0.0;
:= LREAL#15.0;
:= LREAL#10.0;
:= _eMC_CIRC_PATHCHOICE#_mcCCW;
:= LREAL#100.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_CIRC2 parameters
Mv_Circ2_CircAxes[0]
Mv_Circ2_CircAxes[1]
Mv_Circ2_CircMode
Mv_Circ2_AuxPoint[0]
Mv_Circ2_AuxPoint[1]
Mv_Circ2_EndPoint[0]
Mv_Circ2_EndPoint[1]
Mv_Circ2_Pc
Mv_Circ2_Vel
Mv_Circ2_Acc
Mv_Circ2_Dec
Mv_Circ2_Bm
Mv_Circ2_Mm
:= UINT#0;
:= UINT#1;
:= _eMC_CIRC_MODE#_mcCenter;
:= LREAL#15.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= _eMC_CIRC_PATHCHOICE#_mcCW;
:= LREAL#100.0;
:= LREAL#20.0;
:= LREAL#20.0;
:= _eMC_BUFFER_MODE#_mcBuffered;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN1 parameters
Mv_Lin1_Pos[0]
:= LREAL#10.0;
Mv_Lin1_Pos[1]
:= LREAL#5.0;
Mv_Lin1_Vel
:= LREAL#100.0;
Mv_Lin1_Acc
:= LREAL#20.0;
NY-series Motion Control Instructions Reference Manual (W561)
4
Sample Programming
z Sample Programming
MC_MoveCircular2D
InitFlag
4-61
4 Axes Group Instructions
Mv_Lin1_Dec
Mv_Lin1_Mm
:= LREAL#20.0;
:= _eMC_MOVE_MODE#_mcAbsolute;
// MV_LIN2 parameters
Mv_Lin2_Pos[0]
:= LREAL#15.0;
Mv_Lin2_Pos[1]
:= LREAL#15.0;
Mv_Lin2_Vel
:= LREAL#100.0;
Mv_Lin2_Acc
:= LREAL#20.0;
Mv_Lin2_Dec
:= LREAL#20.0;
Mv_Lin2_Bm
:= _eMC_BUFFER_MODE#_mcBuffered;
Mv_Lin2_Mm
:= _eMC_MOVE_MODE#_mcAbsolute;
// Change InitFlag to TRUE after setting the input parameters.
InitFlag := TRUE;
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 1 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo for axis 1.
ELSE
Pwr1_En:=FALSE;
// Turn OFF the Servo for axis 1.
END_IF;
// If StartPg is TRUE and EtherCAT communications are normal, the Servo for axis 2 is turned ON.
// If EtherCAT communications are not normal, 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;
// Turn ON the Servo for axis 2.
ELSE
Pwr2_En:=FALSE;
// Turn OFF the Servo for axis 2.
END_IF;
// Processing for a minor fault level error
// Program the FaultHandler according to the device.
IF (MC_Axis000.MFaultLvl.Active=TRUE) OR (MC_Axis001.MFaultLvl.Active=TRUE) OR
(MC_Group000.MFaultLvl.Active=TRUE) THEN
FaultHandler();
END_IF;
// If the Servo is ON for axis 1 and home is not defined, the Home instruction is executed.
IF (Pwr1_Status=TRUE) AND (MC_Axis000.Details.Homed=FALSE) THEN
Hm1_Ex:=TRUE;
END_IF;
// If the Servo is ON for axis 2 and home is not defined, the Home instruction is executed.
IF (Pwr2_Status=TRUE) AND (MC_Axis001.Details.Homed=FALSE) THEN
Hm2_Ex:=TRUE;
END_IF;
// If axes group 0 is disabled after homing is completed for axis 1 and axis 2, it is enabled.
IF (Hm1_D=TRUE) AND (Hm2_D=TRUE) AND (MC_Group000.Status.Disabled=TRUE) THEN
Grp_En_Ex:= TRUE;
END_IF;
// If axes group 0 is enabled, linear interpolation (1) is executed.
IF Grp_En_D=TRUE THEN
Mv_Lin1_Ex:=TRUE;
END_IF;
4-62
NY-series Motion Control Instructions Reference Manual (W561)
4 Axes Group Instructions
// The rest of the instructions are executed with multi-execution of instructions when the Active output variable
for linear interpolation (1) changes to TRUE.
IF Mv_Lin1_Act=TRUE THEN
Mv_Circ1_Ex:=TRUE;
Mv_Lin2_Ex:=TRUE;
Mv_Circ2_Ex:=TRUE;
END_IF;
MC_MoveCircular2D
// MC_Power for axis 1
PWR1(
Axis
:= MC_Axis000,
Enable
:= Pwr1_En,
Status
=> Pwr1_Status,
Busy
=> Pwr1_Bsy,
Error
=> Pwr1_Err,
ErrorID
=> Pwr1_ErrID
);
// MC_Power for axis 2
PWR2(
Axis
:= MC_Axis001,
Enable
:= Pwr2_En,
Status
=> Pwr2_Status,
Busy
=> Pwr2_Bsy,
Error
=> Pwr2_Err,
ErrorID
=> Pwr2_ErrID
);
// MC_Home for axis 2
HM2(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
Sample Programming
// MC_Home for axis 1
HM1(
Axis
Execute
Done
Busy
CommandAborted
Error
ErrorID
);
4
:= MC_Axis000,
:= Hm1_Ex,
=> Hm1_D,
=> Hm1_Bsy,
=> Hm1_Ca,
=> Hm1_Err,
=> Hm1_ErrID
:= MC_Axis001,
:= Hm2_Ex,
=> Hm2_D,
=> Hm2_Bsy,
=> Hm2_Ca,
=> Hm2_Err,
=> Hm2_ErrID
// Axes Group 0 is enabled.
GRP_EN(
AxesGroup
:= MC_Group000,
Execute
:= Grp_En_Ex,
Done
=> Grp_En_D,
Busy
=> Grp_En_Bsy,
CommandAborted => Grp_En_Ca,
Error
=> Grp_En_Err,
ErrorID
=> Grp_En_ErrID
);
// Linear interpolation 1
MV_LIN1(
NY-series Motion Control Instructions Reference Manual (W561)
4-63
4 Axes Group Instructions
AxesGroup
Execute
Position
Velocity
Acceleration
Deceleration
MoveMode
Done
Busy
Active
CommandAborted
Error
ErrorID
:= MC_Group000,
:= Mv_Lin1_Ex,
:= Mv_Lin1_Pos,
:= Mv_Lin1_Vel,
:= Mv_Lin1_Acc,
:= Mv_Lin1_Dec,
:= Mv_Lin1_Mm,
=> Mv_Lin1_D,
=> Mv_Lin1_Bsy,
=> Mv_Lin1_Act,
=> M