PLCopen Motion Control Explained: Function Blocks, the Axis State Machine, MC_Power, MC_MoveAbsolute and Buffer Modes
Most servo bugs on a packaging line are not tuning problems. They are contract problems: a move that was silently aborted, a Done bit that was never seen because Execute dropped too early, or an axis parked in ErrorStop while the sequencer waits forever. PLCopen motion control exists to make that contract explicit. It defines a vendor-neutral set of IEC 61131-3 function blocks, one state machine per axis, and strict rules about how outputs behave from one scan to the next. That matters again now: on 17 November 2026 Siemens announced Simatic AX Motion Control Engineering, a text-based, Git-integrated environment that configures technology objects with PLCopen support. Motion is moving into the same diff-and-review workflows as logic. This guide explains the contract precisely enough to write, review and debug motion code on any compliant platform.
What this covers: the specification parts and versions, the axis state diagram, the Execute/Done/Busy/Active interface, MC_Power and MC_MoveAbsolute, every BufferMode, worked trapezoid and S-curve timing, drive-profile mapping to CiA 402 and PROFIdrive, vendor differences, a Structured Text homing sequence, and the bugs that keep recurring.
Context and Background
Before PLCopen motion control, every motion vendor shipped its own instruction set. Moving an application from one controller to another meant rewriting every move, every home and every error handler. PLCopen’s Technical Committee 2 (TC2) took a different route. It specified motion as ordinary IEC 61131-3 function blocks, so the same MC_MoveAbsolute call reads the same way in Beckhoff TwinCAT, CODESYS SoftMotion, a Siemens S7-1500 or a Mitsubishi iQ-R.
The PLCopen motion control suite is split into parts. The current base document is Function Blocks for Motion Control, Version 2.0, published 17 March 2011. It merged the former Part 1 (basics) and Part 2 (extensions) into one document. PLCopen’s overview lists the remaining parts as Part 3 (user guidelines and examples), Part 4 (coordinated multi-axis motion), Part 5 (homing procedures) and Part 6 (fluid power extensions). Part 5 Version 2.0 is dated 16 November 2011 and Part 6 Version 2.0 is dated 18 November 2011.
Part 4 is the active frontier of PLCopen motion control. In December 2025 PLCopen released a Part 4 Version 2.0 draft for comments, with a deadline of 18 February 2026. It adapts Siemens’ Standard Robot Command Interface (SRCI) into PLCopen form, keeping roughly 80% of SRCI’s essential functionality at under 10% of its size, according to industry reporting. ARC Advisory Group has since reported the Version 2.0 release; we could not confirm the final publication date on plcopen.org at the time of writing.
PLCopen motion control compliance is self-certified. A supplier tests its library against the specification and publishes a statement on the PLCopen website, listing which blocks it supports and at which level. Statements exist for Beckhoff TwinCAT, Siemens S7-1500, Rockwell Micro800 and many others. This matters because “PLCopen motion control compliant” never means “all blocks, all inputs”. It means the subset that the statement lists.
If you are new to how a controller executes these blocks, start with our explainer on the PLC scan cycle, IEC 61131-3 task scheduling and jitter. Motion blocks are ordinary function blocks called from a cyclic task, and every rule below is a rule about what happens between two calls. The primary reference throughout is the PLCopen Function Blocks for Motion Control Version 2.0 specification.
The PLCopen Motion Control Reference Model: One Axis, One State Machine, Many Function Blocks
PLCopen motion control models every axis as a single state machine with eight states. Function blocks are requests to move that machine between states. Administrative blocks read or configure the axis without changing state; motion blocks command trajectories and change it. Every block shares one output contract, so sequencing logic stays identical across vendors.
That single paragraph is the whole architecture. The rest of this section justifies each part of it.

