Wiki source code of 3.6.07 MC_GearIn

Version 3.1 by xingzhi lin on 2025/12/04 20:11

Show last authors
1 Set the gear ratio between the slave axis and the main axis, perform the electronic gear operation.
2
3
4 == **Instruction format** ==
5
6 |**Instruction**|(% colspan="2" %)MC_GearIn (FB)
7 |**Name**|(% colspan="2" %)Disconnect gear function block
8 |(% colspan="2" %)**Graphical performance**|**ST performance**
9 |(% colspan="2" %)(((
10 (% style="text-align:center" %)
11 [[image:1764850028893-308.png]]
12 )))|(((
13 MC_GearIn(
14
15 Master: =,
16
17 Slave: =,
18
19 Execute: =,
20
21 RatioNumerator: =,
22
23 RatioDenominator: =,
24
25 Acceleration: =,
26
27 Deceleration: =,
28
29 Jerk: =,
30
31 BufferMode: =,
32
33 InGear=>,
34
35 Busy=>,
36
37 Active=>,
38
39 CommandAborted=>,
40
41 Error=>,
42
43 ErrorID=>);
44 )))
45
46
47
48 == **Related variables** ==
49
50 |**Input and output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
51 |Master|Master axis|AXIS_REF_SM3|-|-|Mapped to an axis, i.e. an instance of AXIS_REF_SM3
52 |Slave|Slave axis|AXIS_REF_SM3|-|-|Mapped to an axis, i.e. an instance of AXIS_REF_SM3
53
54
55
56 |**Input variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
57 |Execute|Execution|BOOL|[FALSE, TRUE]|FALSE|Rising edge signal execution instruction
58 |RatioNumerator|Gear ratio molecule|DINT| |1|Gear ratio molecule
59 |RatioDenominator|Gear ratio denominator|UDINT| |1|Gear ratio denominator
60 |Acceleration|Acceleration|LREAL| |-|Specified acceleration
61 |Deceleration|Deceleration|LREAL| |-|Specified deceleration
62 |Jerk|Jerk|LREAL| |-|Jerk
63 |BufferMode|Cache mode selection|MC_BUFFIR_MODE|0 to 5|0|(((
64 Specify the action when multiple instances start a motion instruction
65
66 0: Abort
67
68 1: Wait
69
70 2: Blend at low speed
71
72 3: Blend at previous speed
73
74 4: Blend at the next speed
75
76 5: Blend at high speed
77 )))
78
79
80
81 |**Output variables**|**Name**|**Data type**|**Effective range**|**Initial value**|**Description**
82 |InGear|Gear ratio reached|BOOL|[FALSE, TRUE]|FALSE|TRUE, target velocity is reached from axis
83 |Busy|Execution flag|BOOL|[FALSE, TRUE]|FALSE|TRUE, the instruction is being executed
84 |Active|Control|BOOL|[FALSE, TRUE]|FALSE|TRUE when controlling
85 |CommandAborted|Abort|BOOL|[FALSE, TRUE]|FALSE|TRUE, interrupted by other control instructions
86 |Error|Error|BOOL|[FALSE, TRUE]|FALSE|When an error occurs, set to TRUE
87 |ErrorID|Error ID|SMC_ERROR|Refer to SMC_ERROR|0|When an error occurs, the error ID is output.
88
89
90
91 == **Function description** ==
92
93 1. Specify an action target axis by Slave .Specifying RatioNumerator, RatioDenominator, Acceleration, and Deceleration, and performing gear operation;
94 1. The instruction position, the feedback position, and the latest instruction position can be specified for the Master (master axis);
95 1. Execute rising edge starts electronic gear action;
96 1. 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;
97 1. To uncouple the electronic gear after executing GearOut instruction must be passed;
98 1. This instruction is a speed electronic gear function, and the loss of synchronization distance caused during acceleration will not be automatically compensated;
99 1. 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;
100 1. 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;
101 1. The target velocity is reached, InGear is TRUE, after which Slave axis movement=master axis movement*RatioNumerator/RatioDenominator;
102 1. If the master axis speed changes in real time, carefully use this instruction.
103
104
105
106 == **Precautions** ==
107
108 Please do not use the MC_SetPosition instruction during the execution of the instruction to avoid accidents caused by rapid operation of the motor;
109
110 When you want to use MC_SetPosition insturction for Master, disengage the relationship between the spindle and the slave axes and execute the instruction.
111
112
113 == **Sequence diagram** ==
114
115 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.
116
117 When this instruction is aborted with another instruction, CommandAborted becomes TRUE and Busy, Active, InGear becomes FALSE.
118
119 To end the electronic gear action halfway, use MC_GearOut or MC_Stop instruction.
120
121 (% style="text-align:center" %)
122 [[image:1764850202802-991.png]]
123
124 (1) This instruction starts in other instruction execution
125
126 Start this instruction for the currently executing instruction, which can be switched or cached to this instruction.
127
128 The action at launch of multiple instances of this instruction is specified by BufferMode.
129
130 |**Buffer mode selection**|**Description**
131 |Aborting|(((
132 Immediately abort the currently executing instruction and switch to this instruction.
133
134 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.
135 )))
136 |Buffered|The 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.
137
138
139
140 (2) Other instructions in execution of this instruction are enabled
141
142 Multiple instances of execution of instructions in an interrupted manner from the slave axis can be initiated.
143
144 At this time, the gear operation is stopped, and the operation started by a plurality of instances is started.
145
146 The instruction cannot be launched in multiple instances without interrupting.
147
148
149
150
151
152