Skip to main content
AH / SYSTEMS
01PHYSICAL MOTION CONTROL

Beckhoff TwinCAT 3 Linear Axis Control

Sensor-based travel-limit discovery and automatic positioning on a physical TwinCAT 3 axis.

  • PHYSICAL SYSTEM
  • SOURCE AVAILABLE
  • HARDWARE TESTED
  • TwinCAT 3
  • Structured Text
  • PLCopen Motion
  • EtherCAT
Illustrative close-up of a CNC spindle above a metal surface.
OPERATOR /SENSORSTWINCAT PLCPLCopenMOTIONNC AXISETHERCATDRIVEPHYSICALAXIS

INPUTS

Hardware controls and end sensors enter the PLC

Enable, reset, speed, jog and automatic-cycle inputs are evaluated together with the two physical end-position sensors.

CONTROL

TwinCAT separates manual and automatic control

Structured Text coordinates operator intent, interlocks, reset handling and the explicit automatic sequence before motion is commanded.

MOTION & FIELD

PLCopen commands motion through EtherCAT

PLCopen blocks command the configured NC axis, with EtherCAT carrying motion to the drive and mechanism.

PHYSICAL TEST

Movement was checked on the laboratory axis

Movement and end-position behaviour were tested on the physical setup.

MY CONTRIBUTION

Coordinating operator inputs, motion commands and axis feedback

I developed the Structured Text sequence that connects hardware inputs and end sensors to PLCopen motion commands. I linked the hardware I/O, tested movement and end-position behaviour on the physical axis, and created the HMI view for axis and system monitoring.

ENGINEERING APPROACH

Finding the travel range before automatic positioning

Manual jogging and automatic operation use separate command paths. The automatic sequence first locates both end sensors and stores their positions. It then generates targets inside that range with a 5 mm margin, monitoring move completion, axis errors and end-position conditions before advancing.

STRUCTURED TEXT

Commanding an absolute position through PLCopen Motion

fb_MoveAbs(
    Axis     := Axis_1,
    Execute  := bMoveAbsExec AND bAutoActive,
    Position := fRandomPos,
    Velocity := fVelocityFast
);
...
IF fb_MoveAbs.Error
OR Axis_1.Status.Error
OR bLimitLeftHit
OR bLimitRightHit
OR fb_MoveAbs.Done THEN
Absolute-position command used by the automatic motion sequence. The ellipsis marks omitted source between the command and its completion handling.

IMPLEMENTATION

Control functions kept explicit and testable

  • Manual positive and negative jogging
  • Automatic reference search and absolute positioning
  • MC_Power, MC_Reset, MC_Jog and MC_MoveAbsolute
  • End-position sensing with slow/fast override selection
  • Reset, status, axis-error and operator-indicator handling

RESULT

From end-sensor search to repeated positioning

On the laboratory axis, the application links travel-limit discovery to repeated absolute-position moves. The HMI displays actual and target positions, detected limits and axis status during the test workflow.

NEXT PROJECT · 02

Festo Digital Twin