Figure 1: The PLCopen axis state diagram. Motion function blocks request transitions; an axis error forces ErrorStop from any state.
The diagram reads left to right. An axis powers up in Disabled. MC_Power with Enable = TRUE moves it to Standstill. From there, MC_Home enters Homing, discrete moves such as MC_MoveAbsolute enter DiscreteMotion, and MC_MoveVelocity enters ContinuousMotion. Gearing and camming blocks put a slave axis into SynchronizedMotion. MC_Stop forces Stopping. Any axis error, from any state, forces ErrorStop.
The axis state diagram is the single source of truth
The specification is explicit that ErrorStop has the highest priority. It is entered on any axis error, and the axis stays there while the error is pending. No motion command is accepted until a reset is performed from ErrorStop. Beckhoff’s Tc2_MC2 documentation reproduces the same transition notes. MC_Reset with MC_Power.Status = FALSE takes the axis to Disabled. MC_Reset with Status = TRUE and Enable = TRUE takes it back to Standstill.
Power-off is the second universal transition. MC_Power with Enable = FALSE moves the axis to Disabled from any state except ErrorStop. Any motion in progress is aborted and the owning block reports CommandAborted. A loss of the power stage itself is treated as an error and goes to ErrorStop.
Two PLCopen motion control transitions catch people out. First, Stopping is sticky. The axis stays in Stopping for as long as MC_Stop.Execute is TRUE, even after it has reached zero velocity. It returns to Standstill only when Done is TRUE and Execute has gone FALSE. While Stopping is active, other motion blocks are rejected with an error. Second, MC_Halt is not a lighter MC_Stop. It moves the axis into DiscreteMotion until velocity reaches zero and can be aborted by a new motion command. MC_Stop can only be aborted by switching off power.
Homing is a real state. The base specification defines it, and Part 5 builds on it: Part 5’s step blocks such as MC_StepAbsoluteSwitch and MC_StepReferencePulse keep the axis in Homing, while finalizing blocks such as MC_HomeDirect, MC_HomeAbsolute and MC_FinishHoming return it to Standstill. That design lets you compose custom homing sequences from steps instead of relying on one opaque vendor routine.
Synchronized motion has its own exits. MC_GearOut and MC_CamOut move a slave from SynchronizedMotion back to ContinuousMotion at its current velocity. Issued in any other state, they generate an error. Blocks that do not appear in the diagram, such as MC_ReadStatus, MC_SetPosition or MC_CamTableSelect, do not change state at all.
Administrative versus motion function blocks
The specification sorts its PLCopen function blocks into four groups along two axes: administrative versus motion, and single-axis versus multi-axis.
Administrative single-axis blocks include MC_Power, MC_Reset, MC_ReadStatus, MC_ReadAxisError, MC_ReadParameter, MC_WriteParameter, MC_ReadActualPosition, MC_ReadActualVelocity, MC_ReadActualTorque, MC_SetPosition, MC_SetOverride, MC_TouchProbe, MC_DigitalCamSwitch and MC_AbortTrigger. The only multi-axis administrative block is MC_CamTableSelect.
Motion single-axis blocks include MC_Home, MC_Stop, MC_Halt, MC_MoveAbsolute, MC_MoveRelative, MC_MoveAdditive, MC_MoveSuperimposed, MC_HaltSuperimposed, MC_MoveVelocity, MC_MoveContinuousAbsolute, MC_MoveContinuousRelative, MC_TorqueControl and the three profile blocks. Motion multi-axis blocks are MC_CamIn, MC_CamOut, MC_GearIn, MC_GearOut, MC_GearInPos, MC_PhasingAbsolute, MC_PhasingRelative and MC_CombineAxes.
The split between these PLCopen function blocks is not cosmetic. Administrative blocks use the Enable/Valid pattern: they act continuously while Enable is TRUE and report Valid when their outputs are trustworthy. Motion blocks use the Execute/Done pattern: they latch inputs on a rising edge and report completion once. Mixing the two mental models is the root of a whole class of bugs. A common example is pulsing MC_ReadActualPosition.Enable and reading a stale value.
AXIS_REF is deliberately vendor-specific
Every block takes the axis as a VAR_IN_OUT of type AXIS_REF. The specification says its content is implementation dependent and may even be empty. That is the escape hatch that lets each vendor bind the standard interface to its own motion kernel. In CODESYS SoftMotion the type is AXIS_REF_SM3. In TwinCAT Tc2_MC2 it is AXIS_REF, a structure that carries status such as position, velocity and errors. Siemens binds blocks to technology objects (TOs) configured in TIA Portal.
The consequence is that PLCopen motion control standardises the call, not the axis. Scaling, modulo handling, limits, following-error windows and default dynamics all live in the vendor’s axis configuration. Portable code therefore needs a thin adapter layer for anything that touches AXIS_REF internals.
The PLCopen Motion Control Interface Contract: Execute, Done, Busy, Active, CommandAborted and Error
Every motion block in IEC 61131-3 motion control obeys the same output rules. Learn them once and you can read any vendor’s timing diagrams.

