CODESYS Β· Track 08 Β· motion in software

Motion on a standard controller

SoftMotion runs the motion stack inside the standard CODESYS runtime. The PLCopen MC_ blocks run on a normal controller and command servo drives over the fieldbus, usually EtherCAT, without a dedicated motion CPU. Create a SoftMotion axis, enable it with MC_Power, and command it with MC_MoveAbsolute. Enable the axis before sending a move command.

⚑ MC_Power🎯 MC_MoveAbsolutePLCopen
01 Β· The axis

Enable, then command

A SoftMotion axis on a 400 mm rail lets you try the enable and move sequence. The MC_ blocks stay greyed out until you call MC_Power. Enable the axis, set a target, then call MC_MoveAbsolute. The velocity plot shows the trapezoid SoftMotion generates from your velocity & acceleration limits. This rail has an incremental encoder, so MC_MoveAbsolute needs a homed axis (MC_Home) first. An axis with an absolute encoder knows its position at power-up and can skip homing. An absolute move uses a fixed position in the coordinate system; a relative move uses a distance from the current position. The home reference gives the absolute position its meaning. Follow the sequence shown here: enable the axis, establish that reference, then send the move command. Watch the position and velocity readouts as the carriage travels toward its target.

target
πŸ”©
0
200
400 mm

Velocity (mm/s): the SoftMotion profile

Axis (AXIS_REF_SM3)

StateDisabled
fActPosition0.0 mm
fActVelocity0.0 mm/s
MC_Power.StatusFALSE
🎯 to mm

SoftMotion runs in software and scales from a single axis to coordinated multi-axis motion, CAM profiles and CNC (G-code), on a standard CODESYS target with an EtherCAT drive. Its MC_ block names follow the PLCopen standard, using motion concepts similar to those in the Siemens and Rockwell examples. The axis state, actual position and actual velocity remain visible beside the rail during the move.

02 Β· Check yourself

Why won't it move?

The axis is enabled, the drive is healthy and this rail has an incremental encoder. You call MC_MoveAbsolute but the axis stays put and the block sets an error. What did you skip?