PLCopen motion control

A free, open fieldbook on PLCopen motion control. It starts with one axis and a single move, and finishes with cams, coordinated paths and getting a machine back after a fault. Every chapter has something you can run.

PLCopen state diagram and axis wiring

What you will learn to do

Move an axis to a target

Choose an absolute or relative move, then use Busy and Done to decide when the machine sequence can continue.

Choose speed and acceleration

Compare motion profiles to see how your settings change travel time and the way an axis starts and stops.

Make position match the machine

Work out how encoder counts, a gearbox and screw pitch become millimetres of carriage travel.

Understand coordinated motion

Explore gearing, cams and two-axis paths with mathematical models before working with a controller library.

Why a standard for motion?

Before PLCopen, every drive vendor had its own way to say "go to 200 mm". Moving a program from one controller to another meant rewriting the motion layer, and often the whole sequence around it.

PLCopen Motion Control Part 1 fixed the vocabulary: one state machine per axis, and blocks like MC_Power, MC_MoveAbsolute and MC_Stop with the same Execute, Done, Busy and Error handshake everywhere. Beckhoff, CODESYS, Siemens, Omron and others follow it, each with their own extras.

The standard does not make vendors identical. Error codes, buffering details and timing differ. What it gives you is a shared way of thinking, and that is what this book teaches.

Simulators

  • Live axis. Real MC_Power, MC_MoveAbsolute, MC_Halt and MC_Stop running on the TryPLC motion engine.
  • Profile shaper. Drag velocity and acceleration and watch the trapezoid stretch or turn into a triangle.
  • Scaling bench. Encoder counts to millimetres through gearbox and screw pitch.
  • Gear and cam. A slave axis following a master, ratio by ratio, point by point.
  • Path planner. Two axes moving together along a line, with the completion shown live.
  • Load sizing. Force, screw efficiency and pitch turned into required motor torque.

Learning path

  1. First axis. Power, home and move one axis. Read the handshake.
  2. Profiles. Velocity, acceleration and jerk, and what they cost in time.
  3. Units. Counts, millimetres, screw pitch and gearboxes.
  4. Stop and recover. Stop, Halt, ErrorStop, Reset and safe restarts.
  5. Synchronize. Electronic gearing and cams following a master.
  6. Capstone. A full machine sequence with faults to handle.

Course contents

  1. What an axis actually controls

    Follow a move from PLC to carriage, and learn what setpoint, actual position and following error can and cannot prove.

  2. Units, encoders and screw pitch

    Turn encoder counts into millimetres through gearbox and screw, work out speed limits, and catch the scaling mistakes that move axes too far.

  3. Axis states and drive enable

    Read the PLCopen axis states, see what MC_Power and Status really prove, and tell a refused command from a faulted axis.

  4. Execute, Busy, Active and Done

    Follow one motion command scan by scan, read every handshake output, and see what Done waits for on each vendor's controller.

  5. Positioning and continuous travel

    Choose absolute, relative, additive or velocity moves, read Done and InVelocity, and pick a safe direction on rotary axes.

  6. Acceleration, braking and jerk

    Work out trapezoid and triangle move times, braking distances and what a jerk limit costs, and compare how vendors treat Jerk = 0.

  7. Stopping, pausing and restarting

    Use MC_Halt for pauses and MC_Stop for stops that must win, release the lock deliberately, and leave protection to the safety circuit.

  8. Queues and blended moves

    Choose a BufferMode, read Busy and Active on queued moves, send the next command in time, and build a queue where only Aborting exists.

  9. Homing and coordinate validity

    Plan a bounded reference search, fix home jumping by one screw pitch, and know when an absolute encoder's position stops being valid.

  10. Registration and position capture

    Turn capture delay into millimetres, use touch probes, windows and clamps, and keep every capture attached to the product it measured.

  11. Master axes and electronic gearing

    Work out gear ratios with units, see why MC_GearIn at speed leaves a phase lag, and plan engagement and decoupling on a flying saw.

  12. Electronic cams and phase

    Read a cam table, see what interpolation and motion laws do to velocity and acceleration, and switch or engage cams without a jump.

  13. Groups and coordinated paths

    Split path speed into axis speeds, see why two single moves draw a dog-leg, and learn axis groups, frames, corners and conveyor tracking.

  14. Sizing, following error and tuning

    Work out load torque, inertia, RMS duty and speed for a servo axis, then read following error and latch an alarm before the drive trips.

  15. Diagnostics and recovery sequences

    Give each axis one owner, record every outcome, set timeouts from the profile and restart a machine from evidence after a fault.

  16. Build a transfer-cell sequence

    Build a full transfer cell on the engine: power, home, pick, wait, place and return, with alarm codes, reset rules and safety boundaries.

What PLCopen Motion is, and why it exists

A PLC can switch an output in one scan. Moving a carriage to a fixture takes many scans, a coordinate that means something on the machine, and a drive that can follow the requested speed and acceleration. Until the late 1990s every controller vendor solved that problem in its own way. A positioning module from one manufacturer had its own function blocks and data blocks, a servo card from another had its own instructions, and a drive talked through its own parameter handshake. A programmer who moved to a different controller relearned motion from the beginning, and a machine builder who changed suppliers rewrote the motion layer of every machine.

PLCopen is a vendor-independent association founded in 1992 to promote IEC 61131-3, the standard behind Structured Text, ladder and the other PLC languages. Its motion committee published Function Blocks for Motion Control, usually called PLCopen Motion Control Part 1, in 2001. Version 2.0 in 2011 merged the old Part 2 extensions into it. Later parts add user guidelines (Part 3), coordinated multi-axis motion (Part 4), homing procedures (Part 5) and fluid power (Part 6).