Figure 2: The handshake behind one MC_MoveAbsolute call. Inputs latch on the rising edge of Execute; the motion kernel streams setpoints each bus cycle; Done is reported once.
Figure 2 separates three layers that are easy to blur. The PLC task calls the block instance each scan. The motion kernel owns the profile generator and runs on its own cycle. The drive receives a new target position every bus cycle and returns actual position. The block’s outputs are only a window onto the kernel’s state.
Edge triggering and output exclusivity
The rules from the Version 2.0 specification are short and strict:
Executeis evaluated on its rising edge. Input values are latched at that edge.Busy,Done,ErrorandCommandAbortedare mutually exclusive. WhileExecuteis TRUE, exactly one of them is TRUE.Active,Done,ErrorandCommandAbortedare also mutually exclusive, with one exception: inMC_Stop,ActiveandDonecan both be set.Done,Error,ErrorIDandCommandAbortedreset on the falling edge ofExecute. That falling edge does not stop the movement.- If
Executefalls before the block completes, the completing output is still set for at least one cycle. - A new rising edge before completion gives no feedback for the previous action.
Busy rises with the rising edge of Execute and falls when Done, CommandAborted or Error rises. Active rises when the block actually takes control of the axis. In unbuffered mode Active and Busy can be identical. In buffered mode, Busy = TRUE with Active = FALSE means the command is queued and waiting.
Done means successful completion and nothing else. If another block interrupts the movement before it reaches the target, Done is never set; CommandAborted is set instead. The Inxxx outputs (InVelocity, InGear, InSync, InTorque) refer to the internal setpoint, not the actual axis value. InVelocity therefore says the profile generator has reached commanded speed, not that the encoder has.
Why the one-cycle rule creates bugs
The most common motion bug in code review is the one-shot Execute. A programmer pulses Execute for one scan and polls Done later. Because Done is guaranteed only for one cycle after completion when Execute is already low, a sequencer that checks Done in a different task, or in a branch that is skipped that scan, misses it. The axis reaches position and the state machine hangs.
The fix is structural. Hold Execute TRUE until you have observed Done, Error or CommandAborted, then drop it. Call the instance every scan, unconditionally, in the same task as the axis. Beckhoff’s general rules state the same requirement: while Busy is TRUE the block must be called cyclically for the command to execute. Skipping calls to an instance inside an IF branch is a classic way to strand a move.
ContinuousUpdate and changing inputs while Busy
By default, changing Position or Velocity while the block is Busy has no effect. The inputs were latched at the rising edge. The specification’s extended ContinuousUpdate input changes that: if it is TRUE at the rising edge of Execute, current input values are applied to the ongoing movement for as long as it remains TRUE, without retriggering the block. Support varies. CODESYS’s SM3_Basic MC_MoveAbsolute page does not list ContinuousUpdate, and Beckhoff’s Tc2_MC2 page states that an active move block cannot be retriggered with new parameters. You need a second instance instead.
MC_Power: one per axis, level-sensitive
MC_Power is the gatekeeper for every other block. Its basic input Enable switches the drive’s power stage, not the block itself. Extended inputs EnablePositive and EnableNegative are level-sensitive direction permissives and may both be TRUE. Outputs are Status (the effective state of the power stage), Valid, Error and ErrorID.
The specification says only one MC_Power should be issued per axis. Two instances fighting over Enable produce intermittent drops in the power stage that look like hardware faults. Put the one instance in the axis wrapper, gate its Enable with your safety and mode logic, and treat Status, not Enable, as the signal that the axis is ready.
MC_MoveAbsolute: the workhorse
MC_MoveAbsolute commands a controlled move to an absolute position. Its inputs, with the specification’s Basic (B) or Extended (E) classification, are:
| Input | Type | Class | Meaning |
|---|---|---|---|
| Execute | BOOL | B | Start on rising edge |
| ContinuousUpdate | BOOL | E | Apply input changes while running |
| Position | REAL | B | Target, in axis units |
| Velocity | REAL | B | Maximum velocity, not necessarily reached |
| Acceleration | REAL | E | Positive value |
| Deceleration | REAL | E | Positive value |
| Jerk | REAL | E | Positive value |
| Direction | MC_DIRECTION | B | Positive, shortest way, negative, current |
| BufferMode | MC_BUFFER_MODE | E | Sequencing versus the previous block |
Outputs are Done (B), Busy, Active, CommandAborted (E), Error (B) and ErrorID (E). Acceleration, deceleration and jerk are always positive. A value of zero gives implementation-dependent behaviour, and that is where vendors diverge. TwinCAT treats 0 as “use the axis configuration value”. Do not assume another platform does the same.
Direction only matters on a modulo (rotary) axis, where more than one mathematical solution exists. On a linear axis it is ignored. CODESYS SoftMotion defaults it to shortest way.
Deeper Analysis: BufferMode, Jerk-Limited Profiles and the Drive Underneath
BufferMode: how the next move meets the current one
In PLCopen motion control, BufferMode decides what happens when a new motion block is triggered while another one controls the axis. The specification defines six values.

