Share this

Leadshine Online Gear Module: Making motion control simpler and more efficient!

2026-04-06 02:58:45 · · #1

01. Definition of Online Gear Shifting

Implementing point-to-point motion control and speed control for a single axis in Leadsys software is quite simple. It can be easily achieved by calling the point-to-point control and speed control function blocks in the single-axis motion instructions. These motion speeds are often fixed when the function block is triggered, and subsequent motion is performed at this speed, which is difficult for the user to change during the motion process. Changing the motion speed during point-to-point motion control and speed control constitutes online speed regulation of the motion.

To achieve online speed control, we provide two commonly used methods. This issue will introduce the application of the online speed control function block provided by Leadshine. In the previous issue, we shared how to use the single-axis motion instructions and BufferMode function of the SM3_Basic library to implement speed control (click the blue text to jump).

02. Online speed change command

Leadshine provides practical online shifting function blocks located in the CmpLSAxisControl and PMC_SingleAxisLib libraries, as listed below:

CmpLSAxisControl library:

PMC_SingleAxisLib library:

These instructions all achieve online speed adjustment by directly changing the input speed of the function block.

Command Introduction

MC_MoveAbsolute_ChangeVel

Command format:

MC_MoveAbsolute_ChangeVel( Axis:= axis, Execute:= start of motion, Position:= end position, Velocity:= velocity, Acceleration:= acceleration, Deceleration:= deceleration, Jerk:= jerk, Direction:= direction, Done=> motion completed, Busy=> function block in progress, Active=> in motion, CommandAborted=> motion interrupted, Error=> error, ErrorID=> error code);

Instruction description:

● Absolute point motion online speed change function block, used for scenarios where real-time speed changes are required during absolute positioning motion;

●During motion, modifying the input values ​​of the Velocity / Acceleration / Deceleration / Jerk pins will change the speed / acceleration / deceleration / jerk accordingly;

● The Velocity / Acceleration / Deceleration input pins must be greater than 0; otherwise, the function block will report an error.

●The target endpoint is determined at the rising edge of Execute; changes made during the execution process will not take effect.

● During the motion, if the rising edge of Execute is triggered again, the new motion will interrupt the old motion, and the axis will move to the new target endpoint;

● When the speed ramp type of the shaft is set to quadratic or quadratic (smooth), the jerk Jerk needs to be set, and the jerk Jerk must be greater than 0;

● When the axis type is set to modular, the direction needs to be set;

●The movement direction is determined at the rising edge of Execute and changes during movement will not take effect.

Timing diagram:

MC_MoveRelative_ChangeVel

Command format:

MC_MoveRelative_ChangeVel( Axis:= axis, Execute:= start of motion, Distance:= distance moved, Velocity:= velocity, Acceleration:= acceleration, Deceleration:= deceleration, Jerk:= jerk, Done=> motion completed, Busy=> function block in progress, Active=> in motion, CommandAborted=> motion interrupted, Error=> error, ErrorID=> error code);

Instruction description:

● The relative point motion online speed change function block is used in scenarios where real-time speed changes are required during relative positioning motion;

●During motion, modifying the input values ​​of the Velocity / Acceleration / Deceleration / Jerk pins will change the speed / acceleration / deceleration / jerk accordingly;

● The Velocity / Acceleration / Deceleration input pins must be greater than 0; otherwise, the function block will report an error.

● The target endpoint of the motion is determined at the rising edge of Execute. Modifying the Distance input pin during the motion will not change the target endpoint.

● During the motion, if the rising edge of Execute is triggered again, the new motion will interrupt the old motion, and the axis will move to the new target endpoint;

● When the speed ramp type of the shaft is set to quadratic or quadratic (smooth), the jerk Jerk needs to be set, and the jerk Jerk must be greater than 0.

Timing diagram:

MC_MoveVelocity_ChangeVel

Command format:

