General rules for MC function blocks
For all MC function blocks the following rules apply, which ensure defined processing through the PLC program.
Exclusivity of the outputs
The outputs Busy, Done, Error and CommandAborted are mutually exclusive, i.e. only one of these outputs can be TRUE at a function block at any one time. When the Execute input becomes TRUE, one of the outputs must become TRUE. Similarly, only one of the outputs Active, Error, Done and CommandAborted can be TRUE at any one time.
An exception to this rule is MC_Stop. MC_Stop sets Done to TRUE as soon as the axis is stopped. Nevertheless, Busy and Active remain TRUE because the axis is locked. The axis is unlocked and Busy and Active are set to FALSE only after Execute is set to FALSE.
Initial state
The outputs Done, InGear, InSync, InVelocity, Error, ErrorID and CommandAborted are reset with a falling edge at input Execute, if the function block is not active (Busy=FALSE). However, a falling edge at Execute has no influence on the command execution. Resetting Execute during command execution ensures that one of the outputs is set at the end of the command for a PLC cycle. Only then are the outputs reset.
If Execute is triggered more than once while a command is executed, the function block will not execute further commands, without providing any feedback.
Input parameters
The input parameters are read with rising edge at Execute. To change the parameters the command has to be triggered again once it is completed, or a second instance of the function block must be triggered with new parameters during command execution.
If an input parameter is not transferred to the function block, the last value transferred to this block remains valid. A meaningful default value is used for the first call.
Position and Distance
The Position input designates a defined value within a coordinate system. Distance, in contrast, is a relative measurement, i.e. the distance between two positions. Position and Distance are specified in technical units, e.g. [mm] or [°], according to the axis scaling.
Dynamic parameters
The dynamic parameters for Move functions are specified in technical units with second as timebase. If an axis is scaled in millimeters, for example, the following units are used: Velocity [mm/s], Acceleration [mm/s2], deceleration [mm/s2], jerk [mm/s3].
Error handling
All function blocks have two error outputs for indicating errors during command execution. Error indicates the error, ErrorID contains a supplementary error number. The outputs Done, InVelocity, InGear and InSync indicate successful command execution and are not set if Error becomes TRUE.
Errors of different type are signaled at the function block output. The error type is not specified explicitly. It depends on the unique, system-wide error number.
Error types
- Function block errors only concern the function block, not the axis (e.g. incorrect parameterization). Function block errors do not have to be reset explicitly. They are reset automatically when the Execute input is reset.
- Communication errors (the function block cannot address the axis, for example). Communication errors usually indicate incorrect configuration or parameterization. A reset is not possible. The function block can only be triggered again after the configuration was corrected.
- Axis errors (logical NC axis) usually occur during the motion (e.g. following error). They cause the axis to switch to error status. An axis error must be reset through MC_Reset.
- Drive errors (control device) may result in an axis error, i.e. an error in the logical NC axis. In many cases can axis errors and drive errors can be reset together through MC_Reset. Depending on the drive controller, a separate reset mechanism may be required (e.g. connection of a reset line to the control device).
Behavior of the Done output
The Done output (or alternatively InVelocity, InGear, InSync etc.) is set when a command was executed successfully. If several function blocks are used for an axis and the running command is interrupted through a further block, the Done output for the first block is not set.
Behavior of the CommandAborted output
CommandAborted is set if a command is interrupted through another block.
Behavior of the Busy output
The Busy output indicates that the function block is active. The block can only be triggered with a rising edge at Execute, if Busy is FALSE. Busy is immediately set with a rising edge at Execute and is only reset when the command was completed successful or unsuccessfully. As long as Busy is TRUE, the function block must be called cyclically for the command to be executed.
Behavior of the Active output
If the axis movement is controlled by several functions, the Active output of each block indicates that the axis executes the command. The status Busy=TRUE and Active=FALSE means that the command is not or no longer executed.
Enable input and Valid output
In contrast to Execute the Enable input results in an action being executed permanently and repeatedly, as long as Enable is TRUE. MC_ReadStatus cyclically updates the status of an axis, for example, as long as Enable is TRUE. A function block with an Enable input indicates through the Valid output that the data indicated at the outputs are valid. The data can be updated continuously while Valid is TRUE.
BufferMode
Some function blocks have a BufferMode input for controlling the command flow with several function blocks. For example, BufferMode can specify that a command interrupts another command (non-queued mode) or that the following command is only executed after the previous command (queued mode). In queued mode BufferMode can be used to specify the movement transition from one command to the next. This is referred to as Blending, which specifies the velocity at the transition point.
A second function block is required to use the buffer mode. It is not possible to trigger a move block with new parameters while it is active.
In non-queued mode a subsequent command leads to termination of a running command. In this case the previous command sets the CommandAborted output. In queued mode a subsequent command waits until a running command is completed. Note here that an endless movement (MC_MoveVelocity) does not permit a queued subsequent command. Queued commands always lead immediately to an endless movement being aborted, as in non-queued operation.
Only one command is queued while another command is executed. If more than one command is triggered during a running command, then the last-started command to be queued is rejected with an error (error 0x4292 Buffer Full). If the last command is started in non-queued mode (Aborting), it becomes active and interrupts the running and an already queued command.
BufferModes
- Aborting : Default mode without buffering. The command is executed immediately and interrupts any other command that may be running.
- Buffered : The command is executed once no other command is running on the axis. The previous movement continues until it has stopped. The following command is started from standstill.
- BlendingLow: The command is executed once no other command is running on the axis. In contrast to Buffered the axis does not stop at the previous target, but passes through this position with the lower velocity of two commands.
- BlendingHigh The command is executed once no other command is running on the axis. In contrast to Buffered the axis does not stop at the previous target, but passes through this position with the higher velocity of two commands.
- BlendingNext : The command is executed once no other command is running on the axis. In contrast to Buffered the axis does not stop at the previous target, but passes through this position with the velocity of the last command.
- BlendingPrevious: The command is executed once no other command is running on the axis. In contrast to Buffered the axis does not stop at the previous target, but passes through this position with the velocity of the first command.
Optional blending position
Blending in the different buffer modes takes place in each case at the target position of the currently running command. In the case of MoveVelocity no target position is defined and in other cases it may be useful to change the blending position. To do this a BlendingPosition can be defined via the Options input of the function block (see below), which is then used for the new command. The optional BlendingPosition must be located before the target position of the previous command, otherwise the new command will be rejected with an error message (0x4296). If the optional BlendingPosition has already been driven past, then the new command is instantly implemented and thus behaves like an Aborting command.
Options input
Many function blocks have an Options input with a data structure containing additional, infrequently required options. For the basic block function these options are often not required, so that the input can remain open. The user only has to populate the Options data structure in cases where the documentation explicitly refers to certain options.
Slave axes
Travel commands can be applied to coupled slave axes, if this option was explicitly activated in the axis parameters. Travel commands can be applied to coupled slave axes, if this option was explicitly activated in the axis parameters. In this case only Buffer-ModeAborting is possible.