How-to
How to run CiA402 axes in structured text without NC
Short answer
You can move EtherCAT servo axes from a PLC without a motion-control license by writing the CiA 402 state machine and the move profiles in plain structured text that maps the drive PDOs directly: one function block per axis, one command owner per axis, every transition gated on the returned status word. Commission the five hops from application to drive with a gate check each, and prove task timing under full load before enabling torque.
On this page
You can move CiA 402 servo axes from a PLC that has no motion-control license: in plain structured text, write control word 0006h (shutdown), then 0007h (switch on), then 000Fh (enable operation), each sent only after the drive's status word returns the matching decode (status AND 006Fh) = 0021h, then 0023h, then 0027h. Select profile position with operating mode 1, profile velocity with mode 3, homing with mode 6, and end a profiled move on status bit 10, target reached (0400h). Map all of that straight onto the drive's process data over EtherCAT, one function block per axis and one command owner per axis. The pattern is reported after years of running on three machines with six axes each, covering homing, profile position, profile velocity, jog and touch probe. What you take on is the engineering an NC runtime would otherwise do for you. Below is the state machine, the arbitration rule, the five commissioning gates and the timing proof, in the order you build them.
What you take over from the NC runtime #
The CiA 402 drive profile is the standard that makes this possible. In its model, the drive's state decides which commands are accepted; the host changes that state with the control word, internal events such as a fault can change it too, and the drive always reports where it is in the status word, with command values such as velocity carried in the cyclic process data. Eight states exist, and managing the transitions between them is the first job an NC runtime would have done for you.
So your structured text supplies the state machine, the profile and ramp generation, the mode switching (profile position is mode 1, profile velocity is mode 3, homing is mode 6), the touch-probe capture handling and the fault recovery. Not every drive family allows this shortcut: some servos expose motion only through their vendor's motion engine, which is why a Kinetix 5500 needs a motion-capable Logix controller. If your drives sit on CANopen behind a gateway instead of EtherCAT, the state machine is identical, and running CiA 402 CANopen drives from an S7-1500 through a gateway covers that transport's commissioning.
The state machine you implement #
The eight states are 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 sequence you send, and the decode you wait for before sending the next line, is fixed by the profile:
| You send | Control word | Drive goes to | Status decode you wait for |
|---|---|---|---|
| Shutdown | 0006h | Ready to switch on | (status AND 006Fh) = 0021h |
| Switch on | 0007h | Switched on | (status AND 006Fh) = 0023h |
| Enable operation | 000Fh | Operation enabled | (status AND 006Fh) = 0027h |
| Disable voltage | 0000h | Switch on disabled | (status AND 004Fh) = 0040h |
| Fault reset, rising edge on bit 7 | 0080h | Switch on disabled, out of Fault | (status AND 004Fh) = 0040h |
Fault decodes to 0008h under mask 004Fh, fault reaction active to 000Fh under mask 006Fh, and a profiled move ends when bit 10, target reached (0400h), sets while Operation enabled holds.
Never replace these returned-state checks with scan counters. Task load, EtherCAT recovery after a slave drops and re-enters the operational state, and the drive's own response time all change how many scans a transition needs, and a count that holds today fails on the day the machine is fully loaded. The status word is the only completion criterion.
Keep one command owner per axis #
Present one command point per axis through a structure or an interface, and defend that boundary. If jog, homing and profile logic each write to the same axis, a late write silently replaces a control action or a setpoint within one PLC scan, and the drive never sees the difference. So: one function block instance per mapped drive, bound only to that drive's PDO data; the instances sit in an array so every axis executes exactly once per task cycle; mode requests route through the single command object; and acceptance, active, complete, abort and fault behavior are defined before a second request is allowed. Remove or inhibit any direct write to the PDO outputs outside the axis layer.
Check the PDO layout before any motion #
Compare the drive configuration with the PLC mapping field by field: control word out, status word in, operating-mode selection, commanded and actual values, homing signals, touch-probe data. Confirm width, signedness, direction and scaling against the drive's own documentation; a field that changes but lands with the wrong type is still a mapping fault. And keep the cyclic path straight: an EtherCAT frame follows the wired slave chain in the configured order, so the installed order must match the configured topology. An IP ping to the controller proves nothing about this path, and no TCP or UDP port takes part in the PDO exchange.
Commission the five hops, each behind a gate #
A command travels from application to axis block to PDO image to EtherCAT frame to drive, and status returns the same way. Prove each hop before the next:
- Application to axis block. Route every command through the axis's single command point and give the application a result back: busy, complete, aborted or faulted. Gate: exactly one source owns the axis, confirmed by tracing one command and one returned status across the whole path without commanding torque or movement.
- Axis block logic. Test the function block in simulation against a CiA 402 emulator before it meets a real drive. Gate: every command produces deterministic transitions and results, faults included.
- PDO image. Toggle one harmless mapped field and watch it appear drive-side; change one drive status and watch it appear in the PLC. Gate: every field changes at the expected endpoint with the right type, while you record worst-case task time.
- EtherCAT path. Layer one first: controller power, drive control power, cable seating, connector condition, slave order against the configured topology, link indications. Gate: every required slave holds its operational state with diagnostic counters flat, machine stationary and again with drives enabled. Rising link, frame or working-counter errors point to wiring, topology, grounding or slave state, not to your structured text.
- Drive. Enable, disable, create a fault the machine's commissioning procedure permits, reset once, then re-enable one stationary axis, using only confirmed state transitions. Gate: the drive follows every requested state without a local fault. Do the first enables with the machine in its commissioning condition; this layer implements no safety function, and safe torque off stays in hardwired safety hardware.
Prove task timing under full load #
The PLC task must finish before its next release, and the EtherCAT update must stay synchronized with how the function blocks consume data. Read execution time from the runtime task diagnostics, worst case rather than average, with every axis instantiated and enabled; six axes is reported as the point where a compact embedded controller's headroom gets small. Watch the drive communication supervision at the same moment: no timeout or state drop may occur at worst-case load. If execution time approaches the task period, lengthen the period or split the work across tasks; never buy time by dropping state checks.
Enabling six axes: 3 gated waits in parallel, 18 in series #
Inputs for the six-axis machine this pattern runs on:
- Axes: 6, on one embedded controller (the reported installation).
- Transitions from Switch on disabled to Operation enabled: 3, namely shutdown, switch on and enable operation (CiA 402 drive profile).
- Confirmations per transition: 1 returned status-word match; the host may not assume a state.
- Placement: all six axis instances in one cyclic task (the array pattern above).
The rule: a parallel enable spends as many confirmation waits as the longest transition chain on one axis, while a serial enable spends transitions times axes. One wait lasts one task scan plus the drive's response time, both yours to measure, so count waits first.
Arithmetic:
- Parallel: longest chain = 3 waits.
- Serial: 6 axes × 3 transitions = 18 waits.
- Saved: 18 − 3 = 15 waits; ratio 18 ÷ 3 = 6.
- Elapsed time: T = waits × (T_scan + T_response), so the parallel enable costs 3 × (T_scan + T_response) with your measured scan time and drive response.
Result: commanded together, all six axes reach Operation enabled, decode 0027h under mask 006Fh, after 3 confirmation waits; one after another takes 18.
Decision: enable the six instances from one command in the same task. It is safe precisely because each block gates on its own axis's status word, never on a shared step counter, so the states stay per-axis even when the commands are not. Keep the one-axis-at-a-time order for the first-ever enable (gate five). Three waits is the floor: set each transition's timeout to twice the slowest confirmation you measured at gate five, and any axis not showing its expected status word when that expires reports faulted and takes no further commands.
Questions asked
Can this layer do electronic gearing and camming like MC_GearIn?
Not reliably. Engineers who ran direct-PDO axes report that a slave axis following a master is where the approach strains: the two drives occasionally fight each other, and chasing that costs production time. Keep gearing, camming and flying-shear style synchronization on a licensed motion controller with a real cam engine. Homing, profile position, profile velocity, jog and touch probe are the functions this pattern is proven for.
Will the same structured text work on drives from other vendors?
Yes, if the drive implements CiA 402 over EtherCAT with mappable process data: the eight states and the control word and status word decode are standard. What changes per vendor are the default PDO layout, the scaling of setpoints and actual values, and the homing methods and mode-specific bits. Re-run the five gate checks for each drive family, and expect homing to need the most rework.
What do I still need besides the PLC runtime?
The EtherCAT master configuration with the drives' device description files, and the drive vendor's commissioning tool for motor setup, tuning and the process-data layout. What you skip is the motion-control license and its NC axis runtime, because the state machine and profile generation now live in your code. The drive keeps its current and velocity loops; your task only delivers setpoints once per task period.
How many axes can one compact controller carry this way?
Six axes on one compact embedded controller is reported working on three machines, but also reported as the point where task headroom gets small. The honest limit is measured, not counted: read worst-case task execution time from the runtime diagnostics with every axis enabled, and require it to stay below the task period with drive communication supervision never timing out. Above six axes, or the moment you need gearing, plan a motion-capable controller.