MC_MoveVelocity_ChangeVel( Axis:= axis, Execute:= start of motion, Velocity:= velocity, Acceleration:= acceleration, Deceleration:= deceleration, Jerk:= jerk, Direction:= direction, InVelocity=> velocity reached, Busy=> function block in progress, Active=> in motion, CommandAborted=> motion interrupted, Error=> error, ErrorID=> error code);

Instruction description:

● The constant speed motion online speed change function block is used in scenarios where real-time speed changes are required during constant speed motion;

●Once constant speed motion begins, the shaft will continue to move at the set speed. The motion can be stopped using the MC_Stop or MC_Halt command.

●During motion, modifying the input values ​​of the Velocity / Acceleration / Deceleration / Jerk / Direction pins will change the speed / acceleration / deceleration / jerk / direction of the motion accordingly;

● The Velocity / Acceleration / Deceleration input pins must be greater than 0; otherwise, the function block will report an error.

● The direction of motion is determined by the Direction pin, not by the plus or minus sign before the Velocity parameter. The available direction options differ between the linear and modular axes.

● When the speed ramp type of the shaft is set to quadratic or quadratic (smooth), the jerk Jerk needs to be set, and the jerk Jerk must be greater than 0.

Timing diagram:

MC_JOG_ChangeVel

Command format:

MC_JOG_ChangeVel( Axis:= axis, JogForward:= positive Jog, JogBackward:= negative Jog, Velocity:= velocity, Acceleration:= acceleration, Deceleration:= deceleration, Jerk:= jerk, Busy=> function block in progress, CommandAborted=> motion interrupted, Error=> error, ErrorID=> error code);

Instruction description:

●JOG online speed change function block, used for scenarios where real-time speed changes are required during jogging motion;

●During motion, modifying the input values ​​of the Velocity / Acceleration / Deceleration / Jerk / Direction pins will change the speed / acceleration / deceleration / jerk / direction of the motion accordingly;

● The Velocity / Acceleration / Deceleration input pins must be greater than 0; otherwise, the function block will report an error.

● When the speed ramp type of the shaft is set to quadratic or quadratic (smooth), the jerk Jerk needs to be set, and the jerk Jerk must be greater than 0.

Timing diagram:

LS_MoveAbsChangePosVel

Command format:

LS_MoveAbsChangePosVel(Axis:= axis, Execute:= start motion, Position:= target position, Velocity:= velocity, Acceleration:= acceleration, Deceleration:= deceleration, Jerk:= jerk, Done=> completed, Busy=> function block in progress, CommandAborted=> motion interrupted, Error=> error, ErrorID=> error ID);

Instruction description:

● Absolute point motion online speed change and repositioning function block, used for scenarios where real-time speed change and repositioning are required during absolute positioning motion;

●During motion, modifying the input values ​​of the Position / Velocity / Acceleration / Deceleration / Jerk pins will correspondingly change the position / velocity / acceleration / deceleration / jerk of the motion;

● The Velocity / Acceleration / Deceleration input pins must be greater than 0; otherwise, the function block will report an error.

● During the motion, if the rising edge of Execute is triggered again, the new motion will interrupt the old motion, and the axis will move to the new target endpoint;

● When the speed ramp type of the shaft is set to quadratic or quadratic (smooth), the jerk Jerk needs to be set, and the jerk Jerk must be greater than 0;

● The instruction does not support simulation. When the simulation runs, the function block reports error 16#0FFFFFFF.

● Differences from the MC_MoveAbsolute_ChangeVel instruction:

LS_MoveChangeVel

Command format:

LS_MoveChangeVel(Axis:= axis, Execute:= start motion, Velocity:= velocity, Acceleration:= acceleration, Deceleration:= deceleration, Jerk:= jerk, Direction:= direction, InVelocity=> velocity reached, Busy=> function block in progress, CommandAborted=> motion interrupted, Error=> error, ErrorID=> error ID);

Instruction description:

● The constant speed motion online speed change function block is used in scenarios where real-time speed changes are required during constant speed motion;

●Once constant speed motion begins, the shaft will continue to move at the set speed. The motion can be stopped using the MC_Stop or MC_Halt command.