Part 1 fixes four things. It names the blocks and their pins: MC_Power, MC_Home, MC_MoveAbsolute, MC_Stop and the rest. It defines a state model for every axis, so you can tell from the state which commands will be accepted. It defines a handshake (Execute, Busy, Active, Done, CommandAborted, Error) that behaves the same way on every block. And it says what happens when a second command arrives while the first is still running.

It leaves the rest to the vendor, and that is where most commissioning time goes: how an axis is configured, how encoder counts become millimetres, how the drive loops are tuned, which fieldbus carries the setpoints, and what the numbers in ErrorID mean. A sequence written against PLCopen reads almost the same on two controllers. The axis underneath is set up differently on each.

Who uses it

Machine builders use PLCopen motion in packaging, printing, converting, labelling, assembly and handling. Beckhoff TwinCAT implements it in the Tc2_MC2 library. Siemens uses PLCopen block names for the motion instructions that command technology objects on the S7-1500 and S7-1500T in TIA Portal. CODESYS SoftMotion implements it, and so do the many controllers built on CODESYS. Omron's NJ/NX controllers follow it closely, and Kollmorgen, Yaskawa and others publish PLCopen libraries for their own platforms.

Rockwell's Logix controllers are the exception you are most likely to meet: their native motion instructions (MSO, MAM, MAJ, MAS) are not PLCopen blocks, although the ideas map across. Where vendors differ in a way that changes your code, the chapters name the vendor and the exact parameter.

The reader this course has in mind is a technician or junior engineer who knows PLC logic, timers and sequences, and has never commissioned a servo axis. Maintenance staff who need to read someone else's motion code, and programmers moving from one controller brand to another, will find the vendor comparisons useful.

How the course is laid out

Sixteen chapters in three parts follow the order in which you meet things on a real machine.

Foundations covers one axis and one command. What an axis actually controls follows a command from the PLC to the load and explains setpoint, actual position and following error. Units, encoders and screw pitch turns encoder counts into millimetres. Axis states and drive enable covers the state model and MC_Power. Execute, Busy, Active and Done follows one command scan by scan.

Machine programming builds sequences: absolute, relative and velocity moves, motion profiles and jerk, MC_Halt against MC_Stop, queued and blended moves, homing, and registration.

Synchronization and commissioning covers electronic gearing and cams, coordinated multi-axis paths, sizing and tuning, diagnostics and recovery, and a capstone that builds a complete transfer-cell sequence with faults to handle.

Each chapter defines its terms where they first appear and works through real numbers. Where vendors differ it names them, and most chapters include a field story: a symptom, its cause and the fix.

What you will be able to do

By the end you should be able to read a PLCopen motion program on any of the platforms above and say what it will do. You will be able to write a sequence that powers an axis, homes it, moves it and handles all three endings of every command (Done, CommandAborted and Error) instead of only the happy one. You will be able to check an axis's scaling with a calculator and a measured test move, choose between MC_Halt and MC_Stop, work out how long a move will take from its velocity and acceleration, and explain what gearing and cams do to a slave axis. You will also know where standard motion logic stops and the safety system takes over.

The course will not make you a drive tuning specialist, and passing its checks is not a commissioning qualification. It gives you the vocabulary and the habits that make the vendor manuals readable.

How to use the benches and exercises

Each chapter opens with a machine bench. The axis bench runs TryPLC's own motion runtime, with real MC_Power, MC_MoveAbsolute, MC_Home, MC_Halt and MC_Stop blocks at 20 ms per scan. You can advance one scan at a time to inspect an edge, or run scans and watch the carriage. The other benches (profile, scaling, gear and cam, path, sizing) are calculation models that let you change one number and see its effect. Each bench says plainly what it does not model.

Inside the text you will find three kinds of exercise. Live examples are short Structured Text programs that run on the site's engine at 100 ms per scan; switch their inputs, step through them and edit the code. Prediction questions ask you to commit to an answer before the engine checks it. Challenges are graded machine tasks: you write the logic, and a set of plant cases tests it, including the awkward ones such as a start button held through a power cycle. Each chapter ends with reasoning questions about real situations.

Progress is saved in your browser only. Reading a chapter and passing its checks are recorded separately.

The engine implements fifteen PLCopen blocks for a single axis, with the Aborting buffer mode only. Gearing, cams, axis groups, buffered and blended moves and touch probes are shown as vendor listings and as plain ST arithmetic you can run, and the text says which is which.

Terms you will meet

An axis is the controller's model of one mechanism, and your program refers to it through an AXIS_REF. The setpoint is where the controller wants the axis to be at this instant; the actual position is where the encoder says it is; following error is the difference between them. Execute starts a command on a rising edge, while Enable keeps a block working for as long as it is TRUE. Busy, Active, Done, CommandAborted and Error report how a command is going and how it ended. BufferMode decides what happens when a new command meets a running one. Homing connects encoder counts to a physical datum. In gearing and cams, a slave axis follows a master axis instead of following time. STO, Safe Torque Off, is a drive safety function wired from the safety circuit; PLCopen logic can only read its state.

The state diagram and glossary page has every state, every transition and the full list of terms, and it is worth keeping open in a second tab.

Safety comes first

Ordinary motion logic is not a safety function. MC_Stop, software limits and following-error alarms protect the machine and the product; people are protected by safety functions such as STO, SS1 and safely limited speed, triggered by a safety relay or safety controller and validated against the machine's risk assessment. Before working on physical equipment, use the machine's safety arrangement, the current manufacturer documentation and the site's approved procedures.