DEV Community

yohan
yohan

Posted on Originally published at cnblogs.com

CODESYS Applied Practice — Axes (Part 1)

Environment: CODESYS V3.5 SP22 | Target: CODESYS Control Win V3 x64 simulation

Overview

The previous lesson built a minimal host/controller loop: three axes that were hand-rolled — FB_SimAxis parsed commands and climbed position itself. The motion was real; the axes were fake.

This lesson meets a real axis.

What is an axis?

Start from motion control. In short: an axis is the motion counterpart of a control object — setpoints and status on one side, drive + motor + encoder on the other, bound by mapping.

Two halves of one axis: control and motion, bound by mapping

MC function blocks

Motion control FBs share a common timing shape: execute edge, busy, done, error.

Common MC function-block timing: normal completion and abort

CiA 402

Drives speak a state machine: Not ready to switch on → Switch on disabled → Ready to switch on → Switched on → Operation enabled.

CiA 402 main path

Three boundaries

Three boundaries, three contracts

  1. Motion API (MC_*)
  2. Axis object (state + setpoints)
  3. Drive profile (CiA 402 / fieldbus)

Same program, swap the backend

Names stay fixed; the implementation can be simulated or real.

Same program: swap the backend, keep the names

Summary

  • Logical axis vs physical axis
  • Mapping binds them
  • MC timing is consistent across FBs
  • CiA 402 is the drive language
  • Same program can run on sim or hardware

Top comments (0)