Troubleshooting
Why a handwheel-fed jog makes a TC2_MC2 servo axis choppy
Short answer
A handwheel on an EL5101 makes a TC2_MC2 servo axis choppy when the wheel's integer count is turned into discrete motion commands: streamed MC_MoveRelative moves each carry their own acceleration and deceleration even with the buffer mode set to blending next, and a speed fed to MC_Jog alternates between zero and one count per PLC cycle. Gear the servo to the wheel, cam it for bounded travel, or switch to external setpoint generation.

On this page
- Where the wheel-to-drive path loses its smoothness
- Check the wheel count before changing the command path
- First fix: gear the servo to the wheel with MC_GearIn
- Second fix: bound the travel with a cam table
- Third fix: generate the setpoint in the PLC every cycle
- Which method fits your wheel
- Questions asked
The choppiness is created at one hop: where the handwheel's integer count becomes a discrete motion command. Single moves and plain jogging run smoothly on the same axis, so the drive, the EL5101 encoder terminal and the network are not at fault. Streaming MC_MoveAbsolute or MC_MoveRelative fails because every call carries its own acceleration and deceleration phases, even with the buffer mode set to blending next; feeding a computed speed to MC_Jog fails because the count delta is an integer that alternates between zero and one at slow hand speed. The fix is to change how the wheel enters the motion system: gear the servo to the wheel, map it through a cam table, or switch the axis to external setpoint generation and write a new target every PLC cycle. The examples use the TC2_MC2 library on TwinCAT 3.1 Build 4024.53.
Where the wheel-to-drive path loses its smoothness #
The signal runs through six hops:
- Handwheel pulses into the EL5101's counter
- The integer counter value in the EtherCAT process image
- The PLC motion task, which reads the count once per task cycle
- The TC2_MC2 command or set value the task issues
- The NC setpoint generator, which turns it into a cyclic position setpoint
- The servo drive with integrated control, which follows that setpoint
The first three hops deliver an exact integer count, and nothing is lost there. Smoothness dies at the fourth hop, where the count becomes a command. The two command styles already tried fail for different reasons.
Streamed moves carry one motion profile per command #
MC_MoveAbsolute and MC_MoveRelative are point-to-point commands. Every call builds a complete profile — accelerate, traverse, decelerate — and the buffer mode only decides how that profile hands over to the previous one. With the buffer mode set to blending next, the next move blends into the running one instead of waiting for it to finish, but the new profile still accelerates into its traverse and decelerates toward the blend point. Commanding a new move on every wheel count change therefore produces velocity ripple at the command rate, however small each move is. The seams between profiles were tuned; the profiles themselves are the ripple.
A speed fed to MC_Jog turns count quantization into acceleration steps #
MC_Jog takes a velocity demand and ramps the axis toward it with its own acceleration. When the demand is a count delta divided by the task interval, the demand is quantized, because a count delta is an integer.
Worked example: a wheel that emits 1024 counts per revolution (an example figure — take the real value from the wheel encoder's datasheet), turned steadily at half a revolution per second, on a motion task of 1 ms.
- Counts per second: 1024 counts/rev × 0.5 rev/s = 512 counts/s
- Counts per task cycle: 512 counts/s / 1000 cycles/s = 0.512 counts per cycle
The delta alternates between 0 and 1. Divided by the 1 ms interval, the demand alternates between 0 and 1000 counts per second, in the axis's own position units. MC_Jog ramps to each new demand with its configured acceleration, so the axis rides a train of acceleration steps instead of holding a speed. Slower hand movement makes it worse: the delta sits at zero for more cycles between single-count steps.
Confirming check: record the axis set velocity and the raw count delta side by side in the engineering environment's trend tool, sampled at the motion task interval. If the velocity dips toward zero exactly on the cycles where the delta is zero, the diagnosis holds, and no drive-side tuning will remove a ripple the command path creates.
Check the wheel count before changing the command path #
Both fixes below feed the count forward as a position, so the count has to be trustworthy first.
- Map the EL5101 counter value from the process image into a PLC variable of an unsigned type with the same width as the counter; the width is in the terminal's process data layout.
- Subtract at fixed width for the per-cycle delta:
counter : UDINT; // wheel count from the process image (example: 32 bit width)
lastCounter : UDINT := 0; // count of the previous task cycle
delta : UDINT; // wheel counts advanced since the previous cycle
delta := counter - lastCounter; // wraps cleanly at rollover
lastCounter := counter;
Because the subtraction wraps at the counter's width, a rollover from the maximum back to zero yields a small positive delta. Widening both values to a larger type before subtracting destroys that property and turns the rollover into a huge jump.
- Sample in the same task that runs the motion code, and update lastCounter at the end of that task, not in a second task.
- Disable the servo and turn the wheel slowly, then quickly, while trending the counter and the delta.
- Pass when the count advances cleanly in one direction, reverses without jumps, and rolls over without a position step. Slow turning will show deltas of 0 and 1: the quantization that broke the MC_Jog approach, and the reason the fixes below feed a position instead of a speed.
If the wheel reaches the controller through plain high-speed PLC inputs instead of an encoder terminal, the same counting rules apply, as set out in reading a handwheel MPG on a PLC without a motion controller.
First fix: gear the servo to the wheel with MC_GearIn #
When the servo should simply follow the wheel, make the wheel an NC master axis and gear the servo to it. The NC then generates setpoints continuously from the master position, so there is no per-command profile to ripple.
- Create an NC axis for the wheel and connect its encoder to the EL5101 process data. Scale it so the wheel reads in convenient units; for example, scale 1024 counts per revolution to 360 degrees, which is 360 / 1024 = 0.3515625 degrees per count (example scaling).
- Turn the wheel with the servo disabled and read the wheel axis actual position: it must track the wheel with no missed counts.
- Couple the servo axis to the wheel axis with MC_GearIn, which takes the ratio as a numerator and denominator. With the scaling above, a 1:1 ratio moves the servo one degree per wheel degree; a numerator of 2 doubles the travel.
- Enable the servo and turn the wheel at a steady slow speed.
Pass when the servo set velocity is continuous while the wheel turns at a steady rate, with no drop toward zero on each single count. If the follower side is unfamiliar, an electronic gearing slave follows the same master-to-slave rules as a stepper traverse following a master axis.
Second fix: bound the travel with a cam table #
When the servo must stay inside a bounded stroke or respect soft limits, replace the fixed ratio with a cam table: the wheel axis stays the master, and the table maps wheel position to servo position. The setpoints stay continuous as with gearing, and spinning the wheel past the table ends holds the last mapped position instead of commanding overtravel. The remaining decision is which master input the cam follows; an encoder-driven axis such as the wheel is one standard choice, and what decides the master input for an electronic cam axis works through that choice.
Third fix: generate the setpoint in the PLC every cycle #
External setpoint generation is the NC mode built for this case: the axis adopts set values produced by the PLC, and it is the only mode that accepts a new target position on every PLC cycle while the NC keeps velocity, acceleration and jerk limitation, limit switches and the brake signal active. Writing a target straight into the drive's process data offers none of that protection.
- Switch the axis's setpoint source to external setpoint generation in the NC axis configuration.
- Switch the generator on with MC_ExtSetPointGenEnable and wait for its confirmation before feeding values.
- Each task cycle, compute one target from the wheel count and feed it:
startPos : LREAL := 0.0; // target at enable, degrees (example)
startCounter : UDINT := 0; // wheel count captured when the generator was enabled
scale : LREAL := 0.3515625; // degrees per count (example scaling)
target : LREAL; // degrees, one value per task cycle
target := startPos + UDINT_TO_LREAL(counter - startCounter) * scale;
MC_ExtSetPointGenFeed copies the value into the axis's cyclic interface; it is a plain function rather than a function block, so it has no busy or done outputs and belongs directly in the task body. Prove the arithmetic before enabling the servo: force counter to two counts above startCounter and check that target comes out at 2 × 0.3515625 = 0.703125 degrees. If slow-turn quantization still shows in the trend, average the target over a window of N cycles, which delays it by about (N - 1) / 2 cycles; with N = 10 on a 1 ms task that is 4.5 ms, close enough to 5 ms to plan around. When you weigh function against function block for your own axis library code, two tests that decide between a function and a function block is a short guide.
- Switch the generator off with MC_ExtSetPointGenDisable before issuing ordinary commands again; the axis then stops adopting external set values, and MC_Jog, MC_MoveAbsolute and the rest behave normally on that axis.
Which method fits your wheel #
| What the wheel must do | Method | What the axis gets |
|---|---|---|
| Mirror the wheel, no end of travel | MC_GearIn, wheel as master | Continuous setpoints, no per-command profile |
| Mirror the wheel inside a bounded stroke | Cam table, wheel as master | Continuous setpoints, travel clamped by the table |
| PLC computes, filters or switches the target | External setpoint generation | New target each cycle, NC limits and brake still active |
Decision: gear when the servo should follow the wheel directly, cam when the travel must stay bounded, generate the setpoint in the PLC when the target needs computing. Final acceptance for any of the three: record the wheel counter, the axis set position and the axis set velocity in one trend at the motion task interval. Pass when a steady slow hand speed gives a continuous set velocity with no periodic dips, reversal is clean, and releasing the wheel stops the axis without creep. None of the three fixes touches the drive, because the drive was never at fault.
Questions asked
Does MC_PositionCorrectionLimiter make the axis follow the handwheel?
No. That function block rewrites the axis's current position from a measured encoder position on the fly, like homing on the fly; it commands no motion, so the wheel never moves the axis through it. Its settings only control how the old and new positions are blended. For wheel-driven motion use gearing, a cam table or external setpoint generation.
Why does the axis fall behind when the handwheel is spun fast?
A gearing or cam slave still obeys its configured maximum velocity and acceleration. Spinning the wheel past those limits makes the slave clamp to them and lag the master until the wheel slows. Lower the gear ratio, or raise the axis dynamics only as far as the drive and mechanics are rated for; do not remove the limits.
Can the wheel counter be reset on each encoder zero pulse?
Only on terminals that support it. The EL5112 documentation describes such a reset: on every full encoder revolution the counter loads the value configured at index 0x80n1:1B (Reset counter value) via the zero pulse C. Check the handwheel terminal's own documentation for its equivalent. For a jog wheel it is usually unnecessary, because the fixed-width unsigned subtraction already wraps the count cleanly.


