PLCopen motion diagram
The axis state machine and the wiring behind it, with every term explained.
Axis state machine
Disabled
The drive is not enabled. No torque is applied, so the axis can drift if gravity or the process pushes on it, and a vertical axis relies on its holding brake. Every motion command is rejected here with an error.
In a real machine: A packaging line at the start of a shift: the servo amplifiers have mains power, but MC_Power.Enable is still FALSE.
Standstill
Powered, holding position and waiting for a command. This is the home base of the diagram; most moves start and end here. MC_Home is accepted only from this state.
In a real machine: A pick-and-place gripper parked over the infeed, holding its position under servo control.
Homing
MC_Home is running a reference search. Until it finishes, absolute positions mean nothing on an incremental encoder. Other motion commands are refused while it runs; MC_Stop can still interrupt it.
In a real machine: A gantry moves slowly toward its home switch, then sets position 0 mm at the switch edge or, in switch-plus-index homing, at the next encoder index pulse.
Discrete Motion
A move with an end point is running: absolute, relative, additive or superimposed, or an MC_Halt ramp to zero. When it reaches the target, the axis returns to Standstill on its own. A new motion command can take over (abort) at any time.
In a real machine: A feeder pushes a carton exactly 350 mm, then stops and waits.
Continuous Motion
A move without an end point: MC_MoveVelocity or a held jog. The axis keeps running until another command takes over; it never returns to Standstill by itself.
In a real machine: A conveyor belt running at 0.8 m/s until the line stops.
Synchronized Motion
The axis follows a master through gearing (MC_GearIn) or a cam table (MC_CamIn). Its position is a function of another axis, not of time. MC_GearOut or MC_CamOut releases it into Continuous Motion at its current speed.
In a real machine: A rotary knife that must meet the web at the same speed on every cut.
Stopping
MC_Stop is in control. The axis ramps to zero and stays locked in Stopping while Execute is TRUE. Every other motion command is rejected until Stop is released. MC_Halt does not use this state.
In a real machine: An operator opens a guard door; the PLC calls MC_Stop and holds it until the door is closed again. The guard itself is handled by the safety circuit and the drive STO, not by this block.
ErrorStop
Something went wrong: following error, drive fault, limit switch, lost communication. The axis stops and refuses commands until the cause is fixed and MC_Reset clears the error. It has the highest priority in the diagram.
In a real machine: A jammed product makes the following error exceed its window; the drive trips and the axis lands in ErrorStop.
Every transition
| From | To | Trigger | Condition |
|---|---|---|---|
| Disabled | Standstill | MC_Power | Enable = TRUE and the drive reports ready (Status = TRUE). With an axis error present, the axis goes to ErrorStop instead. |
| Standstill | Disabled | MC_Power | Enable = FALSE removes torque. From any state except ErrorStop, powering off goes straight to Disabled. |
| Standstill | Homing | MC_Home | A rising Execute starts the reference search. Homing is only accepted from Standstill. |
| Homing | Standstill | MC_Home | Done = TRUE when the reference is set. |
| Standstill | DiscreteMotion | MC_MoveAbsolute / MC_MoveRelative / MC_Halt | A rising Execute starts a move with an end point. |
| DiscreteMotion | Standstill | Done | Target reached at zero velocity, or the Halt ramp finished. |
| Standstill | ContinuousMotion | MC_MoveVelocity / MC_Jog | Runs until another block takes over. |
| DiscreteMotion | ContinuousMotion | MC_MoveVelocity | A velocity command aborts the positioning move and keeps running. |
| ContinuousMotion | DiscreteMotion | MC_MoveAbsolute / MC_Halt | A new move or a Halt aborts the velocity command. |
| Standstill | SynchronizedMotion | MC_GearIn / MC_CamIn | Also allowed from Discrete and Continuous Motion. Diagram only: not run by the TryPLC simulator. |
| SynchronizedMotion | ContinuousMotion | MC_GearOut / MC_CamOut | The slave keeps the speed it had and runs on until another command takes over. |
| SynchronizedMotion | DiscreteMotion | MC_MoveAbsolute / MC_Halt | A positioning command or a Halt also ends the coupling. |
| Any state | Stopping | MC_Stop | From any powered state except ErrorStop. Stays here while Execute is TRUE. |
| Stopping | Standstill | MC_Stop | Done = TRUE and Execute = FALSE. |
| Any state | ErrorStop | Axis error | Any fault, in any state, including Disabled if the drive reports an error. |
| ErrorStop | Standstill | MC_Reset | Clears the error while MC_Power is still enabled and its Status is TRUE. |
| ErrorStop | Disabled | MC_Reset | Clears the error with the drive powered off (MC_Power.Status = FALSE). |
Three walkthroughs
Start-up: from Disabled to the first move
- Disabled. Check MC_ReadStatus: Disabled = TRUE, and MC_ReadAxisError reports no error.
- Set MC_Power.Enable = TRUE. Wait for MC_Power.Status = TRUE; on a real drive that takes from tens of milliseconds to half a second while the brake releases.
- Standstill. On an incremental encoder, run MC_Home now and wait for Done.
- Raise MC_MoveAbsolute.Execute. Busy goes TRUE, the axis enters Discrete Motion.
- Done = TRUE: the axis is back in Standstill at the target. Drop Execute before the next move.
Remember: Never raise Execute on the scan you raise Enable. Wait for Status, and on an incremental axis for a finished homing.
Normal running: one move replaces another
- The axis is in Discrete Motion on its way to 300 mm.
- A second MC_MoveAbsolute instance gets a rising Execute with a target of 150 mm (Aborting mode).
- The first block reports CommandAborted; the second goes Busy and Active. The axis stays in Discrete Motion and turns towards 150 mm.
- The second block reports Done at 150 mm, and the axis returns to Standstill.
Remember: CommandAborted is not an error. Your sequence must still notice it, or it waits forever for a Done that will never come.
Fault and recovery: ErrorStop back to Standstill
- A jam makes the following error exceed its limit. The drive trips and the axis lands in ErrorStop from whatever state it was in.
- Every motion block now reports Error. Read MC_ReadAxisError.AxisErrorID and log it with the time and the machine step.
- Fix the cause first: clear the jam, check the mechanics. Resetting a fault you do not understand usually brings it straight back.
- Raise MC_Reset.Execute. With MC_Power still enabled the axis goes to Standstill; with power off it goes to Disabled.
- Re-check homing validity before the next absolute move. Some drives lose the reference on certain faults.
Remember: ErrorStop outranks everything, including MC_Stop. Recovery is a sequence of its own, not a single reset bit wired to a button.
Which block for which job
| Job | Block | Why this one |
|---|---|---|
| Switch the drive on and off | MC_Power | Level-driven: Enable must stay TRUE for as long as the axis should hold torque. |
| Find the machine zero | MC_Home | Links encoder counts to the machine coordinate. Needed after power-up on incremental encoders. |
| Go to a known position | MC_MoveAbsolute | The target is a coordinate. Repeating the move does not drift. |
| Move a set distance from here | MC_MoveRelative | Indexing, feeding a fixed length. Errors add up if the start position is wrong. |
| Run at a speed with no end point | MC_MoveVelocity | Conveyors, spindles, winders. Watch InVelocity, not Done. |
| Let an operator inch the axis | MC_Jog | Runs while the button is held. Limit the speed when the axis is not homed. |
| Pause, then carry on | MC_Halt | Ramps to zero in Discrete Motion; any later move can take over. |
| Stop and keep everything else out | MC_Stop | Locks the axis in Stopping while Execute is TRUE. Not a safety function. |
| Clear a fault | MC_Reset | ErrorStop to Standstill or Disabled, once the cause is gone. |
| Know what the axis is doing | MC_ReadStatus | One BOOL per state. Gate your sequence on it instead of guessing. |
| Find out why it stopped | MC_ReadAxisError | AxisErrorID is vendor-specific; look it up in the drive or library manual. |
| Slow everything down for a test run | MC_SetOverride | Scales velocity live, from 0 to 100 % or more, without changing the programmed values. |
| Follow another axis at a ratio | MC_GearIn / MC_GearOut | Electronic gearing. Library block on real controllers; not run on this site. |
| Follow another axis along a profile | MC_CamIn / MC_CamOut | Electronic cams, from a cam table. Library block on real controllers; not run on this site. |
Axis wiring
PLC / motion controller
Runs your PLCopen blocks every cycle. It computes the setpoint (where the axis should be right now) and sends it to the drive. A Beckhoff CX or Siemens S7-1500T is typical.
EtherCAT / PROFINET IRT
A deterministic fieldbus. Every cycle (often 1 to 4 ms) it carries the setpoint out and the actual position back. Jitter here turns straight into rough motion.
Servo drive
Closes the current, velocity and often position loops. It turns a setpoint into motor current. Drive faults, such as overcurrent or overtemperature, push the PLC axis into ErrorStop.
STO safety input
Safe Torque Off cuts the energy path to the motor through a certified safety circuit. It is wired from a safety relay or safety PLC, never from a normal MC_Power output.
Servo motor + brake
Produces torque. A holding brake keeps vertical axes from falling when the drive is disabled; the drive releases it after torque is present.
Encoder feedback
Reports motor position back to the drive. Incremental encoders need homing after power-up; absolute encoders remember position.
Ball screw + carriage
Converts rotation into travel. With a 10 mm pitch screw, one motor turn moves the carriage 10 mm. This ratio is what your axis scaling must match.
Home + limit switches
The home switch gives MC_Home a reference. Hardware limits stop the axis before it hits the end stop; hitting one sends the axis to ErrorStop.
Terms
Axis and drive
- Axis
- One controlled degree of freedom: a motor, its drive and the mechanics it moves, seen by the PLC as a single object with a position, a velocity and a state.
- AXIS_REF
- The handle that ties a function block to one axis. Every MC block takes it on its Axis input, so ten blocks can command the same axis.
- Servo drive
- The amplifier that turns a setpoint into motor current. It usually closes the current and velocity loops, and often the position loop, many times faster than the PLC scan.
- Motion task
- The high-priority cyclic task that runs the profile generator and talks to the drives, typically every 1 to 4 ms. Your sequence code usually runs in a slower task.
- CiA 402 / CSP
- The drive profile most EtherCAT servos follow. In cyclic synchronous position mode (CSP) the controller sends a new position setpoint every bus cycle.
- Holding brake
- A spring-applied brake on the motor shaft that holds a vertical axis when torque is off. The drive releases it only after torque is present.
- Override
- A live scale factor (MC_SetOverride) applied to velocity, usually 0 to 100 % and often wired to an operator potentiometer for slow test runs.
Block handshake
- Execute
- Edge-triggered start. A command only begins on the FALSE to TRUE transition; holding it TRUE does not restart the move, and dropping it does not cancel one.
- Enable
- Level-triggered input used by MC_Power and the read blocks. The block works as long as Enable stays TRUE.
- Busy
- The block has accepted the command and has not finished. Busy can be TRUE while the axis is not moving yet, for example while a buffered move waits.
- Active
- This block is the one currently controlling the axis. With buffered moves, Busy and Active can differ.
- Done
- The command finished what it was asked to do. For a positioning move the setpoint has reached the target and, on most controllers, the actual position has settled inside the in-position window.
- InVelocity
- The output MC_MoveVelocity uses instead of Done: the axis has reached the commanded speed. It drops again if the speed is disturbed.
- CommandAborted
- Another block took over the axis before this one finished. It is not an error, but your sequence must notice it.
- Error / ErrorID
- The block could not run the command. ErrorID is vendor-specific, so read your library documentation for its meaning.
- BufferMode
- How a new move joins the current one: Aborting (replace now), Buffered (start when the current one is Done), or a Blending mode (merge at a chosen velocity).
- Aborting
- The default BufferMode. The new command takes the axis at once and the old block reports CommandAborted.
Motion profile
- Setpoint
- Where the controller wants the axis to be at this instant, calculated from the profile every motion cycle.
- Velocity
- The cruise speed of a move, in user units per second (mm/s, degrees/s).
- Acceleration / Deceleration
- How fast velocity is allowed to change, in units per second squared. Too high and the motor saturates or the load slips.
- Jerk
- How fast acceleration changes, in units per second cubed. Limiting it rounds the corners of the profile and reduces vibration, at the cost of a longer move.
- Trapezoid profile
- Accelerate, cruise, decelerate. On a short move there is no time to reach cruise speed and the trapezoid becomes a triangle.
- S-curve
- A profile with limited jerk. The velocity curve has rounded corners and the move takes a little longer than the trapezoid.
- Blending
- Joining two moves so the axis does not stop between them; the transition velocity is set by the BufferMode.
Position and feedback
- Actual position
- Where the encoder says the axis is. It lags the setpoint slightly in normal motion.
- Following error
- Setpoint minus actual position. A small, steady value is normal; a growing one means the axis is overloaded, blocked or badly tuned.
- In-position window
- How close the actual position must be to the target before the move counts as Done. Vendors also add a settling time.
- Encoder resolution
- Counts per motor revolution, for example 4096 or 2^20. Together with the gear ratio and screw pitch it sets the scaling to user units.
- Scaling
- The factor between encoder counts and user units: counts per revolution, gearbox ratio and travel per output revolution.
- Homing
- Establishing the link between encoder counts and machine coordinates, usually with a home switch, an index pulse or a hard stop.
- Absolute encoder
- Remembers its position through a power cycle, so the axis does not need to home after every start.
- Modulo axis
- A rotary axis whose position wraps, for example 0 to 360 degrees, so it can turn forever without overflowing.
- Software limits
- Position limits checked by the controller. A move outside them is refused before it starts.
- Touch probe / registration
- Latching the exact axis position at the instant a fast input changes, such as a print mark sensor. The latch happens in the drive or I/O, not in the PLC scan.
Synchronization
- Master / Slave
- In gearing and cams, the slave axis follows the position of the master axis rather than time.
- Virtual master
- A master axis with no motor, generated in software. Every slave follows it, so the line speed is one number.
- Electronic gearing
- The slave moves at a fixed ratio of the master (MC_GearIn). RatioNumerator 1 with RatioDenominator 2 makes the slave travel half the master distance.
- Electronic cam
- The slave position is looked up in a table against the master position (MC_CamIn), so it can rise, dwell and return within one master cycle.
- Phase shift
- An offset added to the master position seen by one slave, used to line a knife up with a print mark without stopping the line.
- Axis group
- Several axes moved together along a path (PLCopen Part 4), for example a linear or circular XY move at a constant path speed.
Safety and faults
- ErrorStop
- The state an axis enters on any fault. It refuses all motion until MC_Reset, after the cause is fixed.
- STO
- Safe Torque Off. A safety function inside the drive that removes torque. It belongs to the safety circuit, never to PLCopen logic.
- SS1 / SLS
- Safe Stop 1 (brake, then STO) and Safely Limited Speed: drive safety functions from IEC 61800-5-2, commanded by a safety PLC or relay.
- Hardware limit switch
- A switch near the end of travel wired to the drive. Hitting it stops the axis and puts it in ErrorStop.