●During motion, modifying the input values ​​of the Velocity / Acceleration / Deceleration / Jerk / Direction pins will change the speed / acceleration / deceleration / jerk / direction of the motion accordingly;

● The Velocity / Acceleration / Deceleration input pins must be greater than 0; otherwise, the function block will report an error.

● The direction of motion is determined by the Direction pin, not by the plus or minus sign before the Velocity parameter. Direction = 1 for positive motion and -1 for negative motion.

● When the speed ramp type of the shaft is set to quadratic or quadratic (smooth), the jerk Jerk needs to be set, and the jerk Jerk must be greater than 0;

● The instruction does not support simulation; the function block will report error 16#0FFFFFFF during simulation. Other functions are the same as MC_MoveVelocity_ChangeVel.

03. Programming Methods

Through the above introduction, we have learned the basic usage of the online speed change function block. The following three programming examples will show how to use the online speed change instruction.

Example 1

The control axis moves at a speed of 20 to position 100, and then accelerates to 30 to position 200.

program:

① Add the MC_Power axis enable function block to enable the axis.

② Add the MC_MoveAbsolute_ChangeVel function block and add variables to control the function block's startup, movement position, and movement speed.

③ Write the control program. When the variable MoveStart=TRUE, the axis starts moving at a speed of 10 to 100; after the axis moves to position 100, the speed of the axis increases to 20; the axis moves to position 200 and the movement ends.

result:

Example 2

The control axis starts moving at a speed of 10 to position 100. During the movement, it receives the in1 input signal and increases the speed to 20.

program:

① Add the MC_Power axis enable function block to enable the axis.

② Add the MC_MoveAbsolute_ChangeVel function block and add variables to control the function block's startup, movement position, and movement speed.

③ Write the control program. When the input signal in0 is triggered, the axis starts to move at a speed of 10 to the position 100; if the input signal in1 is triggered during the movement, the speed of the axis increases to 20; when the axis reaches the position 100, the movement is completed.

result:

Example 3

The JOG motion of the axis is controlled by a touchscreen, and the speed of the axis can be changed at will.

Touchscreen application:

① Communication settings: Use the touchscreen's Modbus TCP communication, and configure as follows.

② Add components: one numerical input and two bit setting switches. The numerical input is used to set the speed of the JOG motion, and the two switches control the forward and reverse rotation of the axis, respectively.

PLC program:

① Enable Modbus TCP slave for communication with the touchscreen.

② Add the MC_Power axis enable function block to enable the axis.

③ Add the MC_JOG_ChangeVel function block, add variables to control the forward motion, reverse motion and motion speed of the axis, and bind them to the communication address corresponding to the touch screen.

result:

04. Summary

Through the above introduction, we have learned about two ways to implement online speed change. It is not difficult to find that there are many differences between the two methods in terms of programming and the effect achieved.

In terms of motion control coverage, BufferMode supports online speed changes for absolute position, relative position, and constant speed motion, while the instructions also support online speed changes for JOG.

In terms of programming, BufferMode often requires defining multiple motion function blocks to implement online speed change, while online speed change instructions only require a single instruction to implement speed change during motion, and the implementation code of online speed change instructions is much simpler than that of BufferMode.

In terms of motion effects, BufferMode can change speed at more precise positions, while commands require the program to determine when the specified axis position is reached before changing speed, making BufferMode less precise in terms of speed change point accuracy.

In terms of debugging flexibility, the online speed change command's ability to modify the speed at any time brings many conveniences to debugging and can significantly reduce the amount of code.

Regardless of the implementation method, the appropriate method is the one that suits the usage scenario. Users should choose the appropriate implementation method based on their actual usage needs.

END

Read next

Precautions for the installation and maintenance of programmable logic controllers

Programmable Logic Controllers (PLCs) are a new type of general-purpose automation control device that integrates tradit...

Articles 2026-02-22
CATDOLL 108CM Cici

CATDOLL 108CM Cici

Articles
2026-02-22
CATDOLL Oksana Hard Silicone Head

CATDOLL Oksana Hard Silicone Head

Articles
2026-02-22