Wiki source code of 12 Handy instructions

Last modified by Wecon on 2025/09/03 21:03

Hide last authors
Wecon 1.1 1 = **6.12.1 IST instruction** =
2
3 **Instruction description**
4
5 (% class="table-bordered" %)
6 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
7 |IST|Status initialization|16|No|IST S D,,1,, D,,2,,|7
8
9 This instruction could be used to initialize the control status of a typical multi-action looping execution mechanism and to specify parameters for the operation mode such as the input signal, action status, etc.
10
11 * S is the is the component address of the starting bit variable of the input of the specified operation mode. It occupies 8 continuous address units from S to S+7. The special function definition for each variable is described below:
12 * D,,1,, is the minimum serial number using the S status in the specified automatic operation mode.
13 * D,,2,, is the maximum serial number using the S status in the specified automatic operation mode. D,,1,, to D,,2,, are the status serial numbers of the looping action of the control system, which determine the status numbers.
14
15 (% class="table-bordered" %)
16 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
17 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
18 |S|√|√|√| | | | | | | | | | | | |
19 |D,,1,,| | | |√| | | | | | | | | | | |
20 |D,,2,,| | | |√| | | | | | | | | | | |
21 |(% colspan="17" %)(((
22 **✎Note: **
23
24 1) The instruction is allowed to be used only once in the user program.
25
26 2) For D1 and D2, only S20~~S899 is available, and D1<D2.
27
28 3) The special M variable of the system will also be used when using this instruction.
29 )))
30
31 For example, in the illustrated system below, the execution mechanism acts sequentially in such a way: the grabbing device drops to the position of work piece A from the base point to grab the work piece, and then it lifts the work piece to the specified height and translates to the desired position and drops. After arriving at the required position, it releases the work piece and back tracks to start the next looping action. It is possible to use the IST instruction to specify the control signal input, the control of the status transferring, etc. of the operational mechanism to achieve automatic control. In addition, it supports manual commissioning of single-step actions and zero point reset, etc.
32
33 (% style="text-align:center" %)
34 [[image:7-11 Handy instructions_html_c31cb4984cc21f5a.jpg||class="img-thumbnail" height="241" width="700"]]
35
36 Instruction keys and status changing switches are required to control the operational mechanism using manual commissioning, single actions, and looping actions, etc. The following is a schematic diagram of the operation panel, including the key ports and their function assignments:
37
38 (% style="text-align:center" %)
39 [[image:7-11 Handy instructions_html_2137c528d7916f94.jpg||class="img-thumbnail" height="380" width="600"]]
40
41 For applications like the above diagram, each complete cycle could be divided into 8 steps (i.e. 8 statuses). The following instruction clauses could be used to initialize the status of the control system:
42
43 (% style="text-align:center" %)
44 [[image:7-11 Handy instructions_html_a87a48c975eaff8b.jpg||class="img-thumbnail" height="72" width="400"]]
45
46 S specifies X20 as the starting input of the operation mode. Therefore, the input ports X21 to X27 of the subsequent addresses will also be used. The functional action features will be defined respectively as: (it is similar for variables X, M, or Y)
47
48 * X20: This is the manual operation mode to switch on/off the various control output signals using a single button.
49 * X21: This is the base point reset mode to reset the device to the base point by pressing the base point reset button.
50 * X22: This is the single-step operation mode to step forward a process each time the starting button is pressed.
51 * X23: This is the one-cycle looping mode. When the start button is pressed, it will run the one-cycle looping automatically and stop at the base point. The operation could be stopped by pressing the stop button. Then, if the start button is pressed, the operation will continue and stop at the base point automatically.
52 * X24: This is the continuous operation mode to run continuously by pressing the start button. When the stop button is pressed, it will move to the base point and stop.
53 * X25: To start the base point rest command signal.
54 * X26: To start the automatic command signal.
55 * X27: To stop the automatic command signal.
56
57 **✎Note:** In these port signals, the operation mode is determined by X20 to X24, for which the statuses couldn’t be ON at the same time. Therefore, it is suggested to use rotary switches for the selection and switching of the signals.
58
59 D1 and D2 are used to specify the minimum and maximum serial number S20 to S27 of the service statuses (8 for total) in the automatic operation mode. The following special variables for the definition and use requirements of the IST instruction should be noted:
60
61 When driving the IST instruction, the control of the following components will be automatically switched and could be referenced by user programs. In order to make the status switching and control of the IST instruction cooperate, the operation of certain special variables is required in the user programs. See the description in the table below:
62
63 (% class="table-bordered" %)
64 |(% colspan="2" style="width:287px" %)**Default variables in IST instruction**|(% colspan="2" style="width:795px" %)**Variables driven in user program**
65 |M8040|(% style="width:227px" %)1= disable transfer of all states|(% style="width:67px" %)M8043|(% style="width:730px" %)1=original return completed. In the original return mode, after a machine returns to original, the special M variable will be set by the user program.
66 |M8041|(% style="width:227px" %)1= transfer start|(% style="width:67px" %)M8044|(% style="width:730px" %)1= original condition detect the original condition of a machine and drive the special assistant relay, it is set in all modes.
67 |M8042|(% style="width:227px" %)1= Start pulse|(% style="width:67px" %)M8045|(% style="width:730px" %)1= all output reset disabled. If a machine is switched among manual, return and automatic modes when it is not at original, all output and action states will be reset. But only action status could be reset if M8045 has been driven.
68 |S0|(% style="width:227px" %)Manual operation initial state|(% rowspan="3" style="width:67px" %)M8047|(% rowspan="3" style="width:730px" %)1= STL monitoring valid. After M8047 has been driven, the saved in the special assistant relay D8040~~D8047 in ascendant order, thus monitoring action state numbers of 8 points. In addition, if any of these states is enabled, the special assistant relay M8046 will act.
69 |S1|(% style="width:227px" %)Original return initial state
70 |S2|(% style="width:227px" %)Automatic operation initial state
71
72 Under the "automatic operation" mode, free conversion is possible between: single step<~-~->one-cycle looping<~-~->continuous operation.
73
74 When performing conversion between "manual operation"<~-~->"base point reset"<~-~->"automatic operation" while the machine is running, the switched mode is effective after all the outputs are reset. (Reset is not applicable for M8045 drive.)
75
76 S10 to S19 could be used for the base point reset when using the IST instruction. Therefore, don't use these statuses as common statuses. In addition; S0 to S9 are used for the initial status process, S0 to S2, as mentioned in the above manual operations, are used for the base point reset and automatic operation, and S3 to S9 could be used freely.
77
78 When programming, the IST instruction must be programmed with a higher priority than the various STL circuit, such as status S0 to S2, etc.
79
80 Rotary switches must be used to avoid the situation that X20 to X24 are ON at the same time.
81
82 When switching between each (X20), base point reset (X21), auto (X22, X23, X24) before the base point completion signal (M8043) is activated, all the outputs are switched OFF. And the automatic operation couldn’t drive again until the base point reset is finished.
83
84 After initialization of the control instruction using the IST instruction, the action of each status of the execution mechanism and the conditions for status transferring need to be programmed, as detailed below:
85
86 * System initialization: defines the conditions for base point reset and defines the input ports of the operation mode signals used in the IST instruction and the status variables of the looping actions. The program clauses used are illustrated in the following diagram.
87
88 (% style="text-align:center" %)
89 [[image:7-11 Handy instructions_html_84588d1812847b7e.jpg||class="img-thumbnail" height="127" width="600"]]
90
91 * Manual operation: driven to execute by the command signals defined on the operation plate. See the program clauses of status S0 in the following diagram. This part of the program could be skipped if there is no manual mode:
92
93 (% style="text-align:center" %)
94 [[image:7-11 Handy instructions_html_7ba233421fa8c3ac.jpg||class="img-thumbnail" height="293" width="700"]]
95
96 * Base point reset: design reset program based on the command signal at the starting of the reset and the sequence of the reset actions, as shown in the upper right:
97 * Automatic operation: write program based on the required action conditions and sequence and the control signal output, as shown in the diagram below:
98
99 (% style="text-align:center" %)
100 [[image:7-11 Handy instructions_html_4586b0de8e0bb44.jpg||class="img-thumbnail" height="373" width="500"]]
101
102 Up to this point, the control system is allowed to complete the looping action according to the above mentioned action requirements. The above programming description uses step instructions for the convenience of reading, while the user is free to program using the equivalent ladder diagrams.
103
104 When different status numbers occur to the "automatic operation" mode in a control system, the above example could be referenced to program in modifying the setting items of D1 and D2 corresponding works need to be done in the "automatic operation" mode.
105
106 Handling methods for non-continuous X input:
107
108 If an X input port with non-continuous addresses needs to be used as the provided input of the operation mode, the M variable could be used for a "transitional" transmission. That is, the non-continuous X input status will be copied to an M variable with continuous addresses one by one using the simple OUT instruction rather than the instructions below:
109
110 (% style="text-align:center" %)
111 [[image:7-11 Handy instructions_html_4c28ce75dbb4f2a6.jpg||class="img-thumbnail" height="70" width="400"]]
112
113 Specific to the continuous M0 to M7 variable area in the IST, the programming instructions could be used to shield the non-existent control mode. For example, the corresponding relationship between X as the mode input end and the M variable in the following diagram. For un-required modes, you simply input the M variable and fix it to zero:
114
115 * When X input port is not continuous, then use continuous M register.
116
117 (% style="text-align:center" %)
118 [[image:7-11 Handy instructions_html_dbdc8a18700764be.jpg||class="img-thumbnail" height="481" width="400"]]
119
120 * Without manual mode
121
122 (% style="text-align:center" %)
123 [[image:7-11 Handy instructions_html_f0230ace8d333f9b.jpg||class="img-thumbnail" height="328" width="300"]]
124
125 * Only with manual mode and continuous mode
126
127 (% style="text-align:center" %)
128 [[image:7-11 Handy instructions_html_611186e7187f372b.jpg||class="img-thumbnail" height="317" width="300"]]
129
130 = **6.12.2 SER instruction** =
131
132 **Instruction description**
133
134 (% class="table-bordered" %)
135 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
136 |SER|(% rowspan="4" %)Data search|16|No|(% rowspan="4" %)SER S,,1,, S,,2,, D n|9
137 |SERP|16|Yes|9
138 |DSER|32|No|17
139 |DSERP|32|Yes|17
140
141 The instruction is to search the units with same data, or maximum value and minimum value.
142
143 * S,,1,, is the starting address of the data array;
144 * S,,2,, is the data, which is to be searched;
145 * D is the starting address of storage range for search result;
146 * n is the length of data range, which is to be searched. For 16-bit instruction, n=1~~256, for 32-bit instruction, n=1~~128.
147
148 When using 32-bit instruction, S,,1,,, S,,2,,, D and n are regarded as 32-bit.
149
150 (% class="table-bordered" %)
151 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
152 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
153 |S,,1,,| | | | | | | |√|√|√|√|√|√|√|√|√
154 |S,,2,,| | | | |√|√| |√|√|√|√|√|√|√|√|√
155 |D| | | | | | | |√|√|√|√|√|√|√|√|√
156 |n| | | | |√|√| | | | | | | |√| |
157
158 **Program example**
159
160 (% style="text-align:center" %)
161 [[image:7-11 Handy instructions_html_639cc67a482a061a.jpg||class="img-thumbnail" height="49" width="400"]]
162
163 :
164
165 (((
166 (% class="table-bordered" %)
167 |**S,,1,,**|**Retrieved data**|**S,,2,,**|**Number**|**Condition**
168 |D10|D10=K100|(% rowspan="10" %)Compare with (D10)=K100|0|Equal
169 |D11|D11=K123|1|
170 |D12|D12=K100|2|Equal
171 |D13|D13=K98|3|
172 |D14|D14=K111|4|
173 |D15|D15=K66|5|minimum
174 |D16|D16=K100|6|equal
175 |D17|D17=K100|7|equal
176 |D18|D18=K210|8|maximum
177 |D19|D19=K88|9|
178 )))
179
180 **Search result**
181
182 (((
183 (% class="table-bordered" %)
184 |**D**|**PARAMETER**|**DEFINATION**
185 |D80|4|No. of equal parameters
186 |D81|0|serial number of the first equal parameter
187 |D82|7|serial number of the last equal parameter
188 |D83|5|Serial number of the minimum parameter
189 |D84|8|Serial number of the maximum parameter
190 )))
191
192 When X20 is ON, the operation is implemented;
193
194 The comparison method is signed algebra comparison, for example -8<2;
195
196 When there are several minimum or maximum, all the components with the largest serials number are displayed respectively;
197
198 The storage units for search results occupy five continue units started with D. If there is no same data, D80~~D82 in above example are all 0.
199
200 = **6.12.3 ABSD instruction** =
201
202 **Instruction description**
203
204 (% class="table-bordered" %)
205 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
206 |ABSD|(% rowspan="2" %)E-Cam control (absolute mode)|16|No|(% rowspan="2" %)ABSD S,,1,, S,,2,, D n|9
207 |DABSD|32|No|17
208
209 This instruction generates a variety of output patterns (there are n number of addressed outputs) in response to the current value of a selected counter (S,,2,,).
210
211 * S,,1,,: The starting component address of the comparison table.
212 * S,,2,,: The counter component serial number. When using 32-bit instruction, it could be used as a 32-bit counter.
213 * D: The starting address of the comparison result, occupying n several continuous bit variable units.
214 * n: The number of multi-segment comparison data.
215 * When using 32-bit instruction, S,,1,,, S,,2,, and D are all pointing to 32-bit variable, and n is also calculated according to 32-bit variable width.
216
217 (% class="table-bordered" %)
218 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
219 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
220 |S,,1,,| | | | | | | |√|√|√|√|√|√|√| |
221 |S,,2,,| | | | | | | | | | | | |√| | |
222 |D| | | |√| | | | | | | | | | | |
223 |n|(% colspan="16" %)Constant, n=1~~64
224 |(% colspan="17" %)When S,,1,, operands are KnX, KnY, KnM,KnS , if it is 16-bit instruction, K4 must be specified; if it is 32bit instruction, K8 must be specified and the component number of X,Y,M,S must be a multiple of 8. S,,1,, operand could only specify C0 to C199 with 16-bit instruction, and specify C200 to C254 with 32-bit instruction.
225
226 **Program example**
227
228 (% style="text-align:center" %)
229 [[image:7-11 Handy instructions_html_69cb04cc830d1020.jpg||class="img-thumbnail" height="156" width="700"]]
230
231 (% style="text-align:center" %)
232 [[image:7-11 Handy instructions_html_75cbe0bd7d13e90b.jpg||class="img-thumbnail" height="145" width="600"]]
233
234 Before ABSD instruction is implemented, all the variables in the table should be assigned a value by MOV instruction.
235
236 Even there are high-speed devices in the DABSD instruction, the comparison result D is also affected by user program scould time delay. For the application with time response requirement, the HSZ high-speed comparison instruction is recommended.
237
238 ABSD could be only used once in the program.
239
240 = **6.12.4 INCD instruction** =
241
242 **Instruction description**
243
244 (% class="table-bordered" %)
245 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
246 |INCD|E-Cam control increment mode|16|No|SORT S,,1,, S,,2,, D n|9
247
248 The instruction to complete the operation is multi-section comparison, it is used for E-cam control, comparison tables, counters, etc. is set by incremental mode. The instruction is executed in the main program and the result of the comparison is affected by the lag of the scould time.
249
250 * S,,1,,: The comparison table.
251 * S,,2,,: The timer. The neighboring S2+1 unit is used to reset the time on the counter after the calculation and comparison process. (32bit counters are applicable to 32bit instructions)
252 * D: The comparison results record, which is a bit variable unit occupying n continuous addresses.
253 * n: The number of multi-segment comparison sets.
254
255 When the set comparison of N is done, the "instruction done" flag "M8029" will automatically switch on.
256
257 (% class="table-bordered" %)
258 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
259 |**X**|**Y**|**M**|**S**|**K**|**H**|**E**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**V**|**Z**
260 |S,,1,,| | | | | | | |√|√|√|√|√|√|√| |
261 |S,,2,,| | | | | | | | | | | | |√| | |
262 |D| | | | | | | | | | | | | | | |
263 |n| |√|√|√| | | | | | | | | | | |
264 |(% colspan="17" %)(((
265 For 16bit –S,,1,, operation numbers KnX, KnY, KnM and KnS, "K4" must be specified.
266
267 For 32bit -"K8" must be specified and the number of components X, Y, M and S must be multiples of 8.
268
269 S,,1,, operation numbers are limited to C0~~C199 for 16bit instruction.
270
271 S,,1,, operation numbers are limited to C200~~C254 for 32bit instruction
272 )))
273
274 **Program example**
275
276 (% style="text-align:center" %)
277 [[image:7-11 Handy instructions_html_8a5026902ddb297.jpg||class="img-thumbnail" height="94" width="400"]]
278
279 If the relevant variables have been set as follows, when X10=ON, the implementation result is shown as the following figure.
280
281 (% style="text-align:center" %)
282 [[image:7-11 Handy instructions_html_6ccacc6e541f7e3b.jpg||class="img-thumbnail" height="327" width="600"]]
283
284 All the variables of the relevant tables should be assigned a value by MOV instruction before implementing the INCD instruction.
285
286 The comparison output is also affected by the delay of the program scouldning time. Therefore, the HSZ high speed comparison instruction could be used.
287
288 The INCD instruction could only be used once in the program.
289
290 = **6.12.5 TTMR instruction** =
291
292 **Instruction description**
293
294 (% class="table-bordered" %)
295 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
296 |TTMR|Monitors the duration of a signal and places the timed data into a data register|16|No|TTMR D n|5
297
298 The duration of time that the TTMR instruction is energized, is measured and stored in device D+1 (as a count of 100ms periods). The data value of D+1 (in secs), multiplied by the factor selected by the operand n, is moved in to register D. The contents of D could be used as the source data for an indirect timer setting or even as raw data for manipulation. When the TTMR instruction is de-energized D+1 is automatically reset (D is unchanged).
299
300 * When n=K0, the actual multiple is 1;
301 * When n=K1, the actual multiple is 10;
302 * When n=K2, the actual multiple is 100;
303
304 (% class="table-bordered" %)
305 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
306 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
307 |D| | | | | | | | | | | | | |√| |
308 |n| | | | |√|√| | | | | | | | | |
309
310 **Program example**
311
312 Example 1:
313
314 (% style="text-align:center" %)
315 [[image:7-11 Handy instructions_html_9bfcb73c168f7459.jpg||class="img-thumbnail" height="80" width="400"]]
316
317 * When X10 is closed, D10=D11;
318 * When X10 is opened, D100 remains the same and D11 becomes 0.
319
320 If holding time of pressing key X10 is T seconds, the relationships between D10, D11, and n are listed as below:
321
322 (% class="table-bordered" %)
323 |n|D10|D11(unit: 100ms)
324 |K0(unit: 1 s)|1*T|D11=D10*10
325 |K1(unit: 100ms)|10*T|D11=D10
326 |K2(unit: 10 ms)|100*T|D11=D10/10
327
328 (% style="text-align:center" %)
329 [[image:7-11 Handy instructions_html_1b46fe5521e4add6.jpg||class="img-thumbnail" height="176" width="400"]]
330
331 Example 2:
332
333 (% style="text-align:center" %)
334 [[image:7-11 Handy instructions_html_625abd2680b20fcc.jpg||class="img-thumbnail" height="367" width="300"]]
335
336 * Use TMR instruction to write ten sets of setting time to D10~~D19 in advance. This set of timers are 100ms timer, so the 1/10 of the teach data are actual action time(sec).
337 * Connect 1 digit DIP switch to X10~~X13 and use one BIN instruction to convert the setting value of the DIP switch to BIN and save it to Z0.
338 * On time for X0(sec.) is saved in D100.
339 * M100 is the one-time scouldning cycle pulse produced by the release of the demo timer button X0.
340 * Use setting no. of DIP switch as an indirectly specified pointer and send the content of D100 to D10Z0 (D10~~D19).
341
342 = **6.12.6 STMR instruction** =
343
344 **Instruction description**
345
346 (% class="table-bordered" %)
347 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
348 |STMR|Special timer|16|No|STMR S m D|7
349
350 The function of this instruction is to generate 4 kinds of special instruction of delay action according to instruction power flow.
351
352 * S: The timer number. T0~~T19 could be used for triggering delay action
353 * m: The delay setting in 100 ms ranging from K1 to K32767;
354 * D: The starting number for delay action outputting components and occupies 4 consecutive units.
355
356 (% class="table-bordered" %)
357 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
358 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
359 |S| | | | | | | | | | | |√| | | |
360 |m|(% colspan="16" %)Constant, 1~~32767
361 |D| |√|√|√| | | | | | | | | | | |
362
363 **Program example**
364
365 Example 1:
366
367 (% style="text-align:center" %)
368 [[image:7-11 Handy instructions_html_92af4b74ae37e62f.jpg||class="img-thumbnail" height="58" width="400"]]
369
370 (% style="text-align:center" %)
371 [[image:7-11 Handy instructions_html_f8c0a7c32e426d3b.png||class="img-thumbnail" height="287" width="300"]]
372
373
374 (% style="text-align:center" %)
375 [[image:7-11 Handy instructions_html_820341bae20bfa86.jpg||class="img-thumbnail" height="245" width="300"]]
376
377 Example 2:
378
379 It is easy to generate a oscillator output. (The function could also be implemented by using a ALT instruction), which is shown as below:
380
381 (% style="text-align:center" %)
382 [[image:7-11 Handy instructions_html_196b01db393bbd16.jpg||class="img-thumbnail" height="153" width="600"]]
383
384 = **6.12.7 ALT instruction** =
385
386 **Instruction description**
387
388 (% class="table-bordered" %)
389 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
390 |ALT|(% rowspan="2" %)Alternate State|16|No|(% rowspan="2" %)ALT D|3
391 |ALTP|16|Yes|3
392
393 The status of the destination device (D) is alternated on every operation of the ALT instruction.
394
395 This instruction reverses D component state when the energy flow is effective.
396
397 (% class="table-bordered" %)
398 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
399 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
400 |D| |√|√|√| | | | | | | | | | | |
401
402 **Program example**
403
404 Example 1:
405
406 (% style="text-align:center" %)
407 [[image:7-11 Handy instructions_html_9e93eea34beec003.jpg||class="img-thumbnail" height="171" width="700"]]
408
409 Example 2:
410
411 With the use of timer, it is easy to generate an oscillator output. The function could also be implemented by using a special timer STMR instruction), which is shown in the following figure.
412
413 (% style="text-align:center" %)
414 [[image:7-11 Handy instructions_html_448db4f4492cdf4.jpg||class="img-thumbnail" height="134" width="400"]]
415
416 = **6.12.8 RAMP instruction** =
417
418 **Instruction description**
419
420 (% class="table-bordered" %)
421 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
422 |RAMP|Ramps a device from one value to another in the specified number of steps|16|No|RAMP S,,1,, S,,2,, D n|9
423
424 The RAMP instruction varies a current value (D) between the data limits set by the user (S,,1,, and S,,2,,). The ‘journey’ between these extreme limits takes n program scoulds. The current scould number is stored in device D+1. Once the current value of D equals the set value of S,,2,, the execution complete flag M8029 is set ON.
425
426 The RAMP instruction could vary both increasing and decreasing differences between S,,1,, and S,,2,,.
427
428 * S,,1,,: The starting value unit of slope signal
429 * S,,2,,: The end-point value unit of slope signal
430 * D: The memory point for procedure value of linear interpolation signal, yet the timer which is used to count the times of interpolation is stored in unit D+1
431 * n: The times of program scouldning execution for process of Interpolation. Because the output of interpolation is carried on during main loop, it's necessary to set the program execution to fixed scouldning mode. (The demonstration is on M8039, D8039)
432
433 (% class="table-bordered" %)
434 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
435 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
436 |S,,1,,| | | | | | | | | | | | | |√| |
437 |S,,2,,| | | | | | | | | | | | | |√| |
438 |D| | | | | | | | | | | | | |√| |
439 |n|(% colspan="16" %)Constant, 1~~32767
440
441 **Program example**
442
443 The interpolation calculation is based on integer number and has discarded the decimal calculation. Command function is showed in the following chart:
444
445 (% style="text-align:center" %)
446 [[image:7-11 Handy instructions_html_dd0aecd1828de812.jpg||class="img-thumbnail" height="212" width="700"]]
447
448 There are 2 modes for RAMP command execution which is defined by M8026. After every interpolation, M8029 set on for a scouldning cycle .The execution features is showed in the follow example:
449
450 (% style="text-align:center" %)
451 [[image:7-11 Handy instructions_html_a4615fc88474f21b.jpg||class="img-thumbnail" height="245" width="600"]]
452
453 = **6.12.9 ROTC instruction** =
454
455 **Instruction description**
456
457 (% class="table-bordered" %)
458 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
459 |ROTC|Controls a rotary tables movement is response to a requested destination/ position|16|No|ROTC S m1 m2 D|9
460
461 The ROTC instruction is used to aid the tracking and positional movement of the rotary table as it moves to a specified destination.
462
463 * S: The initial cell of count variable.
464 * m1: Numbers of station on rotary workbench, which must be M1 ≥ M2;
465 * m2: Numbers of low-speed rotary workbench, which must be M1 ≥ M2;
466 * D: The initial cell to storage position detection signal of rotary workbench, which occupies the next 8 bit variable units.
467
468 As the picture below, X0, X1 connect with the A and B phase output of AB Quadrature Encoder respectively, and we could get the Quadrature signals by mechanical switch. X2 will be used as the detection input of No.0 station ("ON" when turning to No.0 station), the rotational speed, direction, and workstation could be detected by these three signals.
469
470 (% style="text-align:center" %)
471 [[image:7-11 Handy instructions_html_5e0a05f9deeb2215.jpg||class="img-thumbnail" height="315" width="600"]]
472
473 (% class="table-bordered" %)
474 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
475 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
476 |S| | | |√| | | | | | | | | |√| |
477 |D| |√|√|√| | | | | | | | | | | |
478 |m,,1,,|(% colspan="16" %)Constant, 2~~32767, m1>=m2
479 |m,,2,,|(% colspan="16" %)Constant, 0~~32767, m1>=m2
480
481 **Program example**
482
483 (% style="text-align:center" %)
484 [[image:7-11 Handy instructions_html_f992bf646dd9349.jpg||height="61" width="400"]]
485
486 = **6.12.10 SORT instruction** =
487
488 **Instruction description**
489
490 (% class="table-bordered" %)
491 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
492 |SORT|Data in a defined table could be sorted on selected fields while retaining record integrity|16|No|SORT S m1 m2 D n|17
493
494 This instruction constructs a data table of m1 records with m2 fields having a start or head address of S. Then the data in field is sorted in to numerical order while retaining each individual records integrity. The resulting (new) data table is stored from destination device D.
495
496 * S: The starting unit of the first variable in first line (or called first record);
497 * m1: The line number of the array, or called record number;
498 * m2: The row number, or called item number in each record;
499 * D: The starting unit for saving result, occupying following variable unit number is same as that of array before sorting;
500 * n: The array row number, according which the sort operation is implemented. n is within the range of 1 ~~ m2.
501
502 (% class="table-bordered" %)
503 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
504 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
505 |S| | | |√| | | | | | | | | |√| |
506 |m,,1,,|(% colspan="16" %)Constant, 1~~32
507 |m,,2,,|(% colspan="16" %)Constant, 1~~6
508 |D| | | | | | | | | | | | | |√| |
509 |n| | | | |√|√| | | | | | | |√| |
510
511 **Program example**
512
513 (% style="text-align:center" %)
514 [[image:7-11 Handy instructions_html_2d8ddcd2d79ac755.jpg||class="img-thumbnail" height="41" width="400"]]
515
516 When X10=ON, sort operation is implemented, and after the implementation, M8029 is set on for one scouldning cycle; If it needs re-sorting, X10 should be reset and turn on again.
517
518 The equivalent form of the above instruction and its data:
519
520 (% style="text-align:center" %)
521 [[image:7-11 Handy instructions_html_2dd79bb99115a0c2.jpg||class="img-thumbnail" height="284" width="500"]]
522
523 The result of sorting when N=k2 is as below:
524
525 (% style="text-align:center" %)
526 [[image:7-11 Handy instructions_html_6fee9a69a2578c6c.jpg||class="img-thumbnail" height="324" width="500"]]
527
528 The result of sorting when N=k4 is as below:
529
530 (% style="text-align:center" %)
531 [[image:7-11 Handy instructions_html_c6db30b9634b12ae.jpg||class="img-thumbnail" height="312" width="500"]]