Figure 3: The six PLCopen BufferMode values. Only Aborting cancels the running block; the others let it report Done.
- mcAborting (0), the default, starts immediately. It aborts any ongoing motion and clears the buffer. The aborted block reports
CommandAborted. - mcBuffered (1) starts after the current motion is Done. The axis comes to rest between the two moves; there is no blending.
- mcBlendingLow (2) starts after the previous block finishes, without stopping. The axis passes the first target at the lower of the two blocks’ velocities.
- mcBlendingPrevious (3) passes the first target at the first block’s velocity.
- mcBlendingNext (4) passes the first target at the second block’s velocity.
- mcBlendingHigh (5) passes the first target at the higher of the two velocities.
Suppliers may add values beyond 5. The blending modes are what make a sequence of point-to-point moves behave like a smooth path. Consider a pick-and-place axis moving from 0 to 300 mm at 500 mm/s, then on to 400 mm at 200 mm/s. With mcBuffered the axis decelerates to zero at 300 mm and starts again. With mcBlendingLow it crosses 300 mm already at 200 mm/s and continues. With mcBlendingHigh it holds 500 mm/s through 300 mm and must then decelerate to 200 mm/s on the second segment.
Implementations restrict the buffer depth. Beckhoff documents that only one command can be buffered; a further buffered command is rejected with error 0x4292. Continuous motion does not accept a buffered follow-on at all. TwinCAT also needs a second function block instance to use buffering, since an active instance cannot be retriggered. CODESYS documents that while MC_MoveAbsolute is Busy, only BufferMode = Aborting is allowed for that instance. The pattern is the same: one instance per queued segment, typically two instances in ping-pong.
Worked numbers: trapezoid versus S-curve
Acceleration, Deceleration and Jerk define the profile shape. A trapezoidal profile has infinite jerk at the corners. An S-curve limits jerk, which reduces excitation of mechanical resonances at the cost of time. The trade is easy to quantify.
Take a 500 mm move with velocity 250 mm/s, acceleration and deceleration 1,000 mm/s² and, for the S-curve, jerk 10,000 mm/s³. These numbers are illustrative, chosen for easy arithmetic, and the figures below are computed from first principles.
For the trapezoid, acceleration takes v/a = 0.25 s and covers v²/2a = 31.25 mm. Deceleration is symmetric. The cruise covers 500 − 62.5 = 437.5 mm at 250 mm/s, which takes 1.75 s. Total time is 2.25 s.
For the S-curve, each jerk ramp lasts a/j = 0.1 s. The acceleration phase now takes v/a + a/j = 0.35 s and covers v × 0.35 / 2 = 43.75 mm. Both ramps together cover 87.5 mm. The cruise covers 412.5 mm in 1.65 s. Total time is 2.35 s.
The general rule for a symmetric move that reaches both full acceleration and full velocity is T = D/v + v/a + a/j. The jerk limit adds exactly a/j, here 0.1 s or about 4.4%. That is a cheap price for a long move.
Short moves are different. For a 20 mm move with the same limits, the trapezoid never reaches 250 mm/s. It becomes a triangle with peak velocity √(a·D) ≈ 141 mm/s and total time 2√(D/a) ≈ 0.283 s. The S-curve, with jerk ramps of 0.1 s each, peaks at exactly 100 mm/s and takes 0.40 s. The jerk limit now costs about 41% of cycle time. On an indexing machine doing short moves, that is the difference between hitting and missing rate.
The engineering conclusion is to set jerk per move, not globally. Use generous jerk on short indexing moves, where the time penalty is large. Use tight jerk on long, heavy moves, where resonance hurts more than 4% of time. Because Jerk is an input on MC_MoveAbsolute, PLCopen motion control lets you do this in application code.
Discretisation also matters. At a 1 ms motion cycle, the 2.35 s S-curve move is streamed to the drive as 2,350 position setpoints. At 250 mm/s each setpoint advances 0.25 mm at cruise. The bus cycle, not the profile, sets the floor on how finely a blend or a cam can be shaped.
How function blocks reach the drive

