3.6.07 MC_GearIn

Last modified by xingzhi lin on 2025/12/26 17:25

Set the gear ratio between the slave axis and the main axis,  perform the electronic gear operation.

Instruction format

InstructionMC_GearIn (FB)
NameDisconnect gear function block
Graphical performanceST performance

1764850028893-308.png

MC_GearIn(

Master: =,

Slave: =,

Execute: =,

RatioNumerator: =,

RatioDenominator: =,

Acceleration: =,

Deceleration: =,

Jerk: =,

BufferMode: =,

InGear=>,

Busy=>,

Active=>,

CommandAborted=>,

Error=>,

ErrorID=>);

Related variables

Input and output variablesNameData typeEffective rangeInitial valueDescription
MasterMaster axisAXIS_REF_SM3--Mapped to an axis, i.e. an instance of AXIS_REF_SM3
SlaveSlave axisAXIS_REF_SM3--Mapped to an axis, i.e. an instance of AXIS_REF_SM3
Input variablesNameData typeEffective rangeInitial valueDescription
ExecuteExecutionBOOL[FALSE, TRUE]FALSERising edge signal execution instruction
RatioNumeratorGear ratio moleculeDINT 1Gear ratio molecule
RatioDenominatorGear ratio denominatorUDINT 1Gear ratio denominator
AccelerationAccelerationLREAL -Specified acceleration
DecelerationDecelerationLREAL -Specified deceleration
JerkJerkLREAL -Jerk
BufferModeCache mode selectionMC_BUFFIR_MODE0 to 50

Specify the action when multiple instances start a motion instruction

0: Abort

1: Wait

2: Blend at low speed

3: Blend at previous speed

4: Blend at the next speed

5: Blend at high speed

Output variablesNameData typeEffective rangeInitial valueDescription
InGearGear ratio reachedBOOL[FALSE, TRUE]FALSETRUE, target velocity is reached from axis
BusyExecution flagBOOL[FALSE, TRUE]FALSETRUE, the instruction is being executed
ActiveControlBOOL[FALSE, TRUE]FALSETRUE when controlling
CommandAbortedAbortBOOL[FALSE, TRUE]FALSETRUE, interrupted by other control instructions
ErrorErrorBOOL[FALSE, TRUE]FALSEWhen an error occurs, set to TRUE
ErrorIDError IDSMC_ERRORRefer to SMC_ERROR0When an error occurs, the error ID is output.

Function description

  1. Specify an action target axis by Slave .Specifying RatioNumerator, RatioDenominator, Acceleration, and Deceleration, and performing gear operation;
  2. The instruction position, the feedback position, and the latest instruction position can be specified for the Master (master axis);
  3. Execute rising edge starts electronic gear action;
  4. After starting the operation, the Slave axis takes the speed obtained by multiplying the Master axis speed by the gear ratio as the target speed, and performs acceleration and deceleration operation;
  5. To uncouple the electronic gear after executing GearOut instruction must be passed;
  6. This instruction is a speed electronic gear function, and the loss of synchronization distance caused during acceleration will not be automatically compensated;
  7. When Busy signal is TRUE during instruction execution, if the target speed of the slave axis does not reach the new rising edge of Execute will not affect it;
  8. When the Busy signal is TRUE during instruction execution, if the target speed of the slave axis reaches this time, the new rising edge of Execute will not affect it;
  9. The target velocity is reached, InGear is TRUE, after which Slave axis movement=master axis movement*RatioNumerator/RatioDenominator;
  10. If the master axis speed changes in real time, carefully use this instruction.

Precautions

Please do not use the MC_SetPosition instruction during the execution of the instruction to avoid accidents caused by rapid operation of the motor;

When you want to use MC_SetPosition insturction for Master, disengage the relationship between the spindle and the slave axes and execute the instruction.

Sequence diagram

Busy becomes TRUE at the same time as Execute is started. Active becomes TRUE in the next cycle. When the target speed is reached, InGear (gear ratio reached) becomes TRUE.

When this instruction is aborted with another instruction, CommandAborted becomes TRUE and Busy, Active, InGear becomes FALSE.

To end the electronic gear action halfway, use MC_GearOut or MC_Stop instruction.

1764850202802-991.png

(1) This instruction starts in other instruction execution

Start this instruction for the currently executing instruction, which can be switched or cached to this instruction.

The action at launch of multiple instances of this instruction is specified by BufferMode.

Buffer mode selectionDescription
Aborting

Immediately abort the currently executing instruction and switch to this instruction.

When the operation direction of the axis is reversed due to the instruction switching, the operation direction of the axis is reversed according to "operation at the time of reverse" in the axis parameter.

BufferedThe function block is started immediately after the last instruction motion is terminated. No blending is done here. When the end condition (Done, InVelocity, InEndVelocity, InGear, InSync, EndOfProfile, etc.) is reached, the new motion starts at the speed of the previous motion. If the previous motion was MC_MoveAbsolute or MC_MoveRelative, the new motion starts at still.

(2) Other instructions in execution of this instruction are enabled

Multiple instances of execution of instructions in an interrupted manner from the slave axis can be initiated.

At this time, the gear operation is stopped, and the operation started by a plurality of instances is started.

The instruction cannot be launched in multiple instances without interrupting.