6 Motion Control Programming
6-12
NJ/NX-series CPU Unit Motion Control Userās Manual (W507)
*1 Under the PLCopen
Ā®
specifications, Error changes to FALSE and ErrorID changes to 0 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 exe-
cute the instruction. Enable-type motion control instructions are executed if their Enable variable is TRUE
when an error is reset.
*2 When you program the instruction in a ladder diagram, insert an input between the input variable Execute or
Enable and the left bus bar. If the instruction is connected directly to the left bus bar without an input, an error
occurs when the program is built. Set the initial value for or omit any input variable that is reserved.
Error processing
There are two output variables that represent an error when a problem occurs during the
execution of an instruction instance. These outputs are defined as follows:
⢠Error: The output variable Error changes to TRUE to indicate that an error occurred
during the execution of the instruction instance.
⢠ErrorID (Error Code): This is an error code that represents the cause of the error.
The output variables Done, InVelocity (Target Velocity Reached), InGear (Gear Ratio
Achieved), and InSync all represent normal completion or normal operation and there-
fore will never be TRUE when the output variable Error is TRUE.
Types of errors:
⢠Instruction instance errors (e.g., parameter out of range and illegal condition for state
transition)
⢠Axis errors (e.g., Following Error Limit Exceeded and Servo Drive errors)
Some instruction instance errors may not cause an axis error but will cause the axis to
stop.
Operation of output
variable Done
The output variable Done, InGear (Gear Ratio Achieved), or InSync will change to TRUE
when the instruction ends operation normally or when the commanded condition is
reached. For movement instructions for which a target position is specified, the timing of
when the output variable Done changes to TRUE depends on the setting of the In-posi-
tion Check Time axis parameter.
⢠If the In-position Check Time axis parameter is set to any value but 0, output variable
Done changes to TRUE in the next period after the period in which positioning is com-
pleted.
⢠If the In-position Check Time axis parameter is set to 0, output variable Done changes
to TRUE in the next period after the period in which pulse distribution is completed.
When working with multiple instructions that operate on the same axis, the output vari-
able Do
ne from the first instruction will not change to
TRUE if another operation instruc-
tion takes over before the axis operation for the first instruction reaches the target
position.
Operation of output
variable Command-
Aborted
The output variable CommandAborted will change to TRUE when another operation
instruction interrupts the commanded operation. For the MC Function Module, this vari-
able will change to TRUE when a motion control instruction is executed and the target
axis or axes group causes an error or is decelerating to a stop. All other output variables
change to FALSE when CommandAborted changes to TRUE.
Input variables out-
side of valid range
The instruction instance will output an error when it is executed with an input variable that
is outside of the valid range.
Operation of output
variable Busy
The output variable Busy is TRUE when the instruction instance is executing. Busy will
change to TRUE when the input variable Execute changes to TRUE. Busy will change to
FALSE when the output variable Done, CommandAborted, or Error changes to TRUE. It
is impossible to know when the above output variables will change. Write your programs
so that the instruction instance executes every period
*3
while Busy is TRUE so that you
can monitor for changes in the output variables. For a single axis or single axes group,
the Busy variable of more than one instruction instance can be TRUE at the same time.
However, the output variable Active of only one instruction instance can be TRUE at one
time. However, the MC_Phasing (Shift Master Axis Phase) instruction is an exception to
this rule.
Output variable Active The output variable Active changes to TRUE when the instruction instance obtains per-
mission to control the applicable axis.
The output variable Active may change slower than the Busy variable.
*4
Item Rule