Figure 4: From Structured Text to motor shaft. PLCopen motion control standardises the top layer; the drive profile standardises the bottom.
PLCopen motion control deliberately says nothing about the fieldbus. The motion kernel turns block calls into a setpoint stream, and a drive profile carries that stream to the servo amplifier. Two drive profiles dominate IEC 61131-3 motion control in practice.
CiA 402 (CANopen drive profile) runs over CANopen and over EtherCAT as CoE. It follows IEC 61800-7-201. The drive has its own state machine with states Not ready to switch on, Switch on disabled, Ready to switch on, Switched on, Operation enabled, Quick stop active, Fault reaction active and Fault. The controller drives it through the controlword at object 0x6040 and reads the statusword at 0x6041. The command sequence Shutdown (0x0006), Switch on (0x0007) and Enable operation (0x000F) takes a healthy drive to Operation enabled. That is essentially what MC_Power does underneath on a CiA 402 axis.
Modes of operation are selected through object 0x6060. Values include Profile Position (1), Profile Velocity (3), Profile Torque (4), Homing (6), Cyclic Synchronous Position (8), Cyclic Synchronous Velocity (9) and Cyclic Synchronous Torque (10). In CSP mode the PLC’s profile generator computes the trajectory and sends a new target position every cycle, clock-synchronous with the bus. The drive closes its position and speed loops on that stream. Most PLCopen implementations over EtherCAT use CSP for exactly this reason: the trajectory, buffering and blending live in the PLC, where the function blocks can see them. In Homing mode, by contrast, the drive runs the homing method itself, so MC_Home becomes a mode switch plus a wait.
PROFIdrive runs over PROFIBUS and PROFINET and is also standardised in IEC 61800-7. Its application classes describe where control lives. In AC3 the drive is an autonomous positioner. In AC4 (central motion control) the controller closes the position loop over the bus and the drive runs speed control. That requires isochronous operation over PROFIBUS DP-V2 or PROFINET IRT, with clock jitter of 1 µs or less, per the PROFIdrive system description. Optional Dynamic Servo Control (DSC) moves the fast part of the position loop into the drive. On the S7-1500, Siemens documents standard telegram 3 for positioning axes and states that telegram 5 is the standard telegram that supports DSC, with isochronous mode required.
For a deeper comparison of these buses, see our analysis of PROFINET vs EtherCAT vs OPC UA FX over TSN and the narrower EtherCAT vs PROFINET vs SERCOS motion control comparison.
Vendor differences that matter
Across PLCopen motion control implementations, the same MC_MoveAbsolute name hides real differences. The decision matrix below summarises what we verified in vendor documentation.
| Aspect | Beckhoff TwinCAT Tc2_MC2 | CODESYS SoftMotion SM3_Basic | Siemens S7-1500 TO | Rockwell Logix |
|---|---|---|---|---|
| Axis binding | AXIS_REF structure |
AXIS_REF_SM3 |
Technology object in TIA Portal | Axis tag plus MOTION_INSTRUCTION control tag |
| Absolute move | MC_MoveAbsolute |
MC_MoveAbsolute |
MC_MoveAbsolute |
MAM, Move Type 0 (Absolute) |
| Position datatype | LREAL | LREAL | Check TO docs | Check instruction docs |
| Zero Acc/Dec/Jerk | Uses axis configuration value | Not specified on block page | Not verified here | Jerk operands used only with S-curve profile |
| Buffering | One buffered command; needs a second instance | Only Aborting allowed while the instance is Busy | Not verified here | Merge Disabled or Enabled, plus Merge Speed |
| ErrorID type | UDINT | SMC_ERROR |
Not verified here | .ER bit plus error code |
| “Arrived” bit | Done |
Done |
Done |
.PC, not .DN |
Cells marked “not verified here” are deliberate: we only filled in what the vendors’ current documentation states, and you should check the rest against your exact firmware and library version.
The Rockwell column deserves emphasis. Logix motion instructions are not PLCopen blocks. On MAM, .DN means the move was successfully initiated, and .PC (process complete) means the axis reached the end position. An engineer trained on PLCopen motion control reading .DN as “arrived” will release the next station while the axis is still travelling. Rockwell’s Micro800 line, by contrast, ships PLCopen-style blocks and has a published PLCopen statement.
Siemens adds homing modes on MC_Home. In the S7-1200 V6 documentation, for example, Mode 0 is direct absolute homing, Mode 1 direct relative, Mode 2 passive homing, Mode 3 active homing, and Modes 6 and 7 are absolute-encoder adjustments stored retentively. TwinCAT and CODESYS expose their own homing options. This is exactly the fragmentation Part 5’s step blocks were written to remove.
If you are choosing between the two most common soft-PLC runtimes, our CODESYS vs TwinCAT soft PLC comparison covers licensing, real-time behaviour and motion packages.
A Structured Text Homing and Absolute-Move Sequence
The code below is a portable pattern written against the PLCopen motion control interface. Vendor-specific points are marked in comments: the axis type, the MC_Home mode or options, and the ErrorID type. It uses one instance per block, calls every instance every scan, holds Execute until an outcome is observed, and routes every error to one recovery path.
FUNCTION_BLOCK FB_AxisSequence
VAR_IN_OUT
Axis : AXIS_REF; (* AXIS_REF_SM3 in CODESYS, TO in Siemens *)
END_VAR
VAR_INPUT
Start : BOOL; (* operator or sequencer request *)
AckFault : BOOL; (* rising edge resets the axis *)
TargetPos : LREAL := 250.0;
MoveVel : LREAL := 200.0;
END_VAR
VAR_OUTPUT
InPosition : BOOL;
Faulted : BOOL;
LastError : UDINT; (* WORD / SMC_ERROR on other platforms *)
END_VAR
VAR
fbPower : MC_Power;
fbReset : MC_Reset;
fbHome : MC_Home;
fbMove : MC_MoveAbsolute;
fbStatus : MC_ReadStatus;
rtStart : R_TRIG;
rtAck : R_TRIG;
tonPower : TON;
eStep : (IDLE, POWER_ON, HOMING, MOVING, DONE, FAULT, RESETTING) := IDLE;
END_VAR
rtStart(CLK := Start);
rtAck(CLK := AckFault);
(* 1. Status and power: called every scan, unconditionally *)
fbStatus(Axis := Axis, Enable := TRUE);
fbPower(Axis := Axis,
Enable := (eStep <> IDLE) AND (eStep <> FAULT),
EnablePositive := TRUE,
EnableNegative := TRUE);
(* 2. Global error trap: any FB error or ErrorStop wins *)
IF (eStep <> FAULT) AND (eStep <> RESETTING) AND
(fbStatus.ErrorStop OR fbPower.Error OR fbHome.Error OR fbMove.Error) THEN
IF fbMove.Error THEN LastError := fbMove.ErrorID;
ELSIF fbHome.Error THEN LastError := fbHome.ErrorID;
ELSIF fbPower.Error THEN LastError := fbPower.ErrorID;
END_IF
eStep := FAULT;
END_IF
CASE eStep OF
IDLE:
InPosition := FALSE;
IF rtStart.Q THEN
eStep := POWER_ON;
END_IF
POWER_ON:
tonPower(IN := TRUE, PT := T#2S);
IF fbPower.Status THEN
tonPower(IN := FALSE);
eStep := HOMING;
ELSIF tonPower.Q THEN
tonPower(IN := FALSE);
eStep := FAULT; (* drive never reached Operation enabled *)
END_IF
HOMING:
(* Execute held TRUE until an outcome is observed *)
IF fbHome.Done THEN
eStep := MOVING;
ELSIF fbHome.CommandAborted THEN
eStep := FAULT;
END_IF
MOVING:
IF fbMove.Done THEN
InPosition := TRUE;
eStep := DONE;
ELSIF fbMove.CommandAborted THEN
eStep := FAULT; (* someone else took the axis *)
END_IF
DONE:
IF rtStart.Q THEN (* next cycle: drop Execute first *)
InPosition := FALSE;
eStep := MOVING;
END_IF
FAULT:
Faulted := TRUE;
IF rtAck.Q THEN
eStep := RESETTING;
END_IF
RESETTING:
IF fbReset.Done THEN
Faulted := FALSE;
eStep := IDLE; (* re-home after every fault *)
ELSIF fbReset.Error THEN
eStep := FAULT;
END_IF
END_CASE
(* 3. Motion FBs: called every scan; Execute derived from the step *)
fbHome(Axis := Axis,
Execute := (eStep = HOMING),
Position := 0.0,
BufferMode := MC_BUFFER_MODE.mcAborting);
(* vendor: add Mode / HomingMode / Options here *)
fbMove(Axis := Axis,
Execute := (eStep = MOVING) AND NOT fbMove.Done,
Position := TargetPos,
Velocity := MoveVel,
Acceleration := 1000.0,
Deceleration := 1000.0,
Jerk := 10000.0,
Direction := MC_DIRECTION.mcPositiveDirection,
BufferMode := MC_BUFFER_MODE.mcAborting);
fbReset(Axis := Axis, Execute := (eStep = RESETTING));
END_FUNCTION_BLOCK
Three details in this sample are deliberate. First, Execute is computed from the step variable after the CASE, so it is driven every scan and drops cleanly when the step changes. Moving from DONE back to MOVING produces the falling-then-rising edge a new move needs, because the DONE step holds Execute low for at least one scan, which also resets Done. Second, the error trap runs before the CASE. Any block error or an axis in ErrorStop overrides whatever step the sequencer believed it was in. Third, recovery goes through MC_Reset and back to IDLE, which forces a fresh power-up and re-home. Some machines can skip re-homing with absolute encoders; make that an explicit decision, not an accident.
Two limits apply. Enumeration qualifiers such as MC_BUFFER_MODE.mcAborting and the MC_ReadStatus.ErrorStop output name follow the specification, but some libraries spell them differently. Check your vendor’s library before compiling. The code has not been compiled against a specific runtime for this article.
Trade-offs, Gotchas, and What Goes Wrong with PLCopen Motion Control
PLCopen motion control standardises the interface, not the behaviour behind it. That gap is where projects lose time.
“Compliant” is a subset. A PLCopen statement lists supported blocks and whether extended inputs are implemented. ContinuousUpdate, MC_MoveAdditive or the blending modes are frequently missing or partial. Read the statement before you design around a feature.
Zero means different things. The specification calls zero acceleration, deceleration or jerk implementation dependent. TwinCAT substitutes axis defaults. Another platform may reject the command or, worse, treat zero jerk as infinite. Always pass explicit values in portable code.
Units are not in the PLCopen motion control standard. Position is in “technical units” set by axis scaling. A library ported from a millimetre machine to a degree machine will move, just not where you expect. Keep scaling in one configuration file under version control. Tools such as Simatic AX MCE make that practical.
Busy is not Active. In buffered sequences, Busy without Active means “queued”. An HMI that shows Busy as “moving” will mislead operators and maintenance staff.
CommandAborted is not an error. It is the normal outcome of an aborting move, an MC_Stop or a power-off. Treating it as success strands sequences; treating every instance of it as a fault produces nuisance alarms. Decide per step, as the sample code does.
Multiple writers on one axis. Two parts of the program issuing aborting moves to the same axis will fight, each aborting the other. The symptom is an axis that twitches and never arrives. Enforce single ownership in an axis wrapper.
Stopping is not a safety function. MC_Stop is a functional stop in the PLC’s standard task. Protective stops belong in the drive’s safety functions (STO, SS1, SS2) commanded through a safety protocol. Our guide to IEC 61508 functional safety and safety PLC architecture explains why the two must stay separate.
Task-cycle mismatch. Calling blocks from a 10 ms task while the motion kernel runs at 1 ms adds up to one task period of latency to every handshake. That is fine for indexing. It is not fine when you are trying to react to a touch-probe latch inside a cam window.
Rockwell’s DN. As noted above, MAM.DN means “initiated”, not “arrived”. It is the single most expensive misreading when engineers move between platforms.
Practical Recommendations
Treat PLCopen motion control as an interface contract, and engineer the parts it leaves open. Wrap each physical axis in one function block that owns MC_Power, MC_Reset and MC_ReadStatus, exposes a small command interface, and is the only code that writes to that AXIS_REF. Every other module asks the wrapper to move; nobody touches the axis directly.
In PLCopen motion control code, write the state machine around outcomes, not intentions. Each step ends on Done, Error or CommandAborted, never on a timer alone. Use timers only as watchdogs that escalate to a fault.
Choose BufferMode deliberately. Default to mcAborting for single moves. Use mcBuffered when the mechanism must settle at an intermediate point, such as a vacuum pick. Use blending only when you have checked the resulting velocity at the transition point against your mechanics.
Set dynamics per move. Use the T = D/v + v/a + a/j relation to estimate cycle time before you tune, and expect jerk limits to hurt short moves far more than long ones.
Test the PLCopen motion control contract before the hardware arrives. A simulated axis or a virtual-commissioning model exercises every transition, including ErrorStop, faster than a real machine. See our walkthrough of virtual commissioning with software-in-the-loop and hardware-in-the-loop.
A short checklist for code review:
- Every motion instance is called every scan, outside conditional branches.
Executeis held until an outcome is observed.- Exactly one
MC_Powerper axis. - Every
ErrorandErrorStopreaches one recovery path throughMC_Reset. - Acceleration, deceleration and jerk are explicit, non-zero values.
- BufferMode is chosen per move and documented.
- The vendor’s PLCopen compliance statement covers every block and extended input used.
- Axis scaling and limits live in version-controlled configuration.
Frequently Asked Questions
What is PLCopen motion control?
PLCopen motion control is a set of vendor-neutral specifications from PLCopen Technical Committee 2 that defines motion commands as IEC 61131-3 function blocks. It covers single-axis and multi-axis blocks such as MC_Power, MC_Home and MC_MoveAbsolute, a per-axis state diagram, and common output rules. Its purpose is to make motion code readable and largely portable across controllers from different vendors. The base document is Function Blocks for Motion Control Version 2.0 from 2011, extended by parts for coordinated motion, homing and fluid power.
What are the states in the PLCopen axis state diagram?
The axis state diagram has eight states: Disabled, Standstill, Homing, DiscreteMotion, ContinuousMotion, SynchronizedMotion, Stopping and ErrorStop. An axis starts in Disabled and reaches Standstill through MC_Power. Discrete moves such as MC_MoveAbsolute enter DiscreteMotion, MC_MoveVelocity enters ContinuousMotion, and gearing or camming enters SynchronizedMotion. MC_Stop forces Stopping. ErrorStop has the highest priority and is entered from any state on an axis error. It is left only through MC_Reset, which returns the axis to Standstill or Disabled.
What is the difference between MC_Stop and MC_Halt?
MC_Stop puts the axis into the Stopping state and cannot be aborted by any other motion command, only by switching off power. The axis stays in Stopping while Execute is held TRUE, which blocks other motion. MC_Halt decelerates the axis to zero while it remains in DiscreteMotion, then returns it to Standstill. A new motion command can abort MC_Halt during its deceleration. Use MC_Stop when you need to lock the axis, for example during a fault or maintenance. Use MC_Halt for a normal, interruptible controlled stop.
What does BufferMode do in MC_MoveAbsolute?
BufferMode tells MC_MoveAbsolute how to relate to a move already running on the same axis. mcAborting, the default, cancels the running move immediately. mcBuffered waits until the running move is Done and the axis is at rest. The four blending modes start the new move without stopping. They pass through the first target at the lower velocity, the first block’s velocity, the second block’s velocity, or the higher velocity. Vendors limit buffer depth and usually require a separate function block instance for each queued move.
Why is my MC_MoveAbsolute Done bit never seen?
Usually Execute was pulsed for a single scan, or the block instance is not called every scan. When Execute is already FALSE at completion, Done is guaranteed for only one cycle. A sequencer polling from another task, or from a skipped branch, misses it. Hold Execute TRUE until you see Done, Error or CommandAborted. Call the instance unconditionally in the axis task. Also check whether another block aborted the move. In that case Done is never set and CommandAborted is set instead.
How do PLCopen function blocks talk to EtherCAT servo drives?
The function blocks feed a motion kernel that generates the trajectory. On EtherCAT the kernel usually drives a CiA 402 servo in Cyclic Synchronous Position mode, value 8 in object 0x6060. Each bus cycle it writes a new target position and reads actual position. MC_Power maps onto the CiA 402 controlword sequence Shutdown, Switch on and Enable operation. MC_Home may switch the drive into its own Homing mode. PROFINET drives use PROFIdrive telegrams instead, with central motion control (application class 4) requiring isochronous communication.
Further Reading
- PLC scan cycle, IEC 61131-3 determinism, jitter and task scheduling: how cyclic tasks execute the function blocks described here.
- CODESYS vs TwinCAT soft PLC comparison: the two most common PLCopen-compliant runtimes compared.
- PROFINET vs EtherCAT vs OPC UA FX over TSN: the deterministic networks underneath the drive profiles.
- EtherCAT vs PROFINET vs SERCOS for motion control: motion-specific bus trade-offs.
- Virtual commissioning with SIL and HIL: testing axis state machines before hardware.
- PLCopen Function Blocks for Motion Control, Version 2.0: the primary specification.
- PLCopen Motion Control Part 5: Homing Procedures, Version 2.0: composable homing step blocks.
- Beckhoff Tc2_MC2 general rules for MC function blocks: a vendor’s precise implementation of the output contract.
- PROFIdrive System Description: application classes and isochronous motion.
- Siemens press release on Simatic AX Motion Control Engineering, 17 November 2026.
By Riju — about
