欢迎图片

Wiki source code of 06 Basic instructions

Version 1.1 by Wecon on 2025/09/03 21:02

Show last authors
1 = **Transfer Comparison instruction** =
2
3 == ** MOV/16-bit Transmission** ==
4
5 **MOV(P)**
6
7 Transfer the BIN 16-bit data of the device specified in (s) to the device specified in (d).
8
9 -[MOV (s) (d)]
10
11 **Content, range and data type**
12
13 |=**Parameter**|=**Content**|=(% style="width: 120px;" %)**Range**|=(% style="width: 100px;" %)**Data type**|=**Data type (label)**
14 |(s)|Transmit source data or the device number stored data|(% style="width:120px" %)-32768 to 32767|(% style="width:100px" %)Signed BIN16|ANY16_S
15 |(d)|Transmit destination device number|(% style="width:120px" %)(((
16 -
17
18
19 )))|(% style="width:100px" %)Signed BIN16|ANY16_S
20
21 **Device used**
22
23 |=**instruction**|=**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
24 **Pulse**
25
26 **extension**
27 )))
28 | | |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
29 |MOV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
30 | |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
31
32 **Features**
33
34 • Transfer the BIN 16-bit data specified in (s) to the device specified in (d).
35
36 (% style="text-align:center" %)
37 [[image:图片2.png]]
38
39 **Error code**
40
41 |=**Error code**|=**Content**
42 |4085H|The output result of (s) in read application instruction exceeds the device range
43 |4086H|The output result of (d) in write application instruction exceeds the device range
44
45 **Example**
46
47 (% style="text-align:center" %)
48 [[image:图片1.png]]
49
50 When M0 is set, the value of D0 is transferred to the value of D2: (D0)→(D2).
51
52 == DMOV/32-bit Transmission ==
53
54 **DMOV(P)**
55
56 Transfer the BIN 32-bit data of the device specified in (s) to the device specified in (d).
57
58 -[DMOV (s) (d)]
59
60 **Content, range and data type**
61
62 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
63 |=(s)|Transmit source data or the device number stored data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
64 |=(d)|Transmit destination device number|-|Signed BIN32|ANY32_S
65
66 **Device used**
67
68 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
69 **Pulse**
70
71 **extension**
72 )))
73 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
74 |(% rowspan="2" %)DMOV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
75 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
76
77 **Features**
78
79 Transfer the BIN 16-bit data specified in (s) to the device specified in (d).
80
81 (% style="text-align:center" %)
82 [[image:1708590517501-798.png]]
83
84 **Error code**
85
86 |=**Error code**|=**Content**
87 |4085H|The output result of (s) in read application instruction exceeds the device range
88 |4086H|The output result of (d) in write application instruction exceeds the device range
89
90 **Example**
91
92 (% style="text-align:center" %)
93 [[image:1708590813837-824.png]]
94
95 When M0 is set, the value of (D1, D0) is transferred to the value of (D3, D2): (D1, D0) → (D3, D2).
96
97 == BMOV/Batch Transmission ==
98
99 **BMOV(P)**
100
101 The (n) point BIN 16-bit data starting from the device specified in (s) is sequentially transmitted to the device specified in (d).
102
103 -[BMOV (s) (d)  (n)]
104
105 **Content, range and data type**
106
107 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
108 |(s)|The start device that stores the transmission data|-|Signed BIN16|ANY16_S
109 |(d)|The start device that transmit target|-|Signed BIN16|ANY16_S
110 |(n)|Number of transmission|1 ≤ n ≤ 512|Signed BIN16|ANY16_S
111
112 **Device used**
113
114 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
115 **Pulse**
116
117 **extension**
118 )))
119 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
120 |(% rowspan="3" %)BMOV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
121 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
122 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
123
124 **Features**
125
126 Batch transfer the BIN 16-bit data of point (n) starting from the device specified in (s) to the device specified in (d).
127
128 (% style="text-align:center" %)
129 [[image:1708590952127-122.png]]
130
131 When the device number exceeds the range, it will be transferred within the allowable range.
132
133 By controlling the direction reversal flag (SM224) of the BMOV instruction, the BIN 16-bit data at point (n) starting from the device specified in (d) can be batch transferred to the device specified in (s).
134
135 **Error code**
136
137 |=**Error code**|=**Content**
138 |4084H|In application instruction (n) input the data exceeds the specified range
139 |4085H|The output results of (s) and (n) in read application instruction exceed the device range
140 |4086H|The output result of (d) in write application instruction exceeds the device range
141
142 **Example**
143
144 (% style="text-align:center" %)
145 [[image:1708590989629-793.png]]
146
147 When M0 is set, set M1, then (D5)→(D10); (D6)→(D11); (D7)→(D12);
148
149 When M0 is reset, set M1, then (D10)→(D5); (D11)→(D6); (D12)→(D7).
150
151 == FMOV/16-bit Multicast ==
152
153 **FMOV(P)**
154
155 Transfer the BIN 16-bit data of the device specified in (s1) to the device specified in (d) at (n) points (that is, transfer the same data to multiple addresses).
156
157 -[FMOV (s) (d) (n)]
158
159 **Content, range and data type**
160
161 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
162 |(s)|The start device that stores the transmission data|-32768 to 32767|Signed BIN16|ANY16_S
163 |(d)|The start device that transmit target|-|Signed BIN16|ANY16_S
164 |(n)|Number of transmission|[K1 ≤ n ≤ 512]|Signed BIN16|ANY16_S
165
166 **Device used**
167
168 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
169 **Pulse**
170
171 **extension**
172 )))
173 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
174 |(% rowspan="3" %)FMOV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
175 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
176 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
177
178 **Features**
179
180 The same data as the BIN 16-bit data of the device specified in (s) is transferred to the device specified in (d) at (n) points.
181
182 (% style="text-align:center" %)
183 [[image:1708591128027-832.png]]
184
185 When the number specified in (n) exceeds the device number range, transfer is performed within the allowable range.
186
187 When a constant (K) is specified for the transmission source (s), it will be automatically converted to BIN.
188
189 **Error code**
190
191
192 |=**Error code**|=**Content**
193 |4084H|(s) and(n) input the data In application instruction exceed the specified range
194 |4085H|The output results of (s) and (n) in read application instruction exceed the device range
195 |4086H|The output result of (d) in write application instruction exceeds the device range
196
197 **Example**
198
199 (% style="text-align:center" %)
200 [[image:1708591172502-492.png]]
201
202 When M0 is set, the value of D0 to D4 is set to 0.
203
204 (% style="text-align:center" %)
205 [[image:1708591336176-892.png]]
206
207 == **DFMOV/ 32-bit Multicast** ==
208
209 **DFMOV(P)**
210
211 Transfer the BIN 32-bit data of the device specified in (s1) to the device specified in (d) at (n) points (that is, transfer the same data to multiple addresses).
212
213 -[FMOV (s)  (d) (n)]
214
215 **Content, range and data type**
216
217 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
218 |(s)|Transfer data or start device storing transfer data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
219 |(d)|Start device of transfer destination|-|Signed BIN32|ANY32_S
220 |(n)|Number of transfers|[1≤n≤512]|Signed BIN32|ANY32_S
221
222 **Device used**
223
224 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
225 **Pulse**
226
227 **extension**
228 )))
229 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
230 |(% rowspan="3" %)DFMOV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
231 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
232 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
233
234 **Features**
235
236 The same data as the BIN 32-bit data of the device specified in (s) is transferred to the device specified in (d) at (n) points.
237
238 (% style="text-align:center" %)
239 [[image:1708591575858-882.png]]
240
241 When the number specified in (n) exceeds the device number range, transfer is performed within the allowable range.
242
243 When a constant (K) is specified for the transmission source (s), it will be automatically converted to BIN.
244
245 **Error code**
246
247 |=**Error code**|=**Content**
248 |4084H|(s) and (n) input the data In application instruction exceed the specified range
249 |4085H|The output results of (s) and (n) in read application instruction exceed the device range
250 |4086H|The output result of (d) in write application instruction exceeds the device range
251
252 **Example**
253
254 (% style="text-align:center" %)
255 [[image:1708591633133-701.png]]
256
257 When M0 is set, the value of (D1, D0), (D3, D2), (D5, D4), (D7, D6), (D9, D8) is set to 0.
258
259 == SMOV/Bit Shift ==
260
261 **SMOV(P)**
262
263 A instruction for distributing and synthesizing data in units of digits (4 bits).
264
265 -[SMOV (s) (n1)  (n2) (d)  (n3)]
266
267 **Content, range and data type**
268
269 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
270 |(s)|The word device number that stores the data whose bit is to be moved| |Signed BIN16|ANY16_S
271 |(n1)|Transfer destination device number|1 to 4|Signed BIN16|ANY16_S
272 |(n2)|The number of digits to move|1 to 4|Signed BIN16|ANY16_S
273 |(d)|The word device number that stores data for bit shifting| |Signed BIN16|ANY16_S
274 |(n3)|The starting position of the moving target|1 to 4|Signed BIN16|ANY16_S
275
276 **Device used**
277
278 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
279 **Pulse**
280
281 **extension**
282 )))
283 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
284 |(% rowspan="5" %)SMOV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
285 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
286 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
287 |Parameter 4| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
288 |Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
289
290 **Features**
291
292 destination (d) are conver.The data is distributed/combined in units of digits (4 bits). The contents of the transmission source (s) and the transmission ted into 4-digit BCD (0000 to 9999), and the (n1) bits are transferred to the lower (n2) bits and the (n3) bits of the transmission destination (d) (combined ). After reaching the starting position, it is converted to BIN and stored in the transfer destination (d).
293
294 When the instruction input is OFF, the transfer destination (d) does not change.
295
296 When the instruction input is ON, the data of the transmission source (s) and the number of digits other than the transmission specification of the transmission destination (d) do not change.
297
298 (% style="text-align:center" %)
299 [[image:图片1.png]]
300
301
302 1. Perform BIN→BCD conversion on (s).
303 1. Transfer (synthesize) the (n1)th bit to the lower (n2), (d), (n3)th bit to the (n2)th bit counted from the previous. (D), the first and fourth digits start from (s), and the transmission will not be affected.
304 1. Convert the synthesized data (BCD) into BIN and store it in (d).
305
306 **Extended function**
307
308 If the SMOV instruction is executed after SM168 is turned ON, the BIN→BCD conversion will not be performed. The bit shift is performed in 4-bit units.
309
310 **Error code**
311
312 |=**Error code**|=**Content**
313 |4084H|(n1), (n2) and (n3) input data that exceed the specified range in the application instruction or does not satisfy the relationship of n2≤n1 and n2≤n3.
314 |4085H|The output result of (s), (n1) (n2), (d) and (n3) in the read application instruction exceeds the device range
315 |4086H|The output result of (d) in write application instructions exceeds the device range
316
317 **Example**
318
319 After synthesizing the data of the 3-digit digital switch, it is stored in D2 in binary.
320
321 (% style="text-align:center" %)
322 [[image:1708592329704-420.png]]
323
324 Combine data of 3 digital switches connected to non-continuous input terminals.
325
326 (% style="text-align:center" %)
327 [[image:1708592355415-149.png]]
328
329 When M0 is set,
330
331 (X020 to X027) BCD 2 digits → D 2 (binary);
332
333 (X000 to X003) BCD 1 digit → D 1 (binary);
334
335 Store the 1 digit of D1 into the 3 digit of D2, and synthesize a 3-digit value.
336
337 == CML/16-bit Invert Transmission ==
338
339 **CML(P)**
340
341 After the BIN 16-bit data specified in (s) is inverted bit by bit, the result is transferred to the device specified in (d).
342
343 -[CML (s) (d)]
344
345 **Content, range and data type**
346
347 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
348 |(s)|Inverted data or the device number that stores data|-32768 to 32767|Signed BIN16|ANY16_S
349 |(d)|The device number that stores the inversion result|-|Signed BIN16|ANY16_S
350
351 **Device used**
352
353 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
354 **Pulse**
355
356 **extension**
357 )))
358 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
359 |(% rowspan="2" %)CML|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
360 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
361
362 **Features**
363
364 After inverting the BIN 16-bit data specified in (s) bit by bit, the result is transferred to the device specified in (d).
365
366 (% style="text-align:center" %)
367 [[image:1708592437397-834.png]]
368
369 When the number of digits of the device with the specified digit is 4 points, other digits are not affected.
370
371 **Error code**
372
373 |=**Error code**|=**Content**
374 |4085H|The output result of (s) in read application instruction exceeds the device range
375 |4086H|The output result of (d) in write application instruction exceeds the device range
376
377 **Example**
378
379 Example 1:
380
381 (% style="text-align:center" %)
382 [[image:1708592498105-403.png]]
383
384 When M0 is set, the value of D0 is inverted and transferred to the value of D2.
385
386 Example 2:
387
388 invert input acquisition:
389
390 (% style="text-align:center" %)
391 [[image:1708592530381-166.png]]
392
393 == DCML/32-bit Invert Transmission ==
394
395 **DCML(P)**
396
397 After the BIN 32-bit data specified in (s) is inverted bit by bit, the result is transferred to the device specified in (d).
398
399 -[CML (s)  (d)]
400
401 **Content, range and data type**
402
403 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
404 |(s)|Inverted data or the device number that stores data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
405 |(d)|The device number that stores the inversion result|-|Signed BIN32|ANY32_S
406
407 **Device used**
408
409 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
410 **Pulse**
411
412 **extension**
413 )))
414 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
415 |(% rowspan="2" %)DCML|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
416 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
417
418 **Features**
419
420 After inverting the BIN 32-bit data specified in (s) bit by bit, the result is transferred to the device specified in (d).
421
422 (% style="text-align:center" %)
423 [[image:1708592601925-932.png]]
424
425 When the number of digits of the device with the specified digit is 4 points, other digits are not affected.
426
427 **Error code**
428
429 |=**Error code**|=**Content**
430 |4085H|The output result of (s) in read application instruction exceeds the device range
431 |4086H|The output result of (d) in write application instruction exceeds the device range
432
433 **Example**
434
435 (% style="text-align:center" %)
436 [[image:1708592648329-938.png]]
437
438 When M0 is set, the value of (D1, D0) is reversed and transferred to the value of (D3, D2).
439
440 == CMP/16-bit Data Comparison Output ==
441
442 **CMP(P)**
443
444 Compare the BIN 16-bit data of the device specified in (s1) and (s2).
445
446 -[CML (s1) (s2) (d)]
447
448 **Content, range and data type**
449
450
451 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
452 |(s1)|Comparison value data or the device storing the comparison value data|-32768 to +32767|Signed BIN16|ANY16_S
453 |(s2)|Comparison source data or the device storing the comparison source data|-32768 to 32767|Signed BIN16|ANY16_S
454 |(d)|Start bit device for output comparison result| |Bit|ANYBIT_ARRAY
455
456 **Device used**
457
458 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
459 **Pulse**
460
461 **extension**
462 )))
463 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
464 |(% rowspan="3" %)CMP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
465 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
466 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
467
468 **Features**
469
470 Compare the BIN 16-bit data of the device specified in (s1) with the BIN 16-bit data of the device specified in (s2). According to the result (less than, consistent, greater than), (d), (d)+1, (d) One of )+2 will turn ON.
471
472 (s1) and (s2) are handled as BIN values within the above setting data range.
473
474 Use algebraic methods for size comparison.
475
476 (% style="text-align:center" %)
477 [[image:1708592716888-578.png]]
478
479 (1): Even if the instruction input is OFF and the CMP instruction is not executed, (d) to (d)+2 will keep the state before the instruction input changed from ON to OFF.
480
481 **✎Note: **
482
483 Occupy the device specified in 3 points (d) at the beginning, please be careful not to overlap with the device used for other control.
484
485 **Error code**
486
487
488 |**Error code**|**Content**
489 |4085H|The output results of (s1) and (s2) in read application instruction exceed the device range
490 |4086H|The output result of (d) in write application instruction exceeds the device range
491
492 **Example**
493
494 (% style="text-align:center" %)
495 [[image:1708592758771-657.png]]
496
497 When M0 is set, compare the values of D0 and D2:
498
499 If (D0)> (D2) then Y0 is ON.
500
501 If (D0) = (D2) then Y1 is ON. If (D0) <(D2) then Y2 is ON.
502
503 == DCMP/32-bit Data Comparison Output ==
504
505 **DCMP(P)**
506
507 Compare the BIN 32-bit data of the device specified in (s1) and (s2).
508
509 -[DCML (s1)  (s2) (d)]
510
511 **Content, range and data type**
512
513
514 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
515 |(s1)|Comparison value data or the device storing the comparison value data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
516 |(s2)|Comparison source data or the device storing the comparison source data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
517 |(d)|Start bit device for output comparison result| |Bit|ANYBIT_ARRAY
518
519 **Device used**
520
521 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
522 **Pulse**
523
524 **extension**
525 )))
526 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
527 |(% rowspan="3" %)DCMP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
528 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
529 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
530
531 **Features**
532
533 • Compare the BIN 16-bit data of the device specified in (s1) with the BIN 16-bit data of the device specified in (s2). According to the result (less than, consistent, greater than), (d), (d)+1, (d) One of )+2 will turn ON.
534
535 • (s1) and (s2) are handled as BIN values within the above setting data range.
536
537 • Use algebraic methods for size comparison.
538
539 (% style="text-align:center" %)
540 [[image:1708592852238-153.png]]
541
542 (1): Even if the instruction input is OFF, and the CMP instruction is not executed, (d) to (d)+2 will keep the state before the instruction input changed from ON to OFF.
543
544 (% class="box infomessage" %)
545 (((
546 **✎Note: **
547
548 Occupy the device specified in 3 points (d) at the beginning. Please be careful not to overlap with other control devices.
549 )))
550
551 **Error code**
552
553 |=**Error code**|=**Content**
554 |4085H|The output results of (s1) and (s2) in read application instruction exceed the device range
555 |4086H|The output result of (d) in write application instruction exceeds the device range
556
557 **Example**
558
559 (% style="text-align:center" %)
560 [[image:1708593020814-669.png]]
561
562 (% style="text-align:center" %)
563 [[image:1708593024791-647.png]]
564
565 == XCH/16-bit Data Exchange ==
566
567 **XCH(P)**
568
569 Exchange the BIN 16-bit data of (d1) and (d2).
570
571 -[XCH (d1) (d2)]
572
573 **Content, range and data type**
574
575 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
576 |(d1)|The start device that stores the exchange data|-32768 to 32767|Signed BIN16|ANY16_S
577 |(d2)|The start device that stores the exchange data|-32768 to 32767|Signed BIN16|ANY16_S
578
579 **Device used**
580
581 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
582 **Pulse**
583
584 **extension**
585 )))
586 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
587 |(% rowspan="2" %)XCH|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
588 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
589
590 **Features**
591
592 • Exchange the BIN 16-bit data of (d1) and (d2).
593
594 (% style="text-align:center" %)
595 [[image:1708593141082-993.png]]
596
597 • When executing instructions with SM160 ON, if the device numbers of (d1) and (d2) are the same. Exchange the upper 8 bits (byte) and lower 8 bits (byte) of the word device.
598
599 (% style="text-align:center" %)
600 [[image:1708593162883-397.png]]
601
602 (% class="box infomessage" %)
603 (((
604 **✎Note: **
605
606 If continuous execution instructions are used, conversion will be performed every operation cycle.
607 )))
608
609 **Error code**
610
611 |=**Error code**|=**Content**
612 |4084H|In exchange mode, the devices in (d1) and (d2) are different
613 |4085H|The output results of (d1) and (d2) in the read application instruction exceed the device range
614 |4086H|The output results of (d1) and (d2) in the writing application instruction exceed the device range
615
616 **Example**
617
618 When M0 is reset, set M1: the value of D0 and the value of D2 are exchanged.
619
620 (% style="text-align:center" %)
621 [[image:1708593244047-197.png]]
622
623 When M0 is set, M1 is set: the upper 8 bits (bytes) and lower 8 bits (bytes) of D0 are exchanged with each other.
624
625 (% style="text-align:center" %)
626 [[image:1708593262736-480.png]]
627
628 == DXCH/32-bit Data Exchange ==
629
630 **DXCH(P)**
631
632 Exchange (d1) and (d2) BIN 32-bit data.
633
634 -[DXCH (d1) (d2)]
635
636 **Content, range and data type**
637
638
639 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
640 |(d1)|The start device that stores the exchange data|-2147483647 to 2147483647|Signed BIN32|ANY32_S
641 |(d2)|The start device that stores the exchange data|-2147483647 to 2147483647|Signed BIN32|ANY32_S
642
643 **Device used**
644
645 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
646 **Pulse**
647
648 **extension**
649 )))
650 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
651 |(% rowspan="2" %)DXCH|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
652 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
653
654 **Features**
655
656 • Exchange the BIN 32-bit data of (d1), (d1)+1 and (d2), (d2)+1.
657
658 (% style="text-align:center" %)
659 [[image:1708593394355-443.png]]
660
661 • When executing instruction
662
663 s with SM160 ON, if the device numbers of (d1) and (d2) are the same. Exchange the upper 8 bits (byte) and lower 8 bits (byte) of the word device (d1) and (d1+1).
664
665 (% style="text-align:center" %)
666 [[image:1708593437017-148.png]]
667
668 (% class="box infomessage" %)
669 (((
670 **✎Note:**
671
672 **~ **If continuous execution instructions are used, conversion will be performed every operation cycle.
673 )))
674
675 **Error code**
676
677 |=**Error code**|=**Content**
678 |4084H|In exchange mode, the devices in (d1) and (d2) are different
679 |4085H|The output results of (d1) and (d2) in the read application instruction exceed the device range
680 |4086H|The output results of (d1) and (d2) in the writing application instruction exceed the device range
681
682 **Example :**When M0 is set, M1 is set: the high 8 bits (byte) and low 8 bits (byte) of the D0 Devices are exchanged, and the high 8 bits (byte) and low 8 bits (byte) of the D1 Devices) Exchange each other.
683
684 (% style="text-align:center" %)
685 [[image:1708593494709-216.png]]
686
687 When M0 is reset, set M1: the value of (D1, D0) and the value of (D3, D2) are exchanged.
688
689 (% style="text-align:center" %)
690 [[image:1708593508187-176.png]]
691
692 == ZCP/16-bit Data Interval Comparison ==
693
694 **ZCP(P)**
695
696 Compare the BIN 16-bit data of the device specified in (s1) and the value (bandwidth) of the BIN 16-bit data of the device specified in (s2) with the BIN 16-bit data of the device specified in the comparison source (s3), Output the result (bottom, area, top) to the device specified in (d) and later.
697
698 -[ZCP (s1) (s2) (s3) (d)]
699
700 **Content, range and data type**
701
702
703 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
704 |(s1)|The comparison value data of low limit or the device that stores the comparison value data|-32768 to 32767|Signed BIN16|ANY16_S
705 |(s2)|The comparison value data of high limit or the device that stores the comparison value data|-32768 to 32767|Signed BIN16|ANY16_S
706 |(s3)|Comparison source data or the device that stores the comparison source data|-32768 to 32767|Signed BIN16|ANY16_S
707 |(d)|The start bit device of output comparison result| |Bit|ANYBIT_ARRAY
708
709 **Device used**
710
711 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
712 **Pulse**
713
714 **extension**
715 )))
716 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
717 |(% rowspan="4" %)ZCP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●|●|●|●
718 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●|●|●|●
719 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●|●|●|●
720 |Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
721
722 **Features**
723
724 • Compare the BIN 16-bit data of the device specified in (s1) and the value (bandwidth) of the BIN 16-bit data of the device specified in (s2) with the BIN 16-bit data of the device specified in the comparison source (s3) , According to the result (bottom, area, top), one of (d), (d)+1, (d)+2 will be turned ON. (s1), (s2), (s3) are treated as BIN values within the above-mentioned setting data range. Use algebraic methods for size comparison.
725
726 • Use algebraic methods for size comparison.
727
728 (% style="text-align:center" %)
729 [[image:1708593605019-728.png]]
730
731 (1): Even if the instruction input is OFF and the ZCP instruction is not executed, (d) to (d)+2 will keep the state before the instruction input turns from ON to OFF.
732
733 (% class="box infomessage" %)
734 (((
735 **✎Note: **
736
737 • Please set the lower comparison value (s1) to a value smaller than the upper comparison value (s2).
738
739 • When (s1) is greater than (s2), it will be processed as (s2)=(s1).
740
741 • The device specified in 3 points (d) is occupied at the beginning. Please be careful not to overlap with other control devices.
742 )))
743
744 **Error code**
745
746 |=**Error code**|=**Content**
747 |4085H|The output results of (s1), (s2) and (s3) in the read application instruction exceed the device range
748 |4086H|The output result of (d) in write application instructions exceeds the device range
749
750 **Example**
751
752 (% style="text-align:center" %)
753 [[image:1708593715182-386.png]]
754
755 When M0 is set, compare whether D0 is between 0 and 1000:
756
757 If (D0)> (1000), then Y0 is ON.
758
759 If (0) ≤ (D0) ≤ (1000), then Y1 is ON.
760
761 If (D0) <(0), then Y2 is ON.
762
763 == DZCP/32-bit Data Interval Comparison ==
764
765 **DZCP(P)**
766
767 Compare the BIN 32-bit data of the device specified in (s1) and the value (bandwidth) of the BIN 32-bit data of the device specified in (s2) with the BIN 32-bit data of the device specified in the comparison source (s3), Output the result (bottom, area, top) to the device specified in (d) and later.
768
769 -[DZCP (s1) (s2) (s3) (d)]
770
771 **Content, range and data type**
772
773 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
774 |(s1)|The comparison value data of low limit or the device that stores the comparison value data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
775 |(s2)|The comparison value data of high limit or the device that stores the comparison value data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
776 |(s3)|Comparison source data or the device that stores the comparison source data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
777 |(d)|The start bit device of output comparison result| |Bit|ANYBIT_ARRAY
778
779 **Device used**
780
781 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
782 **Pulse**
783
784 **extension**
785 )))
786 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
787 |(% rowspan="4" %)DZCP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
788 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
789 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
790 |Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
791
792 **Features**
793
794 • Compare the BIN 32-bit data of the device specified in (s1) and the value (bandwidth) of the BIN 32-bit data of the device specified in (s2) with the BIN 32-bit data of the device specified in the comparison source (s3) , According to the result (bottom, area, top), one of (d), (d)+1, (d)+2 will be turned ON. (s1), (s2), (s3) are treated as BIN values within the above-mentioned setting data range. Use algebraic methods for size comparison.
795
796 • Use algebraic methods for size comparison.
797
798 (% style="text-align:center" %)
799 [[image:图片2.png]]
800
801
802 (1): Even if the instruction input is OFF and the ZCP instruction is not executed, (d) to (d)+2 will keep the state before the instruction input turns from ON to OFF.
803
804 (% class="box infomessage" %)
805 (((
806 **✎Note: **
807
808 • Please set the lower comparison value (s1) to a value smaller than the upper comparison value (s2).
809
810 • When (s1) is greater than (s2), it will be processed as (s2)=(s1).
811
812 • The device specified in 3 points (d) is occupied at the beginning. Please be careful not to overlap with other control devices.
813 )))
814
815 **Error code**
816
817 |=**Error code**|=**Content**
818 |4085H|The output results of (s1), (s2) and (s3) in the read application instruction exceed the device range
819 |4086H|The output results of (d) in the write application instruction exceeds the device range
820
821 **Example**
822
823 (% style="text-align:center" %)
824 [[image:1708593992672-738.png]]
825
826 When M0 is set, compare D0 with whether it is between 0 and 100000:
827
828 If (D0)> (100000), then Y0 is ON.
829
830 If (0) ≤ (D0) ≤ (100000), then Y1 is ON.
831
832 If (D0) <(0), then Y2 is ON.
833
834 = Cycle Shift instruction =
835
836 == ROR/16-bit Cycle Shift Right ==
837
838 **ROR(P)**
839
840 Shift the 16-bit data of the device specified in (d) to the right by (n) bits without including the carry flag.
841
842 -[ROR  (d) (n)]
843
844 **Content, range and data type**
845
846 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
847 |(d)|The device start number for cycle shift right|-|Signed BIN 16 bit|ANY16
848 |(n)|The number of times to cycle shift right|0 to 15|Signed BIN 16 bit|ANY16
849
850 **Device used**
851
852 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
853 **Pulse**
854
855 **extension**
856 )))
857 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
858 |(% rowspan="2" %)ROR|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
859 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
860
861 **Features**
862
863 ・The 16-bit data of the device specified in (d) is shifted right by (n) bits without including the carry flag. The carry flag is in the ON or OFF state according to the state before the ROR(P) is executed.
864
865 (% style="text-align:center" %)
866 [[image:图片3.png]]
867
868
869 (n) Specifies 0 to 15. When a value of 16 or more is specified in (n), the remainder value of (n)÷16 is shifted to the right. For example, when (n)=18, 18÷16=1 and the remainder is 2, so a 2-bit right shift is performed.
870
871 **Related device**
872
873 |=**Device**|=**Name**|=**Content**
874 |SM151|Carry|It turns ON when the last bit shifted from the lowest is 1.
875
876 (% class="box infomessage" %)
877 (((
878 **✎Note:**
879
880 * Do not set the number of digits (n) shifted right to a negative value.
881 * In the case of continuous execution type instructions (ROR, RCR), the right shift will be executed every scan time (operation cycle), so be careful.
882 * When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
883 )))
884
885 **Error code**
886
887 |=**Error code**|=**Content**
888 |4084H|A negative value is specified in (n).
889 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
890 |4086H|The output result of (d) in the write application instruction exceeds the device range
891
892 **Example**
893
894 (% style="text-align:center" %)
895 [[image:1708594252328-359.png]]
896
897 Shift the 1 in the D0 device by 3 bits to the right to get 8192.
898
899 == DROR/32-bit Cycle Shift Right ==
900
901 **DROR(P)**
902
903 Shift the 32-bit data of the device specified in (d) to the right by (n) bits without including the carry flag.
904
905 -[DROR (d)  (n)]
906
907 **Content, range and data type**
908
909 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
910 |(d)|The device start number for cycle shift right|-|Signed BIN 32 bit|ANY32
911 |(n)|The number of times to cycle shift right|0 to 31|Signed BIN 32 bit|ANY32
912
913 **Device used**
914
915 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
916 **Pulse**
917
918 **extension**
919 )))
920 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
921 |(% rowspan="2" %)DROR|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
922 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
923
924 **Features**
925
926 ・The 32-bit data of the device specified in (d) is shifted right by (n) bits without including the carry flag. The carry flag is on or off according to the state before DROR(P) is executed.
927
928 (% style="text-align:center" %)
929 [[image:图片4.png]]
930
931 (n) Specifies 0 to 31. When a value of 32 or more is specified in (n), the remainder of (n)÷32 is shifted to the right. For example, when (n)=34, 34÷32=1 and the remainder is 2, so a 2-bit right shift is performed.
932
933 **Related device**
934
935 |**Device**|**Name**|**Content**
936 |SM151|Carry|It turns ON when the last bit shifted from the lowest is 1.
937
938 (% class="box infomessage" %)
939 (((
940 **✎Note:**
941
942 * Do not set the number of digits (n) shifted to the left to a negative value.
943 * In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
944 )))
945
946 **Error code**
947
948 |=**Error code**|=**Content**
949 |4084H|A negative value is specified in (n).
950 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
951 |4086H|The output result of (d) in the write application instruction exceeds the device range
952
953 **~ Example**
954
955 (% style="text-align:center" %)
956 [[image:图片12.png]]
957
958 After the rising edge of M1 is triggered, the value 32 of the D0 device is shifted right by 3 bits to get 4.
959
960 == RCL/16-bit Cycle Shift Left with Carry ==
961
962 **RCL(P)**
963
964 Shift the 16-bit data of the device specified in (d) to the left by (n) bits with the carry flag included.
965
966 -[RCL  (d)  (n)]
967
968 **Content, range and data type**
969
970 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
971 |(d)|The device start number for cycle shift left|-|Signed BIN 16 bit|ANY16
972 |(n)|The number of times to cycle shift left|0 to 15|Signed BIN 16 bit|ANY16
973
974 **Device used**
975
976 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
977 **Index**
978
979 **modification**
980 )))|=(((
981 **Pulse**
982
983 **extension**
984 )))
985 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
986 |(% rowspan="2" %)RCL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
987 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
988
989 **Features**
990
991 Shift the BIN 16-bit data of the device specified in (d) to the right by (n) bits with the carry flag included. The carry flag is on or off according to the state before the RCR(P) is executed.
992
993 (% style="text-align:center" %)
994 [[image:图片11.png]]
995
996
997 (n) Specifies 0 to 15. When a value of 16 or more is specified in (n), the remainder value of (n)÷16 is shifted to the left. For example, when (n)=18, 18÷16=1 and the remainder is 2, so a 2-bit left shift is performed.
998
999 **Related device**
1000
1001 |=**Device**|=**Name**|=**Content**
1002 |SM151|Carry|It turns ON when the last bit shifted from the highest is 1.
1003
1004 (% class="box infomessage" %)
1005 (((
1006 **✎Note: **
1007
1008 * Do not set the number of digits (n) shifted to the left to a negative value.
1009 * In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful.
1010 * When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
1011 )))
1012
1013 **Error code**
1014
1015 |=**Error code**|=**Content**
1016 |4084H|A negative value is specified in (n).
1017 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1018 |4086H|The output result of (d) in thewrite application instruction exceeds the device range
1019
1020 **Example**
1021
1022 (% style="text-align:center" %)
1023 [[image:图片13.png]]
1024
1025 After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1.When M1=ON, the value in the D0 device is shifted right by 4 bits to get 12288.
1026
1027 == DRCR/32-bit Cycle Shift Right with Carry ==
1028
1029 **DRCR(P)**
1030
1031 Shift the 32-bit data of the device specified in (d) to the right by (n) bits with the carry flag included.
1032
1033 -[DRCR  (d)  (n)]
1034
1035 **Content, range and data type**
1036
1037 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1038 |(d)|The device start number for cycle shift right|-|Signed BIN 32 bit|ANY32
1039 |(n)|The number of times to cycle shift right|0 to 31|Signed BIN 32 bit|ANY32
1040
1041 **Device used**
1042
1043 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
1044 **Pulse**
1045
1046 **extension**
1047 )))
1048 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1049 |(% rowspan="2" %)DRCR|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
1050 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
1051
1052 **Features**
1053
1054 ・The BIN 32-bit data of the device specified in (d) is shifted right by (n) bits with the carry flag included. The carry flag is in the ON or OFF state according to the state before DRCR(P) is executed.
1055
1056 (% style="text-align:center" %)
1057 [[image:图片1.png]]
1058
1059 (n) Specifies 0 to 31. When a value of 32 or more is specified in (n), the remainder value of (n)÷32 is shifted to the right. For example, when (n)=34, 34÷32=1 and the remainder is 2, so a 2-bit right shift is performed.
1060
1061 **Related device**
1062
1063 |=**Devices**|=**Name**|=**Content**
1064 |SM151|Carry|It turns ON when the last bit shifted from the lowest is 1.
1065
1066 (% class="box infomessage" %)
1067 (((
1068 **✎Note: **
1069
1070 * Do not set the number of bits (n) to turn right to a negative value.
1071 * In the case of continuous execution type instructions (DROR, DRCR), the right shift will be executed every scan time (operation cycle), so be careful.
1072 * When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
1073 )))
1074
1075 **Error code**
1076
1077 |=**Error code**|=**Content**
1078 |4084H|A negative value is specified in (n).
1079 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1080 |4086H|The output result of (d) in the write application instruction exceeds the device range
1081
1082 **Example**
1083
1084 (% style="text-align:center" %)
1085 [[image:图片2.png]]
1086
1087 After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1. When M1=ON, the value in the D0 device is shifted.
1088
1089 == ROL/16-bit Cycle Shift Left ==
1090
1091 **ROL(P)**
1092
1093 Shift the 16-bit data of the device specified in (d) to the left by (n) bits without including the carry flag.
1094
1095 -[ROL (d)  (n)]
1096
1097 **Content, range and data type**
1098
1099 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1100 |(d)|The device start number for cycle shift left|-|Signed BIN 16 bit|ANY16
1101 |(n)|The number of times to cycle shift left|0 to 15|Signed BIN 16 bit|ANY16
1102
1103 **Device used**
1104
1105 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
1106 **Pulse**
1107
1108 **extension**
1109 )))
1110 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1111 |(% rowspan="2" %)ROL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1112 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1113
1114 **Features**
1115
1116 ・The 16-bit data of the device specified in (d) is shifted to the left by (n) bits without including the carry flag. The carry flag is in the ON or OFF state according to the state before ROL(P) is executed.
1117
1118 (% style="text-align:center" %)
1119 [[image:图片3.png]]
1120
1121 (n) Specify 0 to 15. When a value of 16 or more is specified in (n), the remainder value of (n)÷16 is shifted to the left. For example, when (n)=18, 18÷16=1 and the remainder is 2, so a 2-bit left shift is performed.
1122
1123 **Related device**
1124
1125 |=**Device**|=**Name**|=**Content**
1126 |SM151|Carry|It turns ON when the last bit shifted from the highest is 1.
1127
1128 (% class="box infomessage" %)
1129 (((
1130 **✎Note: **
1131
1132 Do not set the number of digits (n) shifted to the left to a negative value. In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
1133 )))
1134
1135 **Error code**
1136
1137 |=**Error code**|=**Content**
1138 |4084H|A negative value is specified in (n).
1139 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1140 |4086H|The output result of (d) in the write application instruction exceeds the device range
1141
1142 **Example**
1143
1144 (% style="text-align:center" %)
1145 [[image:图片4.png]]
1146
1147 Shift 1 in the D0 device to the left by 3 bits to get 8.
1148
1149 == DROL/32-bit Cycle Shift Left ==
1150
1151 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml1960\wps1.png]][[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml1960\wps2.png]]**DROL(P)**
1152
1153 Shift the 32-bit data of the device specified in (d) to the left by (n) bits without including the carry flag.
1154
1155 -[DROL  (d) (n)]
1156
1157 **Content, range and data type**
1158
1159 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1160 |(d)|The device start number for cycle shift left|-|Signed BIN 32 bit|ANY32
1161 |(n)|The number of times to cycle shift left|0 to 31|Signed BIN 32 bit|ANY32
1162
1163 **Device used**
1164
1165 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1166 **Index**
1167
1168 **modification**
1169 )))|=(((
1170 **Pulse**
1171
1172 **extension**
1173 )))
1174 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1175 |(% rowspan="2" %)DROL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
1176 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
1177
1178 **Features**
1179
1180 ・The 32-bit data of the device specified in (d) is shifted left by (n) bits without including the carry flag. The carry flag is on or off according to the state before DROL(P) is executed.
1181
1182 (% style="text-align:center" %)
1183 [[image:图片5.png]]
1184
1185 (n) Specifies 0 to 31. When a value of 32 or more is specified in (n), the remainder of (n)÷32 is shifted to the left. For example, when (n)=34, 34÷32=1 and the remainder is 2, so a 2-bit left shift is performed.
1186
1187 **Related device**
1188
1189 |=**Device**|=**Name**|=**Content**
1190 |SM151|Carry|It turns ON when the last bit shifted from the highest is 1.
1191
1192 (% class="box infomessage" %)
1193 (((
1194 **✎Note: **
1195
1196 * Do not set the number of digits (n) shifted to the left to a negative value.
1197 * In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
1198 )))
1199
1200 **Error code**
1201
1202 |=**Error code**|=**Content**
1203 |4084H|A negative value is specified in (n).
1204 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1205 |4086H|The output result of (d) in the write application instruction exceeds the device range
1206
1207 **~ Example**
1208
1209 (% style="text-align:center" %)
1210 [[image:图片6.png]]
1211
1212 Shift 1 in the D0 device to the left by 3 bits to get 8.
1213
1214 == RCL/16-bit Cycle Shift Left with Carry ==
1215
1216 **RCL(P)**
1217
1218 Shift the 16-bit data of the device specified in (d) to the left by (n) bits with the carry flag included.
1219
1220 -[RCL  (d)  (n)]
1221
1222 **Content, range and data type**
1223
1224 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1225 |(d)|The device start number for cycle shift left|-|Signed BIN 16 bit|ANY16
1226 |(n)|The number of times to cycle shift left|0 to 15|Signed BIN 16 bit|ANY16
1227
1228 **Device used**
1229
1230 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1231 **Index**
1232
1233 **modification**
1234 )))|=(((
1235 **Pulse**
1236
1237 **extension**
1238 )))
1239 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1240 |(% rowspan="2" %)RCL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1241 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1242
1243 **Features**
1244
1245 ・The 16-bit data of the device specified in (d) is shifted (n) to the left with the carry flag included. The carry flag is on or off according to the state before RCL(P) is executed.
1246
1247 (% style="text-align:center" %)
1248 [[image:图片7.png]]
1249
1250 (n) Specifies 0 to 15. When a value of 16 or more is specified in (n), the remainder value of (n)÷16 is shifted to the left. For example, when (n)=18, 18÷16=1 and the remainder is 2, so a 2-bit left shift is performed.
1251
1252 **Related device**
1253
1254 |=**Device**|=**Name**|=**Content**
1255 |SM151|Carry|It turns ON when the last bit shifted from the highest is 1.
1256
1257 1. (((
1258 **✎Note: **
1259
1260 Do not set the number of digits (n) shifted to the left to a negative value. In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
1261 )))
1262
1263 **Error code**
1264
1265 |=**Error code**|=**Content**
1266 |4084H|A negative value is specified in (n).
1267 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1268 |4086H|The output result of (d) in the write application instruction exceeds the device range
1269
1270 **Example**
1271
1272 (% style="text-align:center" %)
1273 [[image:图片8.png]]
1274
1275 After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1.
1276
1277 == DRCL/32-bit Cycle Shift Left with Carry ==
1278
1279 **DRCL(P)**
1280
1281 Move the 32-bit data of the device specified in (d) to the left by (n) bits with the carry flag included.
1282
1283 -[DRCL (d) (n)]
1284
1285 **Content, range and data type**
1286
1287 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1288 |(d)|The device start number for cycle shift left|-|Signed BIN 32 bit|ANY32
1289 |(n)|The number of times to cycle shift left|0 to 31|Signed BIN 32 bit|ANY32
1290
1291 **Device used**
1292
1293 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1294 **Index**
1295
1296 **modification**
1297 )))|=(((
1298 **Pulse**
1299
1300 **extension**
1301 )))
1302 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1303 |(% rowspan="2" %)DRCL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
1304 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
1305
1306 **Features**
1307
1308 The 32-bit data of the device specified in (d) is shifted (n) to the left with the carry flag included. The carry flag is on or off according to the state before RCL(P) is executed.
1309
1310 (% style="text-align:center" %)
1311 [[image:图片9.png]]
1312
1313 (n) Specifies 0 to 31. When a value of 32 or more is specified in (n), the remainder of (n)÷32 is shifted to the left. For example, when (n)=34, 34÷32=1 and the remainder is 2, so a 2-bit left shift is performed.
1314
1315 **Related device**
1316
1317 |=**Devices**|=**Name**|=**Content**
1318 |SM151|Carry|Turns ON when the last bit shifted from the highest is 1.
1319
1320 (% class="box infomessage" %)
1321 (((
1322 **✎Note: **Do not set the number of digits (n) shifted to the left to a negative value. In the case of continuous execution type instructions (ROL, RCL), the shift to the left will be executed every scan time (operation cycle), so be careful. When specifying the number of digits to specify the device in (d), only K4 (16-bit instruction) or K8 (32-bit instruction) is valid. (For example, K4Y10, K8M0).
1323 )))
1324
1325 **Error code**
1326
1327 |=**Error code**|=**Content**
1328 |4084H|A negative value is specified in (n).
1329 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1330 |4086H|The output result of (d) in the write application instruction exceeds the device range
1331
1332 (% style="text-align:center" %)
1333 [[image:图片11.png]]
1334
1335 After the rising edge of M0 is triggered, the carry flag SM151 turns ON, and D0 is assigned the value 1. When M1=ON, carry the value in the D0 device to the left by 4 bits to get 24.
1336
1337 == SFTR/n-bit Shift Right of n-bit Data ==
1338
1339 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml1960\wps3.png]]**SFTR(P)**
1340
1341 Shift (n2) the data of the start (n1) bits of the device specified in (d) to the right.
1342
1343 -[SFTR (s)  (d) (n1)  (n2)]
1344
1345 **Content, range and data type**
1346
1347 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1348 |(s)|The start number of the device storing the shifted data after shifting|-|Bit|ANY_BOOL
1349 |(d)|The shifted device start number |-|Bit|ANY_BOOL
1350 |(n1)|The length of shifted data|0 to 32767|Signed BIN 16 bit|ANY16
1351 |(n2)|Number of shifts|0 to 32767|Signed BIN 16 bit|ANY16
1352
1353 **Device used**
1354
1355 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1356 **Index**
1357
1358 **modification**
1359 )))|=(((
1360 **Pulse**
1361
1362 **extension**
1363 )))
1364 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1365 |(% rowspan="3" %)SFTR|Parameter 1|●|●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
1366 |Parameter 2| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
1367 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1368 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1369
1370 **Features**
1371
1372 Shift (n2) the data of the start (n1) bits of the device specified in (d) to the right. After shifting, the point (n2) starting from (s) is transferred to the point (n2) starting from (d) + (n1 to n2).
1373
1374 When K0 is specified in (s), the bit of the (d) + (n1 to n2) starting point (n2) after the shift is set to 0.
1375
1376 When K1 is specified in (s), the bit of the (d) + (n1 to n2) starting point (n2) after the shift is set to 1.
1377
1378 (% style="text-align:center" %)
1379 [[image:图片13.png]]
1380
1381 (1): When (s)=K0, it becomes 0.
1382
1383 **Error code**
1384
1385 |=**Error code**|=**Content**
1386 |(% rowspan="2" %)4084H|When the value specified in (n1) and (n2) exceeds the range of 0 to 32767
1387 |When the value specified in (n1) and (n2) is (n1)<(n2)
1388 |4085H|When the device specified in read application instructions (s), (d), (n1) and (n2) exceeds the corresponding device range
1389 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
1390
1391 **Example**
1392
1393 For n1=9 bits (the length of the shift register) data starting with M0, right shift n2=3 bits. After shifting, transfer n2=3 bits from Y0 to n2=3 bits from M6.
1394
1395 (% style="text-align:center" %)
1396 [[image:图片14.png]]
1397
1398 (% style="text-align:center" %)
1399 [[image:图片15.png]]
1400
1401 == SFTL/n-bit Shift Left of n-bit Data ==
1402
1403 **SFTL(P)**
1404
1405 Shift the start (n1) bit data of the device specified in (d) to the left by (n2) bits.
1406
1407 -[SFTL   (s)  (d) (n1)  (n2)]
1408
1409 **Content, range and data type**
1410
1411 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1412 |(s)|The start number of the device storing shifted data after shifting|-|Bit|ANY_BOOL
1413 |(d)|The shifted device start number|-|Bit|ANY_BOOL
1414 |(n1)|The length of shifted data|0 to 32767|Signed BIN 16 bit|ANY16
1415 |(n2)|Number of shifts|0 to 32767|Signed BIN 16 bit|ANY16
1416
1417 **Device used**
1418
1419 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1420 **Index**
1421
1422 **modification**
1423 )))|=(((
1424 **Pulse**
1425
1426 **extension**
1427 )))
1428 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1429 |(% rowspan="3" %)SFTL|Parameter 1|●|●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
1430 |Parameter 2| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
1431 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1432 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1433
1434 **Features**
1435
1436 Shift (n2) bits of the data at the beginning (n1) bits of the device specified in (d). After shifting, the point (n2) starting from (s) is transferred to the point (n2) starting from (d) + (n1 to n2).
1437
1438 When K0 is specified in (s), the bit of the (d) + (n1 to n2) starting point (n2) after the shift is set to 0.
1439
1440 When K1 is specified in (s), the bit of the (d) + (n1 to n2) starting point (n2) after the shift is set to 1.
1441
1442 (% style="text-align:center" %)
1443 [[image:图片16.png]]
1444
1445 (1): When (s)=K0, it becomes 0.
1446
1447 **Error code**
1448
1449 |**Error code**|**Content**
1450 |(% rowspan="2" %)4084H|When the value specified in (n1) and (n2) exceeds the range of 0 to 32767
1451 |When the value specified in (n1) and (n2) is (n1)<(n2)
1452 |4085H|When the device specified in read application instructions (s), (d), (n1) and (n2) exceeds the corresponding device range
1453 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
1454
1455 **Example**
1456
1457 (% style="text-align:center" %)
1458 [[image:图片17.png]]
1459
1460
1461 (% style="text-align:center" %)
1462 [[image:图片18.png]]
1463
1464 = WSFR/n-word Shift Right of n-word Data =
1465
1466 **WSFR(P)**
1467
1468 Shift (n2) the data of the start (n1) bits of the device specified in (d) to the right.
1469
1470 -[WSFR (s)  (d)  (n1) (n2)]
1471
1472 **Content, range and data type**
1473
1474 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1475 |(s)|The start number of the device storing shifted data after shifting|-|word|ANY_BOOL
1476 |(d)|The shifted device start number|-|word|ANY_BOOL
1477 |(n1)|The length of shifted data|0 to 32767|Signed BIN 16 bit|ANY16
1478 |(n2)|Number of shifts|0 to 32767|Signed BIN 16 bit|ANY16
1479
1480 **Device used**
1481
1482 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1483 **Index**
1484
1485 **modification**
1486 )))|=(((
1487 **Pulse**
1488
1489 **extension**
1490 )))
1491 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1492 |(% rowspan="3" %)SFTR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1493 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1494 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1495 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1496
1497 **Features**
1498
1499 Shift (n2) the data of the beginning (n1) word of the device specified in (d) to the right. After shifting, the point (n2) starting from (s) is transferred to the point (n2) starting from (d) + (n1 to n2).
1500
1501 When K is specified in (s), the device at (d) + (n1 to n2) starting (n2) point after shifting is set to the specified value.
1502
1503 If the value specified in (n1) or (n2) is 0, it will be no processing.
1504
1505 (% style="text-align:center" %)
1506 [[image:图片19.png]]
1507
1508 **Error code**
1509
1510 |=**Error code**|=**Content**
1511 |(% rowspan="3" %)4084H|When the value specified in (n1) and (n2) exceeds the range of 0 to 32767
1512 |When the value specified in (n1) and (n2) is (n1)<(n2)
1513 |When (s) and (d) both specify KnM, KnX, and KnS, the value of n varies.
1514 |4085H|When the device specified in read application instructions (s), (d), (n1) and (n2) exceeds the corresponding device range
1515 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
1516
1517 **Example**
1518
1519 (% style="text-align:center" %)
1520 [[image:图片20.png]]
1521
1522 (% style="text-align:center" %)
1523 [[image:图片21.png]]
1524
1525 (s) and (d) specify the same multiple in the digit specified device. This program realizes to shift Y0 to Y7 bits right, shift Y10 to Y17 right to Y0 to Y7, and then store X0 to X7 to Y10 to Y17.
1526
1527 == WSFL/n-word Shift Left of n-word Data ==
1528
1529 **WSFL(P)**
1530
1531 Shift the start (n1) bit data of the device specified in (d) to the left by (n2) bits.
1532
1533 -[WSFL (s)  (d)  (n1) (n2)]
1534
1535 **Content, range and data type**
1536
1537 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1538 |(s)|The start number of the device storing shifted data after shifting|-|Word|ANY_BOOL
1539 |(d)|The shifted device start number|-|Word|ANY_BOOL
1540 |(n1)|The length of shifted data|0 to 32767|Signed BIN 16 bit|ANY16
1541 |(n2)|Number of shifts|0 to 32767|Signed BIN 16 bit|ANY16
1542
1543 **Device used**
1544
1545 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1546 **Index**
1547
1548 **modification**
1549 )))|=(((
1550 **Pulse**
1551
1552 **extension**
1553 )))
1554 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1555 |(% rowspan="3" %)SFTR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1556 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1557 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1558 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1559
1560 **Features**
1561
1562 Shift (n2) the data of the beginning (n1) word of the device specified in (d) to the left. After shifting, transfer the point (n2) starting from (s) to the point (n2) starting from (d).
1563
1564 When K is specified in (s), the device at (d) + (n1 to n2) starting (n2) point after shifting is set to the specified value.
1565
1566 If the value specified in (n1) or (n2) is 0, it will be no processing.
1567
1568 (% style="text-align:center" %)
1569 [[image:图片22.png]]
1570
1571 **Error Code**
1572
1573 |=**Error code**|=**Content**
1574 |(% rowspan="3" %)4084H|When the value specified in (n1) and (n2) exceeds the range of 0 to 32767
1575 |When the value specified in (n1) and (n2) is (n1)<(n2)
1576 |When (s) and (d) both specify KnM, KnX, and KnS, the value of n varies.
1577 |4085H|When the device specified in read application instructions (s), (d), (n1) and (n2) exceeds the corresponding device range
1578 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
1579
1580 **Example**
1581
1582 (% style="text-align:center" %)
1583 [[image:图片23.png]]
1584
1585 (S), (d) Do the same multiple specification in the digit specification device. This program realizes to remove the high bits of Y10 to Y17 left, move Y0 to Y7 left to Y10 to Y17, and then store X0 to X7 to Y0 to Y7.
1586
1587 == SFR/n-bit Shift Right of 16-bit Data ==
1588
1589 **SFR(P)**
1590
1591 Shift the 16-bit data of the device specified in (d) right by (n) bits.
1592
1593 -[SFR  (d) (n)]
1594
1595 **Content, range and data type**
1596
1597 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1598 |=(d)|The start number of the device storing the shifted data|-|Signed BIN 16 bit|ANY16
1599 |=(n)|Number of shifts|0-15|Signed BIN 16 bit|ANY16
1600
1601 **Device used**
1602
1603 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1604 **Index**
1605
1606 **modification**
1607 )))|=(((
1608 **Pulse**
1609
1610 **extension**
1611 )))
1612 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1613 |(% rowspan="2" %)SFR|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1614 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1615
1616 **Features**
1617
1618 (% style="text-align:center" %)
1619 [[image:图片24.png]]
1620
1621
1622
1623 (% style="text-align:center" %)
1624 [[image:图片25.png]]
1625
1626 When (N)=6
1627
1628 Shift the 16-bit data of the device specified in (d) to the right (n) bits from the highest bit. The (n) bit from the most significant bit will become 0.
1629
1630 When (N)=6
1631
1632 When a bit device is specified in (d), the device range specified in the digit specification is shifted to the right.
1633
1634 (n) Specifies 0 to 15. When a value of 16 or more is specified in (n), the remainder of (n)÷16 is shifted to the left. For example, when (n)=18, 18÷16=1 and the remainder 2, so it is shifted by 2 bits to the right.
1635
1636 **Related device **
1637
1638 |=**Device**|=**Name**|=**Content**
1639 |=SM151|Carry|Set to ON/OFF according to the state of n-1 bit (1/0)
1640
1641 **Error code**
1642
1643 |=**Error code**|=**Content**
1644 |=4084H|A negative value is specified in (n).
1645 |=4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1646 |=4086H|The output result of (d) in the write application instruction exceeds the device range
1647
1648 **Example**
1649
1650 (% style="text-align:center" %)
1651 [[image:图片26.png]]
1652
1653 (% style="text-align:center" %)
1654 [[image:图片27.png]]
1655
1656 When M1 is ON, the contents of Y10 to Y23 are shifted to the right by the number of digits specified in D0.
1657
1658 == DSFR/n word Data Shift Right by 1 Word ==
1659
1660 **DSFR(P)**
1661
1662 Shift the data at the start (n) point of the device specified in (d) to the right by 1 word.
1663
1664 -[DSFR (d)   (n)]
1665
1666 **Content, range and data type**
1667
1668 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1669 |=(d)|The start number of the device storing the shifted data|-|Signed BIN 16 bit|-
1670 |=(n)|Number of shifts|0 to 32767|Signed BIN 16 bit|INT
1671
1672 **Device used**
1673
1674 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1675 **Index**
1676
1677 **modification**
1678 )))|=(((
1679 **Pulse**
1680
1681 **extension**
1682 )))
1683 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1684 |(% rowspan="2" %)DSFR|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1685 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1686
1687 **Features**
1688
1689 • Shift the data at the start (n) point of the device specified in (d) by 1 word to the right.
1690
1691 (% style="text-align:center" %)
1692 [[image:图片28.png]]
1693
1694 • The device specified in (d)+(n-1) will become 0.
1695
1696 (% class="box infomessage" %)
1697 (((
1698 **✎Note: **
1699 In (d), when specifying the device number by specifying the number of bits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits. When the number of bits is not K4, K4 is used for processing.
1700 )))
1701
1702 **Error code**
1703
1704 |=**Error code**|=**Content**
1705 |=4084H|When the value specified in (n) exceeds the range of 0 to 32767
1706 |=4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1707 |=4086H|The output result of (d) in the write application instruction exceeds the device range
1708
1709 **Example**
1710
1711 When M1 is ON, shift the contents of D0 to D4 to the right by 1 word (D1→D0, D2→D1, D3→D2, D4→D3, D4 is set to 0).
1712
1713 (% style="text-align:center" %)
1714 [[image:图片29.png]]
1715
1716 Before execution:
1717
1718 (% style="text-align:center" %)
1719 [[image:图片30.png]]
1720
1721 After execution:
1722
1723 (% style="text-align:center" %)
1724 [[image:图片31.png]]
1725
1726 == SFL/n-bit Shift Left of 16-bit Data ==
1727
1728 **SFL(P)**
1729
1730 Shift the 16-bit data of the device specified in (d) to the left by (n) bits.
1731
1732 -[SFL (d) (n)]
1733
1734 **Content, range and data type**
1735
1736 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1737 |=(d)|The start number of the device storing the shifted data|-|Signed BIN 16 bit|ANY16
1738 |=(n)|Number of shifts|0 to 15|Signed BIN 16 bit|ANY16
1739
1740 **Device used**
1741
1742 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1743 **Index**
1744
1745 **modification**
1746 )))|=(((
1747 **Pulse**
1748
1749 **extension**
1750 )))
1751 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1752 |(% rowspan="2" %)SFL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1753 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1754
1755 **Features**
1756
1757 Shift the 16-bit data of the device specified in (d) to the left (n) bits from the lowest bit. The (n) bit from the lowest bit will become 0.
1758
1759 (% style="text-align:center" %)
1760 [[image:图片32.png]]
1761
1762 When (n)=8, it is as follows.
1763
1764 When a bit device is specified in (d), the left shift is performed in the device range specified in the digit specification.
1765
1766 (% style="text-align:center" %)
1767 [[image:图片33.png]]
1768
1769 When (n)=3, it is as follows.
1770
1771 (n) Specify 0 to 15. When a value of 16 or more is specified in (n), the remainder of (n)÷16 is shifted to the left. For example, when (n)=18, 18÷16=1 remainder 2, so it is shifted by 2 bits to the left.
1772
1773 **Related device **
1774
1775 |=**Device**|=**Name**|=**Content**
1776 |SM151|Carry|Turn ON/OFF according to the state of n+1 bit (1/0)
1777
1778 **Error code**
1779
1780 |=**Error code**|=**Content**
1781 |=4084H|A negative value is specified in (n).
1782 |=4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1783 |=4086H|The output result of (d) in the write application instruction exceeds the device range
1784
1785 **Example: **When M1 is ON, the contents of Y10 to Y17 are shifted to the left by the number of digits specified in D0.
1786
1787 (% style="text-align:center" %)
1788 [[image:图片34.png]]
1789
1790 (% style="text-align:center" %)
1791 [[image:图片35.png]]
1792
1793 == DSFL/one Word Shift Left of n Word Data ==
1794
1795 **DSFL(P)**
1796
1797 Move the data at the beginning (n) point of the device specified in (d) by 1 word to the left.
1798
1799 -[DSFL (d) (n)]
1800
1801 **Content, range and data type**
1802
1803 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1804 |=(d)|The start number of the device storing the shifted data|-|Signed BIN 16 bit|-
1805 |=(n)|Number of shifts|0 to 32,767|Signed BIN 16 bit|INT
1806
1807 **Device used**
1808
1809 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1810 **Index**
1811
1812 **modification**
1813 )))|=(((
1814 **Pulse**
1815
1816 **extension**
1817 )))
1818 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1819 |(% rowspan="2" %)DSFL|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1820 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1821
1822 **Features**
1823
1824 Shift the data at the start (n) point of the device specified in (d) to the left by 1 word.
1825
1826 The device specified in (d) will become 0.
1827
1828 (% class="box infomessage" %)
1829 (((
1830 **✎Note: **
1831 In (d), when specifying the device number by specifying the number of bits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits. When the number of bits is not K4, K4 is used for processing.
1832 )))
1833
1834 **Error code**
1835
1836 |**Error code**|**Content**
1837 |4084H|When the value specified in (n) exceeds the range of 0 to 32,767
1838 |4085H|The output results of (d) and (n) in the read application instruction exceed the device range
1839 |4086H|The output result of (d) in the write application instruction exceeds the device range
1840
1841 **Example**
1842
1843 When M1 is ON, shift the contents of D0 to D4 to the left by 1 word (D3→D4, D2→D3, D1→D2, D0→D1, D0 is set to 0).
1844
1845 (% style="text-align:center" %)
1846 [[image:图片37.png]]
1847
1848 Before execution:
1849
1850 (% style="text-align:center" %)
1851 [[image:图片38.png]]
1852
1853 After execution:
1854
1855 (% style="text-align:center" %)
1856 [[image:图片39.png]]
1857
1858 = Arithmetic Operation instructions =
1859
1860 == **ADD/16-bit Addition Operation** ==
1861
1862
1863 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml1960\wps4.png]]**ADD(P)**
1864
1865 Add the BIN 16-bit data specified in (s1) and the BIN 16-bit data specified in (s2), and store the result in the device specified in (d).
1866
1867 -[ADD (s1)  (s2) (d)]
1868
1869 **Content, range and data type**
1870
1871 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1872 |=(s1)|Addition operation data or the device storing the addition data|-32768 to 32767|Signed BIN16|ANY16_S
1873 |=(s2)|Addition operation data or the device storing the addition data|-32768 to 32767|Signed BIN16|ANY16_S
1874 |=(d)|Device for storing operation results| |Signed BIN16|ANY16_S
1875
1876 **Device used**
1877
1878 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1879 **Index**
1880
1881 **modification**
1882 )))|=(((
1883 **Pulse**
1884
1885 **extension**
1886 )))
1887 |=**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1888 |=(% rowspan="3" %)ADD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1889 |=Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
1890 |=Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1891
1892 **Features**
1893
1894 Add the BIN 16-bit data specified in (s1) and the BIN 16-bit data specified in (s2), and store the result of the addition in the device specified in (d).
1895
1896 (% style="text-align:center" %)
1897 [[image:图片40.png]]
1898
1899 **Related device **
1900
1901 |=**Devices**|=**Name**|=**Content**
1902 |SM151|Carry|When the operation result exceeds 32,767, the carry flag will be (ON).
1903 |SM152|Borrow|When the operation result is less than -32,768, the borrow flag will be (ON).
1904 |SM153|Zero point|When the operation result is 0, the zero flag will be (ON).
1905
1906 (% style="text-align:center" %)
1907 [[image:图片41.png]]
1908
1909 (% class="box infomessage" %)
1910 (((
1911 **✎Note: **
1912
1913 * When the source operand and destination operand are specified as the same device:
1914
1915 The source operand and destination operand can also be specified as the same device number. In this case, if you use continuous execution instructions (ADD, DADD), the result of the addition operation will change every operation cycle.
1916
1917 * The difference between the ADD instruction and the INC instruction using the +1 addition operation program:
1918
1919 ADD[P] means that every time X001 changes from OFF to ON, the content of D0 is added by one operation.Although this instruction is very similar to the INCP instruction described later, there are some differences in the following content.
1920 )))
1921
1922
1923 |(% colspan="3" %) |**ADD/ADDP/DADD/DADDP instructions**|**INC/INCP/DINC/DINCP instructions**
1924 |(% colspan="3" %)**sign bit (zero, borrow, carry)**|**Action**|**No action**
1925 |(% rowspan="4" %)Calculation result|(% rowspan="2" %)(((
1926 16-bit
1927
1928 operation result
1929 )))|(S) + (+1) = (d)|32767 → 0 → +1 → +2 →|32767→-32768→-32767
1930 |(S) + (-1) = (d)|← -2 ← -1 ← 0 ← -32768|——
1931 |(% rowspan="2" %)(((
1932 1. bit
1933
1934 operation result
1935 )))|(S) + (+1) = (d)|2147483647 → 0 → +1 → +2 →|2147483647 → -2147483648→ -2147483647
1936 |(S) + (-1) = (d)|← -2 ← -1 ← 0 ← -2147483648|——
1937
1938 **Error code**
1939
1940 |=**Error code**|=**Content**
1941 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
1942 |=4086H|The output result of (d) in the write application instruction exceeds the device range
1943
1944 **Example**
1945
1946 (% style="text-align:center" %)
1947 [[image:图片42.png]]
1948
1949 Add 10 to the data in (D0), and store the operation result in (D2), that is, (D0) + 10 → (D2).
1950
1951 == **DADD/32-bit Addition Operation** ==
1952
1953
1954 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml1960\wps5.png]]**DADD(P)**
1955
1956 Add the BIN32-bit data specified in (s1) and the BIN32-bit data specified in (s2), and store the result in the device specified in (d).
1957
1958 -[DADD (s1) (s2)  (d)]
1959
1960 **Content, range and data type**
1961
1962 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
1963 |=(s1)|Addition data or the device storing the addition data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
1964 |=(s2)|Addition data or the device storing the addition data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
1965 |=(d)|Device for storing operation results| |Signed BIN32|ANY32_S
1966
1967 **Device used**
1968
1969 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
1970 **Index**
1971
1972 **modification**
1973 )))|=(((
1974 **Pulse**
1975
1976 **extension**
1977 )))
1978 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1979 |(% rowspan="3" %)DADD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
1980 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
1981 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
1982
1983 **Features**
1984
1985 Add the BIN32-bit data specified in (s1) and the BIN32-bit data specified in (s2), and store the result of the addition in the device specified in (d).
1986
1987 (% style="text-align:center" %)
1988 [[image:图片43.png]]
1989
1990 **Related device **
1991
1992 |=**Devices**|=**Name**|=**Content**
1993 |=SM151|Carry|When the operation result exceeds 32,767, the carry flag will be (ON).
1994 |=SM152|Borrow|When the operation result is less than -32,768, the borrow flag will be (ON).
1995 |=SM153|Zero point|When the operation result is 0, the zero flag will be (ON).
1996
1997 (% style="text-align:center" %)
1998 [[image:1708666795958-183.png]]
1999
2000 (% class="box infomessage" %)
2001 (((
2002 **✎Note: **
2003
2004 * When the source operand and destination operand are specified as the same device:
2005
2006 The source operand and destination operand can also be specified as the same device number.
2007
2008 In this case, if you use continuous execution instructions (ADD, DADD), the result of the addition operation will change every operation cycle. Please note.
2009
2010 * The difference between the ADD instruction and the INC instruction using the +1 addition operation program:
2011
2012 ADD[P] means that every time X001 changes from OFF to ON, the content of D0 is added by one operation.
2013
2014 Although this instruction is very similar to the INCP instruction described later, there are some differences in the following content.
2015 )))
2016
2017
2018 |=(% colspan="3" %) |=**ADD/ADDP/DADD/DADDP instructions**|=**INC/INCP/DINC/DINCP instructions**
2019 |(% colspan="3" %)**sign bit (zero, borrow, carry)**|**Action**|**No action**
2020 |(% rowspan="4" %)Calculation result|(% rowspan="2" %)(((
2021 1. bit
2022
2023 Operation result
2024 )))|(S) + (+1) = (d)|32767→0→+1→+2→|32767→-32768→-32767
2025 |(S) + (-1) = (d)|←-2←-1←0←-32768|——
2026 |(% rowspan="2" %)(((
2027 1. Bit
2028
2029 operation result
2030 )))|(S) + (+1) = (d)|2147483647→0→+1→+2→|2147483647→-2147483648→-2147483647
2031 |(S) + (-1) = (d)|←-2←-1←0←-2147483648|——
2032
2033 **Error code**
2034
2035 |=**Error code**|=**Content**
2036 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2037 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2038
2039 **Example**
2040
2041 (% style="text-align:center" %)
2042 [[image:1708666919232-341.png]]
2043
2044 Add 100000 to the data in (D1, D0), and store the result of the operation in (D3, D2), that is, (D1, D0) + 100000 → (D3, D2).
2045
2046 == SUB/16-bit Subtraction Operation ==
2047
2048 **SUB(P)**
2049
2050 Subtract the BIN 16-bit data specified in (s1) and the BIN 16-bit data specified in (s2), and store the result in the device specified in (d).
2051
2052 -[SUB (s1)  (s2)  (d)]
2053
2054 **Content, range and data type**
2055
2056 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
2057 |(s1)|The subtraction data or the device storing the subtraction data|-32768 to 32767|Signed BIN16|ANY16_S
2058 |(s2)|The subtraction data or the device storing the subtraction data|-32768 to 32767|Signed BIN16|ANY16_S
2059 |(d)|Device for storing calculation results| |Signed BIN16|ANY16_S
2060
2061 **Device used**
2062
2063 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2064 **Index**
2065
2066 **modification**
2067 )))|=(((
2068 **Pulse**
2069
2070 **extension**
2071 )))
2072 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2073 |(% rowspan="3" %)SUB|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2074 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2075 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
2076
2077 **Features**
2078
2079 Subtract the BIN 16-bit data specified in (s1) and the BIN 16-bit data specified in (s2), and store the result of the operation in the device specified in (d).
2080
2081 (% style="text-align:center" %)
2082 [[image:图片1.png]]
2083
2084 **Related device **
2085
2086 |**Devices**|**Name**|**Content**
2087 |SM151|Carry|When the operation result exceeds 32,767, the carry flag will be (ON).
2088 |SM152|Borrow|When the operation result is less than -32,768, the borrow flag will be (ON).
2089 |SM153|Zero point|When the operation result is 0, the zero flag will be (ON).
2090
2091 [[image:图片2.png]]
2092
2093 (% class="box infomessage" %)
2094 (((
2095 **✎Note: **
2096
2097 * When the source operand and destination operand are specified as the same device:
2098
2099 The source operand and destination operand can also be specified as the same device number.
2100
2101 In this case, if continuous execution type instructions (SUB, DSUB) are used, the result of the subtraction operation will change every operation cycle. Please be careful.
2102
2103 * The difference between the SUB(P) instruction and the -(P) instruction and DEC(P) instruction executed by the -1 subtraction program
2104
2105 SUB(P) instruction every time X1 changes from OFF to ON, the program of D0 content -1 is similar to -(P) instruction and DEC(P) instruction described later, but the following contents are different.
2106 )))
2107
2108 |=(% colspan="3" %) |=**SUB/SUBP/DSUB/DSUBP instructions**|=**DEC/DECP/DDEC/DDECP instructions**
2109 |(% colspan="3" %)**Sign bit (zero, borrow, carry)**|**Action**|**No action**
2110 |(% rowspan="4" %)Calculation result|(% rowspan="2" %)16-bit operation result|(S)-(+1)=(d)|←-2←-1←0←-32768|-32768→+32767→32766
2111 |(S)-(-1)=(d)|+32767→0→+1→+2→|——
2112 |(% rowspan="2" %)32-bit operation result|(S)-(+1)=(d)|←-2←-1←0←-2147483648|-2147483648→2147483647→2147483646
2113 |(S)-(-1)=(d)|2147483647→0→+1→+2→|——
2114
2115 **Error code**
2116
2117 |=**Error code**|=**Content**
2118 |4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2119 |4086H|The output result of (d) in the write application instruction exceeds the device range
2120
2121 **Example**
2122
2123
2124 (% style="text-align:center" %)
2125 [[image:图片3.png]]
2126
2127 Subtract 10 from the data in D0, and store the calculation result in D2, that is, (D0)-10 → (D2).
2128
2129 == DSUB/32-bit Subtraction Operation ==
2130
2131 **DSUB(P)**
2132
2133 Subtract the BIN32-bit data specified in (s1) and the BIN32-bit data specified in (s2), and store the result in the device specified in (d).
2134
2135 -[DSUB  (s1) (s2) (d)]
2136
2137 **Content, range and data type**
2138
2139 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2140 |(s1)|The subtraction data or the device storing the subtraction data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
2141 |(s2)|The subtraction data or the device storing the subtraction data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
2142 |(d)|Device for storing calculation results| |Signed BIN32|ANY32_S
2143
2144 **Device used**
2145
2146 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2147 **Index**
2148
2149 **modification**
2150 )))|=(((
2151 **Pulse**
2152
2153 **extension**
2154 )))
2155 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2156 |(% rowspan="3" %)DSUB|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2157 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2158 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2159
2160 **Features**
2161
2162 Subtract the BIN32-bit data specified in (s1) and the BIN32-bit data specified in (s2), and store the result of the operation in the device specified in (d).
2163
2164 (% style="text-align:center" %)
2165 [[image:图片4.png]]
2166
2167 Related device
2168
2169 |=**Devices**|=**Name**|=**Content**
2170 |SM151|Carry|When the operation result exceeds 2,147,483,647, the carry flag will be ON.
2171 |SM152|Borrow|When the operation result is less than -2,147,483,648, the borrow flag will be ON.
2172 |SM153|Zero point|When the operation result is 0, the zero flag will be ON.
2173
2174 (% style="text-align:center" %)
2175 [[image:图片5.png]]
2176
2177 (% class="box infomessage" %)
2178 (((
2179 **✎Note: **
2180
2181 * When the source operand and destination operand are specified as the same device:
2182
2183 The source operand and destination operand can also be specified as the same device number.
2184
2185 In this case, if continuous execution type instructions (SUB, DSUB) are used, the result of the subtraction operation will change every operation cycle. Please be careful.
2186
2187 * The difference between the SUB(P) instruction and the -(P) instruction and DEC(P) instruction executed by the -1 subtraction program
2188
2189 SUB(P) instruction every time X1 changes from OFF to ON, the program of D0 content -1 is similar to -(P) instruction and DEC(P) instruction described later, but the following contents are different.
2190 )))
2191
2192 |=(% colspan="3" %) |=**SUB/SUBP/DSUB/DSUBP instructions**|=**DEC/DECP/DDEC/DDECP instructions**
2193 |(% colspan="3" %)**Sign bit (zero, borrow, carry)**|**Action**|**No action**
2194 |(% rowspan="4" %)Calculation result|(% rowspan="2" %)16-bit operation result|(S)-(+1)=(d)|←-2←-1←0←-32768|-32768→32767→32766
2195 |(S)-(-1)=(d)|+32767→0→+1→+2→|——
2196 |(% rowspan="2" %)32-bit operation result|(S)-(+1)=(d)|←-2←-1←0←-2147483648|-2147483648→2147483647→2147483646
2197 |(S)-(-1)=(d)|+2147483647→0→+1→+2→|——
2198
2199 **Error code**
2200
2201 |=**Error code**|=**Content**
2202 |4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2203 |4086H|The output result of (d) in the write application instruction exceeds the device range
2204
2205 **Example**
2206
2207 (% style="text-align:center" %)
2208 [[image:图片6.png]]
2209
2210 Subtract 100000 from the data in (D1,D0), and store the result of the operation in (D3,D2), that is, (D1,D0)-10000 → (D3,D2).
2211
2212 == MUL/16-bit Multiplication ==
2213
2214 **MUL(P)**
2215
2216 Multiply the BIN16 bits specified in (s1) with the BIN16 bits specified in (s2), and store the result in the device specified in (d).
2217
2218 -[MUL (s1) (s2) (d)]
2219
2220 **Content, range and data type**
2221
2222 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2223 |(s1)|Multiplication operation data or the device storing multiplication operation data|-32768 to 32767|Signed BIN 16 bit|ANY16_S
2224 |(s2)|Multiplication operation data or the device storing multiplication operation data|-32768 to 32767|Signed BIN 16 bit|ANY16_S
2225 |(d)|Device for storing calculation results| |Signed BIN 32 bit|ANY32_S
2226
2227 **Device used**
2228
2229 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2230 **Index**
2231
2232 **modification**
2233 )))|=(((
2234 **Pulse**
2235
2236 **extension**
2237 )))
2238 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2239 |(% rowspan="3" %)MUL|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2240 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2241 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2242
2243 **Features**
2244
2245 Multiply the BIN 16-bit data specified in (s1) with the BIN 16-bit data specified in (s2), and store the result of the operation in the device specified in (d).
2246
2247 (% style="text-align:center" %)
2248 [[image:图片7.png]]
2249
2250 (d) is the multiplication result in the case of bit device
2251
2252 • K1: lower 4 bits (b0 to b3)
2253
2254 • K4: Lower 16 bits (b0 to b15)
2255
2256 • K8: Lower 32 bits (b0 to b31)
2257
2258 **Error code**
2259
2260 |**Error code**|**Content**
2261 |4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2262 |4086H|The output result of (d) in the write application instruction exceeds the device range
2263
2264 **Example**
2265
2266 (% style="text-align:center" %)
2267 [[image:图片8.png]]
2268
2269 Multiply the data in (D0) by (D2), and store the operation result in (D5, D4), that is, (D0) × (D2) → (D5, D4).
2270
2271 == **DMUL/32-bit Multiplication** ==
2272
2273
2274 **DMUL(P)**
2275
2276 Multiply the 32-bit BIN specified in (s1) and the 32-bit BIN specified in (s2), and store the result in the device specified in (d).
2277
2278 -[DMUL (s1)  (s2)  (d)]
2279
2280 **Content, range and data type**
2281
2282 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2283 |(s1)|Multiplication operation data or device storing multiplication operation data|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
2284 |(s2)|Multiplication operation data or device storing multiplication operation data|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
2285 |(d)|Device for storing calculation results| |Signed BIN64 bit|ANY64_S
2286
2287 **Device used**
2288
2289 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2290 **Index**
2291
2292 **modification**
2293 )))|=(((
2294 **Pulse**
2295
2296 **extension**
2297 )))
2298 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2299 |(% rowspan="3" %)DMUL|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2300 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2301 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2302
2303 **Features**
2304
2305 Multiply the BIN32-bit data specified in (s1) and the BIN32-bit data specified in (s2), and store the result of the operation in the device specified in (d).
2306
2307 (% style="text-align:center" %)
2308 [[image:图片9.png]]
2309
2310 (d) is the multiplication result in the case of bit device
2311
2312 • K1: lower 4 bits (b0 to b3)
2313
2314 • K4: Lower 16 bits (b0 to b15)
2315
2316 • K8: Lower 32 bits (b0 to b31)
2317
2318 **Error code**
2319
2320 |**Error code**|**Content**
2321 |4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2322 |4086H|The output result of (d) in the write application instruction exceeds the device range
2323
2324 **Example**
2325
2326 (% style="text-align:center" %)
2327 [[image:图片10.png]]
2328
2329 Multiply the data in (D1, D0) by (D3, D2), and store the result of the operation in ((D7, D6), (D5, D4)), ie (D1, D0) × (D3, D2) → ((D7, D6), (D5, D4)).
2330
2331 == DIV/16-bit Division Operation ==
2332
2333 **DIV(P)**
2334
2335 Divide the BIN 16-bit data specified in (s1) with the BIN 16-bit data specified in (s2), and store the result in the device specified in (d).
2336
2337 -[DIV (s1) (s2) (d)]
2338
2339 **Content, range and data type**
2340
2341 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2342 |(s1)|Division operation data or device storing division operation data|-32768 to 32767|Signed BIN 16 bit|ANY16_S
2343 |(s2)|Division operation data or device storing division operation data|-32768 to 32767|Signed BIN 16 bit|ANY16_S
2344 |(d)|Device for storing calculation results| |Signed BIN 32 bit|ANY32_S
2345
2346 **Device used**
2347
2348 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2349 **Index**
2350
2351 **modification**
2352 )))|=(((
2353 **Pulse**
2354
2355 **extension**
2356 )))
2357 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2358 |(% rowspan="3" %)DIV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2359 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2360 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2361
2362 **Features**
2363
2364 Divide the BIN 16-bit data specified in (s1) with the BIN 16-bit data specified in (s2), and store the result of the operation in the device specified in (d).
2365
2366 (% style="text-align:center" %)
2367 [[image:图片11.png]]
2368
2369 In the case of a word device, the division result uses a 32-bit storage quotient and remainder, and in the case of a bit device, only a 16-bit storage quotient is used.
2370
2371 • Quotient is stored in the lower 16 bits.
2372
2373 • The remainder is stored in the upper 16 bits. (Can only be stored in the case of word devices.)
2374
2375 (% class="box infomessage" %)
2376 (((
2377 **✎Note:**
2378
2379 * About the opearation result
2380
2381 • The highest bit of the quotient and remainder represents the sign of positive (0) and negative (1).
2382
2383 • When one of (s1) or (s2) is negative, the quotient becomes negative. When (s1) is negative, the remainder becomes negative.
2384
2385 * The device specified by (d)
2386
2387 • With the digit specification function, when specifying a bit device, the remainder cannot be obtained.
2388 )))
2389
2390 **Error code**
2391
2392 |=**Error code**|=**Content**
2393 |4080H|The input of divisor (s2) is 0
2394 |4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2395 |4086H|The output result of (d) in the write application instruction exceeds the device range
2396
2397 **Example**
2398
2399 (% style="text-align:center" %)
2400 [[image:图片12.png]]
2401
2402 Divide the data in (D0) by (D2), and store the result of the calculation: the quotient is stored in (D4), and the remainder is stored in (D5), ie (D0)/ (D2) → (D4(quotient)) (D5( remainder)).
2403
2404 == DDIV/32-bit Division Operation ==
2405
2406 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3172\wps1.png]]**DDIV(P)**
2407
2408 Divide the BIN32-bit data specified in (s1) with the BIN32-bit data specified in (s2), and store the result in the device specified in (d).
2409
2410 -[DDIV (s1)  (s2) (d)]
2411
2412 **Content, range and data type**
2413
2414 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2415 |(s1)|Division operation data or device storing division operation data|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
2416 |(s2)|Division operation data or device storing division operation data|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
2417 |(d)|Device for storing calculation results| |Signed BIN64 bit|ANY64_S
2418
2419 **Device used**
2420
2421 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2422 **Index**
2423
2424 **modification**
2425 )))|=(((
2426 **Pulse**
2427
2428 **extension**
2429 )))
2430 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2431 |(% rowspan="3" %)DDIV|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2432 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2433 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2434
2435 **Features**
2436
2437 Divide the BIN32-bit data specified in (s1) with the BIN32-bit data specified in (s2), and store the result of the operation in the device specified in (d).
2438
2439 (% style="text-align:center" %)
2440 [[image:图片13.png]]
2441
2442 In the case of word devices, the division result uses BIN64 bits to store the quotient and remainder. In the case of bit devices, only the BIN 32-bit storage quotient is used.
2443
2444 (% class="box infomessage" %)
2445 (((
2446 **✎Note: **
2447
2448 * About the operation result
2449
2450 • The highest bit of the quotient and remainder represents the sign of positive (0) and negative (1).
2451
2452 • When one of (s1) or (s2) is negative, the quotient becomes negative. When (s1) is negative, the remainder becomes negative.
2453
2454 * The specified device of (d)
2455
2456 • With the digit specification function, when a bit device is specified, the remainder cannot be obtained.
2457 )))
2458
2459 **Error code**
2460
2461 |=**Error code**|=**Content**
2462 |4080H|The input of divisor (s2) is 0
2463 |4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2464 |4086H|The output result of (d) in the write application instruction exceeds the device range
2465
2466 **Example**
2467
2468 (% style="text-align:center" %)
2469 [[image:图片14.png]]
2470
2471 Divide the data in (D1, D0) by (D3, D2), and store the result of the calculation: the quotient is stored in (D5, D4), and the remainder is stored in (D7, D6), that is (D1, D0)/ (D3, D2) → (D5, D4) (quotient) (D7, D6) (remainder).
2472
2473 == **INC/16-bit Data Increment** ==
2474
2475
2476 **INC(P)**
2477
2478 Add one to the device (BIN 16-bit data) specified in (d).
2479
2480 -[INC  (d)]
2481
2482 Content, range and data type
2483
2484 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2485 |(d)|The word device number that stores the data added by one|-32768 to 32767|Signed BIN 16 bit|ANY16_S
2486
2487 **Device used**
2488
2489 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2490 **Index**
2491
2492 **modification**
2493 )))|=(((
2494 **Pulse**
2495
2496 **extension**
2497 )))
2498 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2499 |INC|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
2500
2501 **Features**
2502
2503 Add one to the device (BIN 16-bit data) specified in (d).
2504
2505 (% style="text-align:center" %)
2506 [[image:图片15.png]]
2507
2508 • If the INC(P) instruction is executed when the content of the device specified in (d) is 32767, -32768 will be stored in the device specified in (d).
2509
2510 • Flags (zero, borrow, carry) do not perform actions.
2511
2512 (% class="box infomessage" %)
2513 (((
2514 **✎Note: **
2515 If the continuous execution (INC) instruction is used, the addition operation will be performed every operation cycle, so care should be taken.
2516 )))
2517
2518 **Error code**
2519
2520 |=**Error code**|=**Content**
2521 |=4085H|The output results of (d) in the read application instruction exceed the device range
2522 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2523
2524 **Example**
2525
2526 (% style="text-align:center" %)
2527 [[image:图片16.png]]
2528
2529 Add one to the device value specified in D0, that is, (D0) + 1 → (D0).
2530
2531 == DINC/32-bit Data Increment ==
2532
2533 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3172\wps2.png]]**DINC(P)**
2534
2535 Add one to the device (BIN 32-bit data) specified in (d).
2536
2537 -[DINC (d)]
2538
2539 **Content, range and data type**
2540
2541 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2542 |=(d)|The word device number that stores the data added by one|-2147483648 to 2147493647|Signed BIN 32 bit|ANY32_S
2543
2544 **Device used**
2545
2546 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2547 **Index**
2548
2549 **modification**
2550 )))|=(((
2551 **Pulse**
2552
2553 **extension**
2554 )))
2555 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2556 |DINC|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2557
2558 **Features**
2559
2560 Add one to the device (BIN 32-bit data) specified in (d).
2561
2562 (% style="text-align:center" %)
2563 [[image:图片17.png]]
2564
2565 • When the DINC(P) instruction is executed when the content of the device specified in (d) is 2147483647, -2147483648 will be stored in the device specified in (d).
2566
2567 • Flags (zero, borrow, carry) do not perform actions.
2568
2569 (% class="box infomessage" %)
2570 (((
2571 **✎Note:**
2572 If the continuous execution (INC) instruction is used, the addition operation will be performed every operation cycle, so care should be taken.
2573 )))
2574
2575 **Error code**
2576
2577 |=**Error code**|=**Content**
2578 |=4085H|The output results of (d) in the read application instruction exceed the device range
2579 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2580
2581 **Example**
2582
2583 (% style="text-align:center" %)
2584 [[image:图片18.png]]
2585
2586 Add one to the device value specified in (D1, D0), that is, (D1, D0) + 1 → (D1, D0).
2587
2588 == DEC/16 bit Data Decrement ==
2589
2590 **DEC(P)**
2591
2592 Minus one for the device (BIN 16-bit data) specified in (d).
2593
2594 -[DEC (d)]
2595
2596 **Content, range and data type**
2597
2598 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2599 |=(d)|The word device number that stores the data minus by one|-32768 to 32767|Signed BIN 16 bit|ANY16_S
2600
2601 **Device used**
2602
2603 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2604 **Index**
2605
2606 **modification**
2607 )))|=(((
2608 **Pulse**
2609
2610 **extension**
2611 )))
2612 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2613 |DEC|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
2614
2615 **Features**
2616
2617 Minus one for the device (BIN 16-bit data) specified in (d).
2618
2619 (% style="text-align:center" %)
2620 [[image:图片19.png]]
2621
2622 • If the DEC(P) instruction is executed when the content of the device specified in (d) is -32768, 32767 will be stored in the device specified in (d).
2623
2624 • Flags (zero, borrow, carry) do not perform actions.
2625
2626 (% class="box infomessage" %)
2627 (((
2628 **✎Note: **
2629 If using continuous execution (DEC) instructions, subtraction will be performed every operation cycle, so care should be taken.
2630 )))
2631
2632 **Error code**
2633
2634 |=**Error code**|=**Content**
2635 |=4085H|The output results of (d) in the read application instruction exceed the device range
2636 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2637
2638 **Example**
2639
2640 (% style="text-align:center" %)
2641 [[image:图片20.png]]
2642
2643 Each time M0 is set, the value of the device specified in D0 will be -1, (D0)-1 → (D0).
2644
2645 == DDEC/32-bit Data Decrement ==
2646
2647 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3172\wps3.png]]**DDEC(P)**
2648
2649 Minus one for the device (BIN 32-bit data) specified in (d).
2650
2651 -[DDEC  (d)]
2652
2653 **Content, range and data type**
2654
2655 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2656 |=(d)|The word device number that stores the data minus by one|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
2657
2658 **Device used**
2659
2660 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2661 **Index**
2662
2663 **modification**
2664 )))|=(((
2665 **Pulse**
2666
2667 **extension**
2668 )))
2669 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2670 |DDEC|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2671
2672 **Features**
2673
2674 Minus one for the device (BIN 32-bit data) specified in (d).
2675
2676 (% style="text-align:center" %)
2677 [[image:图片21.png]]
2678
2679 If the DDEC(P) instruction is executed when the content of the device specified in (d) is 0, minus one will be stored in the device specified in (d).
2680
2681 • Flags (zero, borrow, carry) do not perform actions.
2682
2683 (% class="box infomessage" %)
2684 (((
2685 **✎Note: **
2686 If using continuous execution (DEC) instructions, subtraction will be performed every operation cycle.
2687 )))
2688
2689 **Error code**
2690
2691 |=**Error code**|=**Content**
2692 |=4085H|The output results of (d) in the read application instruction exceed the device range
2693 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2694
2695 **Example**
2696
2697 (% style="text-align:center" %)
2698 [[image:图片22.png]]
2699
2700 Minus one on the device value specified in (D1, D0), that is, (D1, D0)-1 → (D0).
2701
2702 = **Logic Operation instructions** =
2703
2704 == NEG/16-bit Complement ==
2705
2706 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3172\wps5.png]]**NEG(P)**
2707
2708 After inverting the sign of the BIN 16-bit device specified in (d), store it in the device specified in (d).
2709
2710 -[NEG (d)]
2711
2712 **Content, range and data type**
2713
2714 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2715 |=(d)|The start device that stores the data complement of 2|-32768 to 32767|Signed BIN16|ANY16_S
2716
2717 **Device used**
2718
2719 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2720 **Index**
2721
2722 **modification**
2723 )))|=(((
2724 **Pulse**
2725
2726 **extension**
2727 )))
2728 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2729 |NEG|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
2730
2731 **Features**
2732
2733 • Invert the sign of the BIN 16-bit device specified in (d), and store it in the device specified in (d).
2734
2735 • Used when inverting positive and negative signs.
2736
2737 (% style="text-align:center" %)
2738 [[image:图片23.png]]
2739
2740 (% class="box infomessage" %)
2741 (((
2742 **✎Note:
2743 **If the continuous execution (NEG) instruction is used, every operation cycle will be inverted, so care should be taken.
2744 )))
2745
2746 **Error code**
2747
2748 |=**Error code**|=**Content**
2749 |=4085H|The output results of (d) in the read application instruction exceed the device range
2750 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2751
2752 **Example**
2753
2754 In the two examples below, if D2=K4 and D4=K8, or D2=K8 and D10 is always K4.
2755
2756 Each time M0 is set, the device value specified in D0 is reversed.
2757
2758 (% style="text-align:center" %)
2759 [[image:图片24.png]]
2760
2761 Take the absolute value of the difference of the subtraction operation.
2762
2763 If D2>D4, M10=On. If D2=D4, M11=On. If D2 <D4, M12=On. This ensures that D10 is positive.
2764
2765 It can also be represented by the following program:
2766
2767 (% style="text-align:center" %)
2768 [[image:图片26.png]]
2769
2770 When bit15 of D10 is "1" (indicating that D10 is a negative number), M10 = On, use NEG instruction to complement D10 to obtain the absolute value of D10.
2771
2772 In the above two examples, if D2=K4, D4=K8; or D2=K8, D4=K4, the result of D10 is K4.
2773
2774
2775 (% style="text-align:center" %)
2776 [[image:图片27.png]]
2777
2778 == DNEG/32-bit Complement ==
2779
2780 **DNEG(P)**
2781
2782 After inverting the sign of the BIN 32-bit device specified in (d), store it in the device specified in (d).
2783
2784 -[DNEG (d)]
2785
2786 **Content, range and data type**
2787
2788 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2789 |=(d)|The start device that stores the data complement of 2|-2147483648 to 2147483647|Signed BIN16|ANY16_S
2790
2791 **Device used**
2792
2793 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2794 **Index**
2795
2796 **modification**
2797 )))|=(((
2798 **Pulse**
2799
2800 **extension**
2801 )))
2802 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2803 |DNEG|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
2804
2805 **Features**
2806
2807 • Invert the sign of the BIN 32-bit device specified in (d) and store it in the device specified in (d).
2808
2809 • Used when inverting positive and negative signs.
2810
2811 (% style="text-align:center" %)
2812 [[image:图片28.png]]
2813
2814 (% class="box infomessage" %)
2815 (((
2816 **✎Note: **
2817 If you use continuous execution (DNEG) instructions, every operation cycle will be inverted, so care should be taken.
2818 )))
2819
2820 **Error code**
2821
2822 |**Error code**|**Content**
2823 |4085H|The output results of (d) in the read application instruction exceed the device range
2824 |4086H|The output result of (d) in the write application instruction exceeds the device range
2825
2826 **Example**
2827
2828 (% style="text-align:center" %)
2829 [[image:图片29.png]]
2830
2831 Each time M0 is set, the device value specified in (D1, D0) is reversed.
2832
2833 == WOR/16-bit Data Logical OR ==
2834
2835 **WOR(P)**
2836
2837 Perform a logical OR operation on the BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2), and store the result in the device specified in (d).
2838
2839 -[WOR (s1)  (s2) (d)]
2840
2841 **Content, range and data type**
2842
2843 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2844 |=(s1)|Stores data for logical OR operation or a device that stores data|-32768 to 32767|Signed BIN16|ANY16_S
2845 |=(s2)|Stores data for logical OR operation or a device that stores data|-32768to 32767|Signed BIN16|ANY16_S
2846 |=(d)|Device for storing logic or result| |Signed BIN16|ANY16_S
2847
2848 **Device used**
2849
2850 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2851 **Index**
2852
2853 **modification**
2854 )))|=(((
2855 **Pulse**
2856
2857 **extension**
2858 )))
2859 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2860 |(% rowspan="3" %)WOR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2861 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2862 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
2863
2864 **Features**
2865
2866 • Perform a logical OR operation on the BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2), and store the result in the device specified in (d).
2867
2868 (% style="text-align:center" %)
2869 [[image:图片30.png]]
2870
2871 In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
2872
2873 **Error code**
2874
2875 |=**Error code**|=**Content**
2876 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2877 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2878
2879 **Example**
2880
2881 (% style="text-align:center" %)
2882 [[image:图片31.png]]
2883
2884 When M0 is set, (D0) and (D2) are logically performed, and the value is stored in (D4), that is (D0)∨(D2) → (D4)
2885
2886 == DOR/32-bit Data Logical OR ==
2887
2888 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3172\wps6.png]]**DOR(P)**
2889
2890 After inverting the sign of the BIN 32-bit device specified in (d), store it in the device specified in (d).
2891
2892 -[DOR (s1) (s2)  (d)]
2893
2894 **Content, range and data type**
2895
2896 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2897 |=(s1)|Stores data for logical OR operation or a device that stores data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
2898 |=(s2)|Stores data for logical OR operation or a device that stores data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
2899 |=(d)|Device for storing logic or result| |Signed BIN32|ANY32_S
2900
2901 **Device used**
2902
2903 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2904 **Index**
2905
2906 **modification**
2907 )))|=(((
2908 **Pulse**
2909
2910 **extension**
2911 )))
2912 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2913 |(% rowspan="3" %)DOR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2914 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
2915 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
2916
2917 **Features**
2918
2919 Perform a logical OR operation on the BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2), and store the result in the device specified in (d).
2920
2921 (% style="text-align:center" %)
2922 [[image:图片32.png]]
2923
2924 In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
2925
2926 **Error code**
2927
2928 |=**Error code**|=**Content**
2929 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2930 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2931
2932 **Example**
2933
2934 (% style="text-align:center" %)
2935 [[image:图片33.png]]
2936
2937
2938 When M0 is set, (D1, D0) and (D3, D2) are logically performed, and the value is stored in (D5, D4), that is, (D1, D0)∨(D3, D2) → (D5, D4) ).
2939
2940 == WAND/16-bit Data Logic AND ==
2941
2942 **WAND(P)**
2943
2944 Perform a logical AND operation on each bit of the BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2), and store the result in the device specified in (d).
2945
2946 -[WAND (s1) (s2) (d)]
2947
2948 **Content, range and data type**
2949
2950 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
2951 |(s1)|Store the data for logical AND operation or the device storing the data|-32768to 32767|Signed BIN16|ANY16_S
2952 |(s2)|Store the data for logical AND operation or the device storing the data|-32768 to 32767|Signed BIN16|ANY16_S
2953 |(d)|Device for storing logic and result| |Signed BIN16|ANY16_S
2954
2955 **Device used**
2956
2957 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
2958 **Index**
2959
2960 **modification**
2961 )))|=(((
2962 **Pulse**
2963
2964 **extension**
2965 )))
2966 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
2967 |(% rowspan="3" %)WAND|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2968 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
2969 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
2970
2971 **Features**
2972
2973 Perform a logical AND operation on each bit of the BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2), and store the result in the device specified in (d).
2974
2975 (% style="text-align:center" %)
2976 [[image:图片34.png]]
2977
2978 In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
2979
2980 **Error code**
2981
2982 |=**Error code**|=**Content**
2983 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
2984 |=4086H|The output result of (d) in the write application instruction exceeds the device range
2985
2986 **Example**
2987
2988 (% style="text-align:center" %)
2989 [[image:图片35.png]]
2990
2991
2992 When M0 is set, the logical AND operation of (D0) and (D2) is performed, and the value is stored in (D4), that is, (D0) ∧ (D2) → (D4).
2993
2994 == DAND/32-bit Data Logic AND ==
2995
2996 **DAND(P)**
2997
2998 Perform a logical AND operation on each bit of the BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2), and store the result in the device specified in (d).
2999
3000 -[DAND (s1) (s2)  (d)]
3001
3002 **Content, range and data type**
3003
3004 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3005 |=(s1)|Store the data for logical AND operation or the device storing the data|-2147483648 to +2147483647|Signed BIN32|ANY32_S
3006 |=(s2)|Store the data for logical AND operation or the device storing the data|-2147483648 to +2147483647|Signed BIN32|ANY32_S
3007 |=(d)|Device for storing logic and result| |Signed BIN32|ANY32_S
3008
3009 **Device used**
3010
3011 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3012 **Index**
3013
3014 **modification**
3015 )))|=(((
3016 **Pulse**
3017
3018 **extension**
3019 )))
3020 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3021 |(% rowspan="3" %)DAND|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3022 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3023 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
3024
3025 **Features**
3026
3027 Perform a logical AND operation on each bit of the BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2), and store the result in the device specified in (d).
3028
3029 (% style="text-align:center" %)
3030 [[image:图片36.png]]
3031
3032 In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
3033
3034 **Error code**
3035
3036 |=**Error code**|=**Content**
3037 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
3038 |=4086H|The output result of (d) in the write application instruction exceeds the device range
3039
3040 **Example**
3041
3042 (% style="text-align:center" %)
3043 [[image:图片37.png]]
3044
3045 When M0 is set, perform logical AND operation of (D1, D0) and (D3, D2), and store the value in (D5, D4), (D1, D0) ∧ (D3, D2) → (D5, D4) .
3046
3047 == WXOR/16-bit Data Logic Exclusive OR ==
3048
3049 **WXOR(P)**
3050
3051 Perform an exclusive OR operation on the BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2), and store the result in the device specified in (d).
3052
3053 -[WXOR (s1)  (s2)  (d)]
3054
3055 **Content, range and data type**
3056
3057 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3058 |=(s1)|Store the data for exclusive OR operation or the device storing the data|-32768 to 32767|Signed BIN16|ANY16_S
3059 |=(s2)|Store the data for exclusive OR operation or the device storing the data|-32768 to +32767|Signed BIN16|ANY16_S
3060 |=(d)|Device for storing XOR result| |Signed BIN16|ANY16_S
3061
3062 **Device used**
3063
3064 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3065 **Index**
3066
3067 **modification**
3068 )))|=(((
3069 **Pulse**
3070
3071 **extension**
3072 )))
3073 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3074 |(% rowspan="3" %)WXOR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3075 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3076 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
3077
3078 **Features**
3079
3080 • Perform logical exclusive OR operation on the BIN 16-bit data of the device specified in (s1) and the BIN 16-bit data of the device specified in (s2), and store the result in the device specified in (d).
3081
3082 (% style="text-align:center" %)
3083 [[image:图片38.png]]
3084
3085 In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
3086
3087 **Error code**
3088
3089 |=**Error code**|=**Content**
3090 |=4085H|The output results of (s1) and (s2) in the read application instruction exceed the device range
3091 |=4086H|The output result of (d) in the write application instruction exceeds the device range
3092
3093 **Example**
3094
3095 Example 1: When M0 is set, (D0) and (D2) are XOR operation, and the value is stored in (D4), (D0)∀(D2)→(D4).
3096
3097 (% style="text-align:center" %)
3098 [[image:图片39.png]]
3099
3100 Example 2: When used with the CML instruction, it can realize the logic exclusive OR (XORNOT) operation:
3101
3102 (% style="text-align:center" %)
3103 [[image:图片40.png]]
3104
3105 == **DXOR/32-bit data logic exclusive OR** ==
3106
3107 **DXOR(P)**
3108
3109 Perform an exclusive OR operation on the BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2), and store the result in the device specified in (d).
3110
3111 -[DXOR (s1)  (s2)  (d)]
3112
3113 **Content, range and data type**
3114
3115 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3116 |=(s1)|Store the data for exclusive OR operation or the device storing the data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
3117 |=(s2)|Store the data for exclusive OR operation or the device storing the data|-2147483648 to 2147483647|Signed BIN32|ANY32_S
3118 |=(d)|Device for storing XOR result| |Signed BIN32|ANY32_S
3119
3120 **Device used**
3121
3122 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3123 **Index**
3124
3125 **modification**
3126 )))|=(((
3127 **Pulse**
3128
3129 **extension**
3130 )))
3131 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3132 |(% rowspan="3" %)DXOR|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3133 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3134 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
3135
3136 **Features**
3137
3138 Perform an exclusive OR operation on the BIN 32-bit data of the device specified in (s1) and the BIN 32-bit data of the device specified in (s2), and store the result in the device specified in (d).
3139
3140 (% style="text-align:center" %)
3141 [[image:图片41.png]]
3142
3143 In the case of bit devices, bit devices after the number of points specified by the number of digits will be calculated as 0.
3144
3145 **Error code**
3146
3147 |=**Error code**|=**Content**
3148 |=4085H|The output results of (s1) and (s2)in the read application instruction exceed the device range
3149 |=4086H|The output result of (d) in the write application instruction exceeds the device range
3150
3151 **Example**
3152
3153 (% style="text-align:center" %)
3154 [[image:图片42.png]]
3155
3156
3157 When M0 is set, (D1, D0) and (D3, D2) are XOR operation, and the value is stored in (D5, D4), that is, (D1, D0) ∀ (D3, D2) → (D5, D4) )
3158
3159 == ANS/Alarm Settings ==
3160
3161 **ANS(P)**
3162
3163 Used to set alarm instructions.
3164
3165 -[ANS (s)  (n)  (d)]
3166
3167 **Content, range and data type**
3168
3169 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3170 |=(s)|Timer number for judging time|-|Signed BIN 16 bit|ANY16
3171 |=(n)|Data that judges time|1 to 32767|Signed BIN 16 bit|ANY16
3172 |=(d)|The set alarm device|-|Bit|ANY16_BOOL
3173
3174 **Device used**
3175
3176 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3177 **Index**
3178
3179 **modification**
3180 )))|=(((
3181 **Pulse**
3182
3183 **extension**
3184 )))
3185 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3186 |(% rowspan="3" %)ANS|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | |●|●
3187 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3188 |Parameter 3| | | |●| | | | | | | | | | | | | | | | | | | | |●|●
3189
3190 **Features**
3191
3192 When the instruction input continues to be ON for the judgment time [(n)×100ms, timer (s)], set (d). If the instruction time turns off below the judgment time [(n)×100ms], the current value of the judgment timer (s) is reset, and (d) is not set. In addition, if the instruction input turns off, the judgment timer will be reset.
3193
3194 (% style="text-align:center" %)
3195 [[image:图片43.png]]
3196
3197 (% style="text-align:center" %)
3198 [[image:图片44.png]]
3199
3200 * Judge the time ((n)X 100ms or less)
3201 * Judgment time or more (inclusive) ((n) X 100ms or more (inclusive))
3202
3203 **Related device**
3204
3205 |=**Devices**|=**Name**|=**Content**
3206 |=SM249|Signal alarm is valid|After SM249 is ON, the following SM248 and SD249 act.
3207 |=SM248|Signal alarm action|SM249 is ON, when any one of the states S900 to S999 is active, SM248 is ON
3208 |=SD249|Signal alarm ON state minimum number|Save the smallest number of actions in S900 to S999.
3209
3210 **Error code**
3211
3212 |=**Error code**|=**Content**
3213 |(% rowspan="3" %)4084H|The value specified in (n1) and (n2) exceeds the range of 0 to 32767
3214 |The timer number is not in the range of T0 to T199.
3215 |The signal alarm is not in the range of S900 to S999.
3216 |4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3217 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3218
3219 **Example**
3220
3221 The fault number is displayed by the signal alarm.
3222
3223 As shown below, when you write a program for diagnosing external faults, such as monitoring the content of SM249 (the smallest number in the ON state), the smallest number in the ON state among S900 to S999 will be displayed. When multiple faults occur at the same time, the next fault number can be obtained after eliminating the fault with the smallest number.
3224
3225 (% style="text-align:center" %)
3226 [[image:图片45.png]]
3227
3228 * Monitoring is effective after SM249 is turned ON.
3229 * Detect X1 for 2 seconds, turn ON, set S900.
3230 * X4 is detected for 1 second, turn ON, set S901.
3231 * SM248 will act after any one of S900 to S999 is ON, and the output fault display YY6 will act.
3232 * Display the fault number to the D0 device.
3233 * Through the external fault diagnosis program, use the reset button M0 to turn off the activated state. Each time M0 turns ON, the action status of the new number is set in turn, and the new number that is already ON is reset.
3234
3235 == **ANR/Alarm Reset** ==
3236
3237
3238 **ANR(P)**
3239
3240 The instruction to reset the small number that is ON in the alarm.
3241
3242 -[ANR]
3243
3244 **Content, range and data type**
3245
3246 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3247 |=No|No parameter setting|-|-|-
3248
3249 **Device used**
3250
3251 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
3252 **Pulse**
3253
3254 **extension**
3255 )))
3256 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3257 |ANR|No|(% colspan="26" %)No object device
3258
3259 **Features**
3260
3261 If the instruction input is ON, reset the active alarm in the alarm.
3262
3263 If multiple alarms are operating, reset the smaller number. If the input instruction is turned ON again, the next small number in the alarm that is operating will be reset.
3264
3265 (% style="text-align:center" %)
3266 [[image:图片46.png]]
3267
3268 **Related device**
3269
3270 |=**Devices**|=**Name**|=**Content**
3271 |=SM249|Signal alarm is valid|After SM249 is ON, the following SM248 and SD249 act.
3272 |=SM248|Signal alarm action|SM249 is ON, when any one of the states S900 to S999 is active, SM248 is ON.
3273 |=SD249|Signal alarm ON state minimum number|Save the smallest number of actions in S900 to S999.
3274
3275 (% class="box infomessage" %)
3276 (((
3277 **✎Note: **If you use the ANR instruction, reset in sequence every cycle.
3278
3279 If the ANRP instruction is used, it will be executed in only one operation cycle.
3280 )))
3281
3282 **Error code**
3283
3284 No operation error.
3285
3286 **Example**
3287
3288 The fault number is displayed by the signal alarm.
3289
3290 As shown below, when you write a program for diagnosing external faults, such as monitoring the content of SM249 (the smallest number in the ON state), the smallest number in the ON state among S900 to S999 will be displayed. When multiple faults occur at the same time, the next fault number can be obtained after eliminating the fault with the smallest number.
3291
3292 (% style="text-align:center" %)
3293 [[image:图片47.png]]
3294
3295 1. Monitoring is effective after SM249 is turned ON.
3296 1. Detect X1 for 2 seconds, turn ON, set S900.
3297 1. X4 is detected for 1 second, turn ON, set S901.
3298 1. SM248 will act after any one of S900 to S999 is ON, and the output fault display YY6 will act.
3299 1. Display the fault number to the D0 device.
3300 1. Through the external fault diagnosis program, use the reset button M0 to turn off the activated state. Each time M0 turns ON, the action status of the new number is set in turn, and the new number that is already ON is reset.
3301
3302 == BON/16-bit Data Bit Judgment ==
3303
3304 **BON(P)**
3305
3306 Check whether the state of the BIN 16-bit data (n) bit of the device specified in (s) is ON or OFF, and output the result to the device specified in (d).
3307
3308 -[BON  (s)  (n) (d)]
3309
3310 **Content, range and data type**
3311
3312 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3313 |=(s)|Data storage destination word device number|-|Signed BIN 16 bit|ANY16
3314 |=(d)|Bit device number of drive|-|Bit|ANY16_BOOL
3315 |=(n)|The position of the bit to be judged|0 to 15|Signed BIN 16 bit|ANY16
3316
3317 **Device used**
3318
3319 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3320 **Index**
3321
3322 **modification**
3323 )))|=(((
3324 **Pulse**
3325
3326 **extension**
3327 )))
3328 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3329 |(% rowspan="3" %)BON|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3330 |Parameter 2| |●|●|●|●| | | | |●| | | | | | |●|●|●| | | | | |●|●
3331 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3332
3333 **Features**
3334
3335 Check whether the state of the BIN 16-bit data (n) bit of the device specified in (s) is ON or OFF, and output the result to the device specified in (d).
3336
3337 If the above result is ON, then (d)=ON, if it is OFF, then (d)=OFF.
3338
3339 If a constant (K) is specified in the device specified in (s), it will be automatically converted to BIN.
3340
3341 (% style="text-align:center" %)
3342 [[image:图片48.png]]
3343
3344 **Error code**
3345
3346 |=**Error code**|=**Content**
3347 |=4084H|The data input in (n) exceeds the specified range of 0 to 15.
3348 |=4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3349 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3350
3351 **Example**
3352
3353 (% style="text-align:center" %)
3354 [[image:图片49.png]]
3355
3356 When n in D0 = the third bit is 1 (ON), M0 is set to 1 (ON).
3357
3358 (% style="text-align:center" %)
3359 [[image:图片50.png]]
3360
3361 == DBON/32-bit Data Bit Judgment ==
3362
3363 **DBON(P)**
3364
3365 Check whether the state of the BIN 32-bit data (n) bit of the device specified in (s) is ON or OFF, and output the result to the device specified in (d).
3366
3367 -[DBON (s) (n) (d)]
3368
3369 **Content, range and data type**
3370
3371 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3372 |=(s)|Data storage destination word device number|-|Signed BIN 32 bit|ANY32
3373 |=(d)|Bit device number of drive|-|Bit|ANY32_BOOL
3374 |=(n)|The position of the bit to be judged|0 to 31|Signed BIN 32 bit|ANY32
3375
3376 **Device used**
3377
3378 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3379 **Index**
3380
3381 **modification**
3382 )))|=(((
3383 **Pulse**
3384
3385 **extension**
3386 )))
3387 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3388 |(% rowspan="3" %)DBON|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3389 |Parameter 2| |●|●|●|●| | | | |●| | | | | | |●|●|●| | | | | |●|●
3390 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3391
3392 **Features**
3393
3394 Check whether the BIN 32-bit data (n) bit status of the device specified in (s) is ON or OFF, and output the result to the device specified in (d).
3395
3396 If the above result is ON, then (d)=ON, if it is OFF, then (d)=OFF.
3397
3398 If a constant (K) is specified in the device specified in (s), it will be automatically converted to BIN.
3399
3400 (% style="text-align:center" %)
3401 [[image:图片51.png]]
3402
3403 **Error code**
3404
3405 |=**Error code**|=**Content**
3406 |=4084H|The data input in (n) exceeds the specified range of 0 to 31.
3407 |=4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3408 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3409
3410 **Example**
3411
3412 When n in D0 = the third bit is 1 (ON), M0 is set to 1 (ON).
3413
3414 (% style="text-align:center" %)
3415 [[image:图片52.png]]
3416
3417 == ENCO/Encode ==
3418
3419 **ENCO(P)**
3420
3421 Encode the data of the 2th (n)th power from (s) and store it in (d).
3422
3423 -[ENCO (s) (n) (d)]
3424
3425 **Content, range and data type**
3426
3427 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3428 |=(s)|Start device for storing coded data|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
3429 |=(d)|Device number storing the encoding result|-|Signed BIN 16 bit|ANY_ELEMENTARY
3430 |=(n)|Effective bit length|0 to 8|Signed BIN 16 bit|ANY16
3431
3432 **Device used**
3433
3434 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3435 **Index**
3436
3437 **modification**
3438 )))|=(((
3439 **Pulse**
3440
3441 **extension**
3442 )))
3443 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3444 |(% rowspan="3" %)ENCO|Parameter 1|●|●|●|●|●| | | | | | | | | |●|●|●|●|●| | | | | |●|●
3445 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
3446 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3447
3448 **Features**
3449
3450 The BIN value corresponding to the bit from 2^^ (n)^^ bits of (s) to 1 is stored in (d).
3451
3452
3453 When (n)=0, it w
3454
3455 (% style="text-align:center" %)
3456 [[image:图片53.png]]
3457
3458 ill be no processing, and the content of the device specified in (d) will not change.
3459
3460 Bit devices are treated as 1 bit, and word devices are treated as 16 bits.
3461
3462 When multiple digits are 1, it will be processed at the upper position.
3463
3464 **Error code**
3465
3466 |=**Error code**|=**Content**
3467 |(% rowspan="3" %)4084H|In the bit device specification of (s), when (n) is other than 0 to 8.
3468 |In the word device specification of (s), when (n) is other than 0 to 4.
3469 |When the data of 2^^(n) ^^bits starting from (s) are all 0.
3470 |4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3471 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3472
3473 **Example**
3474
3475 (% style="text-align:center" %)
3476 [[image:图片54.png]]
3477
3478 When M20 is turned ON, the D0 device is 16 after encoding.
3479
3480 == **DECO/Decode** ==
3481
3482
3483 **DECO(P)**
3484
3485 Decode the lower (n) bits of the device specified in (s), and store the result in the 2 (n)th power of the device specified in (d).
3486
3487 -[DECO (s) (n) (d)]
3488
3489 **Content, range and data type**
3490
3491 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3492 |=(s)|Decoded data or the device number storing the decoded data|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
3493 |=(d)|The start device storing the decoding result|-|Signed BIN 16 bit|ANY_ELEMENTARY
3494 |=(n)|Effective bit length|0 to 8|Signed BIN 16 bit|ANY16
3495
3496 **Device used**
3497
3498 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3499 **Index**
3500
3501 **modification**
3502 )))|=(((
3503 **Pulse**
3504
3505 **extension**
3506 )))
3507 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3508 |(% rowspan="3" %)DECO|Parameter 1|●|●|●|●|●| | | | | | |●|●|●|●|●|●|●|●| | |●|●| |●|●
3509 |Parameter 2| |●|●|●|●| | | | | | | | | |●|●|●|●|●| | | | | |●|●
3510 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3511
3512 **Features**
3513
3514 Turn ON the position of (d) corresponding to the BIN value specified in the lower (n) bit of (s).
3515
3516 When (n)=0, it will be no processing, and the content of the device specified in (d) will not change.
3517
3518 Bit devices are treated as 1 bit, and word devices are treated as 16 bits.
3519
3520 (% style="text-align:center" %)
3521 [[image:图片55.png]]
3522
3523 **Error code**
3524
3525 |=**Error code**|=**Content**
3526 |(% rowspan="2" %)4084H|In the bit device specification of (d), when (n) is other than 0 to 8.
3527 |In the word device specification of (d), when (n) is other than 0 to 4.
3528 |4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3529 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3530
3531 **Example**
3532
3533 (% style="text-align:center" %)
3534 [[image:图片56.png]]
3535
3536 When M20 is ON, M3 will be turned ON.
3537
3538 == SUM/The ON Bits of 16-bit Data ==
3539
3540 **SUM(P)**
3541
3542 Store the total number of bits at 1 in the BIN 16-bit data of the device specified in (s) to the device specified in (d).
3543
3544 -[SUM (s) (d)]
3545
3546 **Content, range and data type**
3547
3548 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3549 |=(s)|The device start number that counts the total number of bits at 1|-|Signed BIN 16 bit|ANY16
3550 |=(d)|The device start number of the total number of storage bits|-|Signed BIN 16 bit|ANY16
3551
3552 **Device used**
3553
3554 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3555 **Index**
3556
3557 **modification**
3558 )))|=(((
3559 **Pulse**
3560
3561 **extension**
3562 )))
3563 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3564 |(% rowspan="2" %)SUM|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3565 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
3566
3567 **Features**
3568
3569 Store the total number of bits at 1 in the BIN 16-bit data of the device specified in (s) to the device specified in (d).
3570
3571 When the BIN 16-bit data of the device specified in (s) is all 0, the zero flag (SM153) turns on.
3572
3573 (% style="text-align:center" %)
3574 [[image:图片57.png]]
3575
3576 1. The total number of 1 (ON) is stored in BIN.
3577 1. There are 8 in the example on the left.
3578
3579 **Error code**
3580
3581 |=**Error code**|=**Content**
3582 |=4085H|When the device specified in the read application instructions (s) exceeds the corresponding device range
3583 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3584
3585 **Example**
3586
3587 (% style="text-align:center" %)
3588 [[image:图片58.png]]
3589
3590 When M0 is ON, the number of ON bits in D0 is counted and stored in D1. The value after D1 is executed is 4.
3591
3592 == DSUM/The ON Bits of 32-bit Data ==
3593
3594 **DSUM(P)**
3595
3596 Store the total number of bits at 1 in the BIN 32-bit data of the device specified in (s) to the device specified in (d).
3597
3598 -[SUM (s) (d)]
3599
3600 **Content, range and data type**
3601
3602 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3603 |=(s)|The device start number that counts the total number of bits at 1|-|Signed BIN 32 bit|ANY32
3604 |=(d)|The device start number of the total number of storage bits|-|Signed BIN 32 bit|ANY32
3605
3606 **Device used**
3607
3608 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3609 **Index**
3610
3611 **modification**
3612 )))|=(((
3613 **Pulse**
3614
3615 **extension**
3616 )))
3617 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3618 |(% rowspan="2" %)DSUM|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3619 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
3620
3621 **Features**
3622
3623 Store the total number of bits at 1 in the BIN 32-bit data of the device specified in (s) to the device specified in (d).
3624
3625 When the BIN 32-bit data of the device specified in (s) is all 0 (OFF), the zero flag (SM153) turns on.
3626
3627 (% style="text-align:center" %)
3628 [[image:图片59.png]]
3629
3630 The total number of 1 (ON) is stored in BIN.
3631
3632 There are 16 in the example on the left.
3633
3634 (% class="box infomessage" %)
3635 (((
3636 **✎Note:**
3637 When the instruction input is OFF, the instruction will not be executed, and the output of the ON digits of the action will remain the same as before.
3638 )))
3639
3640 **Error code**
3641
3642 |=**Error code**|=**Content**
3643 |=4085H|When the device specified in the read application instructions (s) exceeds the corresponding device range
3644 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3645
3646 **Example**
3647
3648 (% style="text-align:center" %)
3649 [[image:图片60.png]]
3650
3651 When M0 is ON, the number of ON bits in D0 is counted and stored in D10, and the value after D10 is executed is 4.
3652
3653 == MEAN/Average Value of 16-bit Data ==
3654
3655 **MEAN(P)**
3656
3657 Store the total number of bits at 1 in the BIN 16-bit data of the device specified in (s) to the device specified in (d).
3658
3659 -[MEAN (s)  (d) (n)]
3660
3661 **Content, range and data type**
3662
3663 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3664 |=(s)|The device start number storing the data for average calculation|-|Signed BIN 16 bit|ANY16
3665 |=(d)|The device start number storing the average value|-|Signed BIN 16 bit|ANY16
3666 |=(n)|Number of data or the device number storing the number of data|1 to 32767|Signed BIN 16 bit|ANY16
3667
3668 **Device used**
3669
3670 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3671 **Index**
3672
3673 **modification**
3674 )))|=(((
3675 **Pulse**
3676
3677 **extension**
3678 )))
3679 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3680 |(% rowspan="3" %)MEAN|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
3681 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
3682 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3683
3684 **Features**
3685
3686 Calculate the average value of the 16-bit data at (n) points starting from the device specified in (s) and store it in the device specified in (d).
3687
3688 The total is calculated from the algebraic sum and divided by (n).
3689
3690 The remainder is rounded off.
3691
3692 (% style="text-align:center" %)
3693 [[image:图片1.png]]
3694
3695 **Error code**
3696
3697 |**Error code**|**Content**
3698 |4084H|The data input by (n) in the application instruction exceeds the specifiable range. N≤0
3699 |4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3700 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3701
3702 **Example**
3703
3704 (% style="text-align:center" %)
3705 [[image:图片2.png]]
3706
3707 Add the data of D0, D1, and D2 and save the value obtained after dividing by 3 in D10. The calculated average value is 6.
3708
3709 == DMEAN/Average Value of 16-bit Data ==
3710
3711 **DMEAN(P)**
3712
3713 Store the total number of bits at 1 in the BIN 32-bit data of the device specified in (s) to the device specified in (d).
3714
3715 -[DMEAN (s) (d) (n)]
3716
3717 **Content, range and data type**
3718
3719 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3720 |=(s)|The device start number storing the data for average calculation|-|Signed BIN 32 bit|ANY32
3721 |=(d)|The device start number storing the average value|-|Signed BIN 32 bit|ANY32
3722 |=(n)|Number of data or the device number storing the number of data|1 to 2147483647|Signed BIN 32 bit|ANY32
3723
3724 **Device used**
3725
3726 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
3727 **Pulse**
3728
3729 **extension**
3730 )))
3731 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3732 |(% rowspan="3" %)DMEAN|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
3733 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
3734 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3735
3736 **Features**
3737
3738 Calculate the mean value of BIN 32-bit data at (n) points starting from the device specified in (s) and store it in the device specified in (d).
3739
3740 The total is calculated from the algebraic sum and divided by (n).
3741
3742 The remainder is rounded off.
3743
3744 (% style="text-align:center" %)
3745 [[image:图片3.png]]
3746
3747 (% class="box infomessage" %)
3748 (((
3749 **✎Note: **
3750 When the device number exceeds, (n) is handled as a smaller value within the allowable range.
3751 )))
3752
3753 **Error code**
3754
3755 |=**Error code**|=**Content**
3756 |=4084H|The data input in (n) exceeds the specifiable range. N≤0
3757 |=4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3758 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3759
3760 **Example**
3761
3762 (% style="text-align:center" %)
3763 [[image:图片4.png]]
3764
3765
3766 Add the data of D0, D2, and D4, and save the value obtained after dividing by 3 in D10 and D11, and the calculated average value is 6.
3767
3768 == SQR/16-bit Square Root ==
3769
3770 **SQR(P)**
3771
3772 Calculate the square root of the BIN 16-bit data specified in (s), and store the calculation result in (d).
3773
3774 -[SQR (s)  (d)]
3775
3776 **Content, range and data type**
3777
3778 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3779 |=(s)|The data device storing for square root calculation|0 to +32767|Signed BIN 16 bit|ANY16
3780 |=(d)|The device storing the calculated square root|-|Signed BIN 16 bit|ANY16
3781
3782 **Device used**
3783
3784 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
3785 **Pulse**
3786
3787 **extension**
3788 )))
3789 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3790 |(% rowspan="2" %)SQR|Parameter 1| | | | | | | | | | | | | | | | |●|●|●| | |●|●| |●|●
3791 |Parameter 2| | | | | | | | | | | | | | | | |●|●|●| | | | | |●|●
3792
3793 **Features**
3794
3795 Calculate the square root of the BIN 16-bit data specified in (s), and store the calculation result in (d).
3796
3797 (% style="text-align:center" %)
3798 [[image:图片1.png]]
3799
3800 (% class="box infomessage" %)
3801 (((
3802 **✎Note: **The decimal point of operation result will be rounded off and become an integer. If rounding occurs, SM152 (borrow flag) turns ON.
3803
3804 When the operation result is really 0, SM153 (zero flag) turns ON.
3805 )))
3806
3807 **Error code**
3808
3809 |**Error code**|**Content**
3810 |4084H|When a negative value is specified in (s).
3811 |4085H|When the device specified in the read application instructions (s) exceeds the corresponding device range
3812 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3813
3814 **Example**
3815
3816 (% style="text-align:center" %)
3817 [[image:图片2.png]]
3818
3819 The square root of D0 is stored in D2, and the value of D0 is 100, so the value of D2 is 10.
3820
3821 == DSQR/32-bit Square Root ==
3822
3823 **DSQR(P)**
3824
3825 Calculate the square root of the BIN 32-bit data specified in (s), and store the calculation result in (d).
3826
3827 -[DSQR (s) (d)]
3828
3829 **Content, range and data type**
3830
3831 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3832 |=(s)|The data device storing for square root calculation|0 to 2147483647|Signed BIN 32 bit|ANY32
3833 |=(d)|The device storing the calculated square root|-|Signed BIN 32 bit|ANY32
3834
3835 **Device used**
3836
3837 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
3838 **Pulse**
3839
3840 **extension**
3841 )))
3842 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3843 |(% rowspan="2" %)DSQR|Parameter 1| | | | | | | | | | | | | | | | |●|●|●|●|●|●|●| |●|●
3844 |Parameter 2| | | | | | | | | | | | | | | | |●|●|●|●|●| | | |●|●
3845
3846 **Features**
3847
3848 Calculate the square root of the BIN 32-bit data specified in (s) and store the calculation result in (d).
3849
3850 (% style="text-align:center" %)
3851 [[image:图片3.png]]
3852
3853 (% class="box infomessage" %)
3854 (((
3855 **✎Note:**The decimal point of operation result will be rounded off and become an integer. If rounding occurs, SM152 (borrow flag) turns ON.
3856
3857 When the operation result is really 0, SM153 (zero flag) turns on.
3858 )))
3859
3860 **Error code**
3861
3862 |=**Error code**|=**Content**
3863 |=4084H|When a negative value is specified in (s).
3864 |=4085H|When the device specified in the read application instructions (s) exceeds the corresponding device range
3865 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3866
3867 **Example**
3868
3869 (% style="text-align:center" %)
3870 [[image:图片4.png]]
3871
3872 The square root of D0 is stored in D2, and the value of D0 is 110, so the value in the D2 device is 10 (the fractional part is discarded), and the borrow flag SM152 is turned ON.
3873
3874 == WSUM/The Sum Value of 16-bit Data ==
3875
3876 **WSUM(P)**
3877
3878 After adding all the BIN 16-bit data of point (n) starting from the device specified in (s), it is stored in the device specified in (d).
3879
3880 -[WSUM (s)  (d) (n)]
3881
3882 **Content, range and data type**
3883
3884 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3885 |=(s)|The device start number storing the data for sum value calculation|-|Signed BIN 16 bit|ANY16
3886 |=(d)|The device start number storing the sum value|-|Signed BIN 32 bit|ANY32
3887 |=(n)|Number of data|-|Signed BIN 16 bit|ANY16
3888
3889 **Device used**
3890
3891 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
3892 **Pulse**
3893
3894 **extension**
3895 )))
3896 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3897 |(% rowspan="3" %)WSUM|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
3898 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
3899 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
3900
3901 **Features**
3902
3903 After adding all the BIN 16-bit data of point (n) starting from the device specified in (s), it is stored in the device specified in (d).
3904
3905 (% style="text-align:center" %)
3906 [[image:图片5.png]]
3907
3908 **Error code**
3909
3910 |=**Error code**|=**Content**
3911 |=4084H|When a negative value is specified in (n).
3912 |=4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3913 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3914
3915 **Example**
3916
3917 (% style="text-align:center" %)
3918 [[image:图片6.png]]
3919
3920 When M0=ON, the total of 16-bit data of D0 to D2 is saved in [D100, D101], and the accounting result is 18.
3921
3922 == DWSUM/The Sum Value of 32-bit Data ==
3923
3924 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3496\wps1.png]]**DWSUM(P)**
3925
3926 Add all the 32-bit BIN data of point (n) starting from the device specified in (s) and store it in the device specified in (d).
3927
3928 -[DWSUM (s) (d) (n)]
3929
3930 **Content, range and data type**
3931
3932 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3933 |=(s)|The device start number storing the data for total value calculation|-|Signed BIN 32 bit|ANY32
3934 |=(d)|The device start number storing the total value|-|Signed BIN64 bit|ANY64
3935 |=(n)|Number of data|-|Signed BIN 32 bit|ANY32
3936
3937 **Device used**
3938
3939 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
3940 **Pulse**
3941
3942 **extension**
3943 )))
3944 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
3945 |(% rowspan="3" %)DWSUM|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|●
3946 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
3947 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
3948
3949 **Features**
3950
3951 Add all the 32-bit BIN data of point (n) starting from the device specified in (s) and store it in the device specified in (d).
3952
3953 (% style="text-align:center" %)
3954 [[image:图片7.png]]
3955
3956 (% class="box infomessage" %)
3957 (((
3958 **✎Note:**
3959 When the number of bits is specified in (d), the value of n ranges from 1 to 8, such as K8 (32-bit instructions, such as K8M0) without K16 (64-bit instructions).
3960 )))
3961
3962 **Error code**
3963
3964 |=**Error code**|=**Content**
3965 |=4084H|When a negative value is specified in (n).
3966 |=4085H|When the device specified in the read application instructions (s) and (n) exceeds the corresponding device range
3967 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
3968
3969 **Example**
3970
3971 (% style="text-align:center" %)
3972 [[image:图片8.png]]
3973
3974 When M0=ON, the total of 16-bit data of D0 to D2 is saved in [D100, D101], and the accounting result is 18.
3975
3976 == SORT/16-bit Data Sorting ==
3977
3978 **SORT**
3979
3980 Sort the data rows in ascending order based on the group data of column (n3) in the BIN 16-bit data table (sorting source) of (n1×n2) points specified in (s) and store them in the specified in (d) (N1×n2) points in the BIN 16-bit data table (after sorting).
3981
3982 -[SORT (s)  (n1)  (n2)  (d)  (n3)]
3983
3984 **Content, range and data type**
3985
3986 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
3987 |=(s)|The start device number storing the data table|-|Signed BIN 16 bit|ANY16
3988 |=(n1)|Number of data (rows)|1 to 32|Signed BIN 16 bit|ANY16
3989 |=(n2)|Number of group data (columns)|1 to 6|Signed BIN 16 bit|ANY16
3990 |=(d)|The start device number storing the operation result|-|Signed BIN 16 bit|ANY16
3991 |=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 16 bit|ANY16
3992
3993 **Device used**
3994
3995 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
3996 **Index**
3997
3998 **modification**
3999 )))|=(((
4000 **Pulse**
4001
4002 **extension**
4003 )))
4004 |=**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4005 |=(% rowspan="5" %)SORT|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4006 |=Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4007 |=Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4008 |=Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4009 |=Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4010
4011 **Features**
4012
4013 The BIN 16-bit data table (sorting source) of (n1×n2) points specified in (s), based on the group data of column (n3), sort the data rows in ascending order, and store them in (d). The (n1×n2) point of the BIN 16-bit data table (after sorting).
4014
4015 Take (n1)=K3, (n2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (s) should be replaced with (d).
4016
4017 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**Number of groups (n2) ((n2)=K4)**
4018 |**Column NO. 1**|**Column NO. 2**|**Column NO. 3**|**Column NO. 4**
4019 |**Management number**|**Height**|**Weight**|**Age**
4020 |(% rowspan="3" %)When the number of data (n1)=3|Line NO.1|(s)|(s) +3|(s) +6|(s) +9
4021 |Line NO.2|(s)+1|(s) +4|(s) +7|(s) +10
4022 |Line NO.3|(s)+2|(s) +5|(s) +8|(s) +11
4023
4024 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON. According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.
4025
4026 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**Number of groups (n2) ((n2)=K4)**
4027 |**Column NO. 1**|**Column NO. 2**|**Column NO. 3**|**Column NO. 4**
4028 |**Management number**|**Height**|**Weight**|**Age**
4029 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)|(s) +5|(s) +10|(s) +15
4030 |1|150|45|20
4031 |(% rowspan="2" %)Line NO.2|(s)+1|(s) +6|(s) +11|(s) +16
4032 |2|180|50|40
4033 |(% rowspan="2" %)Line NO.3|(s)+2|(s) +7|(s) +12|(s) +17
4034 |3|160|70|30
4035 |(% rowspan="2" %)Line NO.4|(s) +3|(s) +8|(s) +13|(s) +18
4036 |4|100|20|8
4037 |(% rowspan="2" %)Line NO.5|(s) +4|(s) +9|(s) +14|(s) +19
4038 |5|150|50|45
4039
4040 Press (n3)=K2 (column number 2) to execute the sorting result.
4041
4042 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**Number of groups (n2) ((n2)=K4)**
4043 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4044 |**Management number**|**Height**|**Weight**|**Age**
4045 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +5|(d) +10|(d) +15
4046 |4|100|20|8
4047 |(% rowspan="2" %)Line NO.2|(d) +1|(d) +6|(d) +11|(d) +16
4048 |1|150|45|20
4049 |(% rowspan="2" %)Line NO.3|(d) +2|(d) +7|(d) +12|(d) +17
4050 |5|150|50|45
4051 |(% rowspan="2" %)Line NO.4|(d) +3|(d) +8|(d) +13|(d) +18
4052 |3|160|70|30
4053 |(% rowspan="2" %)Line NO.5|(d) +4|(d) +9|(d) +14|(d) +19
4054 |2|180|50|40
4055
4056 Press (n3)=K3 (column number 3) to execute the sorting result.
4057
4058 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**Number of groups (n2) ((n2)=K4)**
4059 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4060 |**Management number**|**Height**|**Weight**|**Age**
4061 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +5|(d) +10|(d) +15
4062 |4|100|20|8
4063 |(% rowspan="2" %)Line NO.2|(d) +1|(d) +6|(d) +11|(d) +16
4064 |1|150|45|20
4065 |(% rowspan="2" %)Line NO.3|(d) +2|(d) +7|(d) +12|(d) +17
4066 |2|180|50|40
4067 |(% rowspan="2" %)Line NO.4|(d) +3|(d) +8|(d) +13|(d) +18
4068 |5|150|50|45
4069 |(% rowspan="2" %)Line NO.5|(d) +4|(d) +9|(d) +14|(d) +19
4070 |3|160|70|30
4071
4072 (% class="box infomessage" %)
4073 (((
4074 **✎Note:**only ascending order is supported by SORT instruction .
4075
4076 Do not change the operand and data content during operation.
4077
4078 When executing again, the instruction input should be turned OFF once.
4079
4080 SORT instruction can drive at most one in the program.
4081
4082 When the same device is specified in (s) and (d), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (s) before the end of execution.
4083 )))
4084
4085
4086 **Error code**
4087
4088 |=**Error code**|=**Content**
4089 |=(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4090 |=When the value specified in (n2) exceeds the range of 1 to 6
4091 |=When the value specified in (n3) exceeds the range of 1 to n2
4092 |=4085H|When the device specified in read application instruction (s), (n1), (n2 )and (n3) exceeds the corresponding device range
4093 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4094 |=4087H|When the (d) parameter in the application instruction uses an unsupported device
4095 |=4089H|The number of application instructions exceeds the limit.
4096
4097 **Example**
4098
4099 Refer to the function description example.
4100
4101 (% style="text-align:center" %)
4102 [[image:图片9.png]]
4103
4104 == SORT2/16-bit Data Sorting ==
4105
4106 **SORT2(P)**
4107
4108 Sort the data rows in ascending or descending order based on the group data in column (n3), and store them in (d), based on the BIN 16-bit data table (sorting source) of (n1×n2) points specified in (s) In the BIN 16-bit data table (after sorting) of the specified (n1×n2) points.
4109
4110 -[SORT2 (s)  (n1)  (n2)  (d) (n3)]
4111
4112 **Content, range and data type**
4113
4114 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4115 |=(s)|The start device number storing the data table|-|Signed BIN 16 bit|ANY16
4116 |=(n1)|Number of data (rows)|1 to 32|Signed BIN 16 bit|ANY16
4117 |=(n2)|Number of group data (columns)|1 to 6|Signed BIN 16 bit|ANY16
4118 |=(d)|The start device number storing the operation result|-|Signed BIN 16 bit|ANY16
4119 |=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 16 bit|ANY16
4120
4121 **Device used**
4122
4123 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4124 **Index**
4125
4126 **modification**
4127 )))|=(((
4128 **Pulse**
4129
4130 **extension**
4131 )))
4132 |=**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4133 |=(% rowspan="5" %)SORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4134 |=Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4135 |=Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4136 |=Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4137 |=Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4138
4139 **Features**
4140
4141 Sort the data rows in ascending or descending order based on the group data in column (n3) and store them in (d) (N1×n2) point specified in the BIN 16-bit data table (after sorting).
4142
4143 Take (n1)=K3, (n2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (s) should be replaced with (d).
4144
4145 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4146 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4147 |**Management number**|**Height**|**Weight**|**Age**
4148 |(% rowspan="3" %)When the number of data (n1)=3|Line NO.1|(s)|(s)+1|(s) +2|(s) +3
4149 |Line NO.2|(s) +4|(s) +5|(s) +6|(s) +7
4150 |Line NO.3|(s) +8|(s) +9|(s) +10|(s) +100
4151
4152 Sequence is set by the ON/OFF status of SM165
4153
4154 |= |=**Sort order setting instruction**
4155 |SM165=ON|Descending
4156 |SM165=OFF|Ascending
4157
4158 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4159
4160 According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.
4161
4162 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4163 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4164 |**Management number**|**Height**|**Weight**|**Age**
4165 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)|(s)+1|(s) +2|(s) +3
4166 |1|150|45|20
4167 |(% rowspan="2" %)Line NO.2|(s) +4|(s) +5|(s) +6|(s) +7
4168 |2|180|50|40
4169 |(% rowspan="2" %)Line NO.3|(s) +8|(s) +9|(s) +10|(s) +100
4170 |3|160|70|30
4171 |(% rowspan="2" %)Line NO.4|(s) +12|(s) +13|(s) +14|(s) +15
4172 |4|100|20|8
4173 |(% rowspan="2" %)Line NO.5|(s) +16|(s) +17|(s) +18|(s) +19
4174 |5|150|50|45
4175
4176 Press (n3)=K2 (column number 2) to execute the sorting result (SM165=OFF in the case of ascending order)
4177
4178 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4179 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4180 |**Management number**|**Height**|**Weight**|**Age**
4181 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +1|(d) +2|(d) +3
4182 |4|100|20|8
4183 |(% rowspan="2" %)Line NO.2|(d) +4|(d) +5|(d) +6|(d) +7
4184 |1|150|45|20
4185 |(% rowspan="2" %)Line NO.3|(d) +8|(d) +9|(d) +10|(d) +100
4186 |5|150|50|45
4187 |(% rowspan="2" %)Line NO.4|(d) +12|(d) +13|(d) +14|(d) +15
4188 |3|160|70|30
4189 |(% rowspan="2" %)Line NO.5|(d) +16|(d) +17|(d) +18|(d) +19
4190 |2|180|50|40
4191
4192 Press (n3)=K3 (column number 3) to execute the sorting result (SM165=ON in the case of ascending order)
4193
4194 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4195 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4196 |**Management number**|**Height**|**Weight**|**Age**
4197 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +1|(d) +2|(d) +3
4198 |3|160|70|30
4199 |(% rowspan="2" %)Line NO.2|(d) +4|(d) +5|(d) +6|(d) +7
4200 |2|180|50|40
4201 |(% rowspan="2" %)Line NO.3|(d) +8|(d) +9|(d) +10|(d) +100
4202 |5|150|50|45
4203 |(% rowspan="2" %)Line NO.4|(d) +12|(d) +13|(d) +14|(d) +15
4204 |1|150|45|20
4205 |(% rowspan="2" %)Line NO.5|(d) +16|(d) +17|(d) +18|(d) +19
4206 |4|100|20|8
4207
4208 (% class="box infomessage" %)
4209 (((
4210 **✎Note: **Do not change the operand and data content during operation.
4211
4212 When executing again, the instruction input should be turned OFF once.
4213
4214 The SORT2 instruction can only be written in the program to drive 2 at most.
4215
4216 When the same device is specified in (s) and (d), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (s) before the end of execution.
4217
4218 Do not overlap the source data and the sorted data.
4219 )))
4220
4221 (% style="text-align:center" %)
4222 [[image:图片10.png]]
4223
4224 **Error code**
4225
4226 |=**Error code**|=**Content**
4227 |(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4228 |When the value specified in (n2) exceeds the range of 1 to 6
4229 |When the value specified in (n3) exceeds the range of 1 to n2
4230 |4085H|When the device specified in read application instruction (s), (d), (n1), (n2) and (n3) exceeds the corresponding device range
4231 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4232 |4089H|The number of application instructions exceeded the limit.
4233
4234 **Example**
4235
4236 Refer to the function description example.
4237
4238 (% style="text-align:center" %)
4239 [[image:图片11.png]]
4240
4241 == DSORT2/32-bit Data Sorting ==
4242
4243 **DSORT2(P)**
4244
4245 Sort the data rows in ascending or descending order based on the group data of column (n3) in the BIN 32-bit data table (sorting source) of (n1×n2) points specified in (s) and store them in (d) The specified (n1×n2) point BIN 32-bit data table (after sorting).
4246
4247 -[DSORT2 (s) (n1)  (n2)  (d)  (n3)]
4248
4249 **Content, range and data type**
4250
4251 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4252 |=(s)|The start device number storing the data table|-|Signed BIN 32 bit|ANY32
4253 |=(n1)|Number of data (rows)|1 to 32|Signed BIN 32 bit|ANY32
4254 |=(n2)|Number of group data (columns)|1 to 6|Signed BIN 32 bit|ANY32
4255 |=(d)|The start device number storing the operation result|-|Signed BIN 32 bit|ANY32
4256 |=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 32 bit|ANY32
4257
4258 **Device used**
4259
4260 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
4261 **Pulse**
4262
4263 **extension**
4264 )))
4265 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4266 |(% rowspan="5" %)DSORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4267 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4268 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4269 |Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4270 |Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4271
4272 **Features**
4273
4274 Sort the data rows in ascending or descending order based on the group data in the (n3) column of the (n1×n2) point BIN 32-bit data table (sorting source) specified in (s), and store to (d) (N1×n2) specified in the BIN 32-bit data table (after sorting).
4275
4276 Take (n1)=K3, (n2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (s) should be replaced with (d).
4277
4278 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4279 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4280 |**Management number**|**Height**|**Weight**|**Age**
4281 |(% rowspan="3" %)When the number of data (n1)=3|Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4282 |Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4283 |Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4284
4285 Sequence is set by the ON/OFF status of SM165
4286
4287 |= |=**Sort order setting instructions**
4288 |SM165=ON|Descending
4289 |SM165=OFF|Ascending
4290
4291 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4292
4293 According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.
4294
4295
4296 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4297 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4298 |**Management number**|**height**|**body weight**|**age**
4299 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4300 |1|150|45|20
4301 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4302 |2|180|50|40
4303 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4304 |3|160|70|30
4305 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4306 |4|100|20|8
4307 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4308 |5|150|50|45
4309
4310 Press (n3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)
4311
4312 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4313 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4314 |**Management number**|**height**|**body weight**|**age**
4315 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4316 |4|100|20|8
4317 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4318 |1|150|45|20
4319 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4320 |5|150|50|45
4321 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4322 |3|160|70|30
4323 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4324 |2|180|50|40
4325
4326 Press (n3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)
4327
4328 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4329 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4330 |**Management number**|**height**|**body weight**|**age**
4331 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4332 |3|160|70|30
4333 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4334 |2|180|50|40
4335 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4336 |5|150|50|45
4337 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4338 |1|150|45|20
4339 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4340 |4|100|20|8
4341
4342 **✎Note: **
4343
4344 Do not change the operand and data content during operation.
4345
4346 When executing again, the instruction input should be turned OFF once.
4347
4348 The SORT2 instruction can only be written twice in the program.
4349
4350 When the same device is specified in (s) and (d), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (s) before the end of execution.
4351
4352 Do not overlap the source data and the sorted data.
4353
4354
4355 **DSORT2(P)**
4356
4357 Sort the data rows in ascending or descending order based on the group data of column (n3) in the BIN 32-bit data table (sorting source) of (n1×n2) points specified in (s) and store them in (d) The specified (n1×n2) point BIN 32-bit data table (after sorting).
4358
4359 -[DSORT2 (s) (n1)  (n2)  (d)  (n3)]
4360
4361 **Content, range and data type**
4362
4363 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
4364 |(s)|The start device number storing the data table|-|Signed BIN 32 bit|ANY32
4365 |(n1)|Number of data (rows)|1 to 32|Signed BIN 32 bit|ANY32
4366 |(n2)|Number of group data (columns)|1 to 6|Signed BIN 32 bit|ANY32
4367 |(d)|The start device number storing the operation result|-|Signed BIN 32 bit|ANY32
4368 |(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 32 bit|ANY32
4369
4370 **Device used**
4371
4372 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
4373 **Pulse**
4374
4375 **extension**
4376 )))
4377 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4378 |(% rowspan="5" %)DSORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4379 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4380 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4381 |Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4382 |Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4383
4384 **Features**
4385
4386 Sort the data rows in ascending or descending order based on the group data in the (n3) column of the (n1×n2) point BIN 32-bit data table (sorting source) specified in (s), and store to (d) (N1×n2) specified in the BIN 32-bit data table (after sorting).
4387
4388 Take (n1)=K3, (n2)=K4 in the sort source as an example, the data table structure is as follows. In the case of a sorted data table, (s) should be replaced with (d).
4389
4390 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4391 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4392 |**Management number**|**Height**|**Weight**|**Age**
4393 |(% rowspan="3" %)When the number of data (n1)=3|Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4394 |Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4395 |Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4396
4397 Sequence is set by the ON/OFF status of SM165
4398
4399 | |**Sort order setting instructions**
4400 |SM165=ON|Descending
4401 |SM165=OFF|Ascending
4402
4403 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4404
4405 According to the source data sorted as follows, an example of the operation is shown below. In addition, by putting serial numbers such as management numbers in the first column in advance, the original row number can be judged based on the content, which is very convenient.
4406
4407
4408 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4409 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4410 |**Management number**|**height**|**body weight**|**age**
4411 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4412 |1|150|45|20
4413 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4414 |2|180|50|40
4415 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4416 |3|160|70|30
4417 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4418 |4|100|20|8
4419 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4420 |5|150|50|45
4421
4422 Press (n3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)
4423
4424 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4425 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4426 |**Management number**|**height**|**body weight**|**age**
4427 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4428 |4|100|20|8
4429 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4430 |1|150|45|20
4431 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4432 |5|150|50|45
4433 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4434 |3|160|70|30
4435 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4436 |2|180|50|40
4437
4438 Press (n3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)
4439
4440 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4441 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4442 |**Management number**|**height**|**body weight**|**age**
4443 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)+1, (s)|(s)+3, (s)+2|(s)+5, (s)+4|(s) +7, (s) +6
4444 |3|160|70|30
4445 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4446 |2|180|50|40
4447 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4448 |5|150|50|45
4449 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4450 |1|150|45|20
4451 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4452 |4|100|20|8
4453
4454 (% class="box infomessage" %)
4455 (((
4456 **✎Note:**Do not change the operand and data content during operation.
4457
4458 When executing again, the instruction input should be turned OFF once.
4459
4460 The SORT2 instruction can only be written twice in the program.
4461
4462 When the same device is specified in (s) and (d), the source data is rewritten to the sorted data order. Please pay special attention not to change the content of (s) before the end of execution.
4463
4464 Do not overlap the source data and the sorted data.
4465 )))
4466
4467 (% style="text-align:center" %)
4468 [[image:图片12.png]]
4469
4470 **Error code**
4471
4472 |=**Error code**|=**Content**
4473 |=(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4474 |=When the value specified in (n2) exceeds the range of 1 to 6
4475 |=When the value specified in (n3) exceeds the range of 1 to n2
4476 |=4085H|When the device specified in read application instruction (s), (d), (n1), (n2 )and (n3) exceeds the corresponding device range
4477 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4478 |=4089H|The number of application instructions exceeded the limit.
4479
4480 **Example**
4481
4482 Refer to the function description example.
4483
4484 (% style="text-align:center" %)
4485 [[image:图片13.png]]
4486
4487 == SWAP/16-bit Data High and Low Byte Swap ==
4488
4489 **SWAP(P) **
4490
4491 Swap the high and low 8-bit value of the device specified in (d).
4492
4493 -[SWAP (d)]
4494
4495 **Content, range and data type**
4496
4497 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4498 |(d)|Word device with high and low byte swap|-|Signed BIN 16 bit|ANY16
4499
4500 **Device used**
4501
4502 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4503 **Index**
4504
4505 **modification**
4506 )))|=(((
4507 **Pulse**
4508
4509 **extension**
4510 )))
4511 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4512 |SWAP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
4513
4514 **Features**
4515
4516 Convert the high and low 8-bit value of the device specified in (d).
4517
4518 (% style="text-align:center" %)
4519 [[image:图片14.png]]
4520
4521 **Error code**
4522
4523 |=**Error code**|=**Content**
4524 |=4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
4525 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4526
4527 **Example**
4528
4529 (% style="text-align:center" %)
4530 [[image:图片15.png]]
4531
4532 When the rising edge of M0 is triggered, swap the low 8 bits and high 8 bits of D0 to get H8F2A.
4533
4534 == DSWAP/32-bit Data High and Low Byte Swap ==
4535
4536 **DSWAP(P)**
4537
4538 The devices specified in (d) and (d)+1 will be converted to the high and low 8-bit values respectively.
4539
4540 -[DSWAP (d)]
4541
4542 **Content, range and data type**
4543
4544 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4545 |=(d)|Word device with high and low byte swap|-|Signed BIN 32 bit|ANY32
4546
4547 **Device used**
4548
4549 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4550 **Index**
4551
4552 **modification**
4553 )))|=(((
4554 **Pulse**
4555
4556 **extension**
4557 )))
4558 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4559 |DSWAP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
4560
4561 **Features**
4562
4563 The devices specified in (d) and (d)+1 will be converted to the upper and lower 8-bit values respectively.
4564
4565 (% style="text-align:center" %)
4566 [[image:图片16.png]]
4567
4568 (% class="box infomessage" %)
4569 (((
4570 **✎Note: **
4571 If continuous execution instructions are used, conversion will be performed every scan cycle.
4572 )))
4573
4574 **Error code**
4575
4576 |=**Error code**|=**Content**
4577 |4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
4578 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4579
4580 **Example**
4581
4582 (% style="text-align:center" %)
4583 [[image:图片17.png]]
4584
4585 When the rising edge of M0 is triggered, the low 8 bits and the high 8 bits of D0 and D1 are swapped, and D0=H8F2A, D1=H3412 are obtained.
4586
4587 (% style="text-align:center" %)
4588 [[image:图片18.png]]
4589
4590 == BTOW/Byte Unit Data Merge ==
4591
4592 **BTOW(P)**
4593
4594 Combine the low 8 bits of (n) bytes of BIN 16-bit data stored after the device number specified in (s) into word units and store it after the device number specified in (d).
4595
4596 -[BTOW (s)  (d) (n)]
4597
4598 **Content, range and data type**
4599
4600 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4601 |(s)|The start device that stores the data merging in byte units|-|Signed BIN 16 bit|ANY16
4602 |(d)|The start device that stores the result of merging in byte units|-|Signed BIN 16 bit|ANY16
4603 |(n)|Number of byte data merged|0-32767|Signed BIN 16 bit|ANY16
4604
4605 **Device used**
4606
4607 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4608 **Index**
4609
4610 **modification**
4611 )))|=(((
4612 **Pulse**
4613
4614 **extension**
4615 )))
4616 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4617 |(% rowspan="3" %)BTOW|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4618 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4619 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4620
4621 **Features**
4622
4623 After the device number specified in (s), the lower 8 bits of the 16-bit BIN data stored in (n) bytes are combined into word units and stored in the device number specified in (d) or later.
4624
4625 The upper 8 bits of (n) word data stored after the device number specified in (s) will be ignored. In addition, when (n) is an odd number, 0 is stored in the upper 8 bits of the device storing the (n)th byte of data.
4626
4627 (% style="text-align:center" %)
4628 [[image:图片19.png]]
4629
4630 £: the £th byte data;
4631
4632 (1): Ignore the high byte
4633
4634 *1: Carry below the decimal point.
4635
4636 **Example**
4637
4638 When (n)=5, the data up to the lower 8 bits of (s)+(s)+4 is stored in (d)+(d)+2.
4639
4640 (% style="text-align:center" %)
4641 [[image:图片20.png]]
4642
4643 (1): When (n)=5
4644
4645 (2): Change to 00H
4646
4647 By setting the number of bytes in (n), the range of byte data specified in (s) and the range of the device storing the combined data specified in (d) will be automatically determined.
4648
4649 When the number of bytes specified in (n) is 0, no processing is performed.
4650
4651 The upper 8 bits of the byte data storage device specified in (s) will be ignored, and the lower 8 bits will be the target.
4652
4653 **Example**
4654
4655 When the low 8 bits of D11 to D16 is stored in D12 to D14.
4656
4657 (% style="text-align:center" %)
4658 [[image:图片21.png]]
4659
4660 Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
4661
4662 |**Device range storing the data before merging**|**Device range for storing merged data**
4663 |(S)+0 to (s)+(n)-1|(D) to (d) + (n/2-1)
4664
4665 **Error code**
4666
4667 |=**Error code**|=**Content**
4668 |=4084H|The value specified in (n) exceed range of 0 to 32767
4669 |=4085H|When the device specified in the write application instruction (s),(d) and (n) exceeds the corresponding device range
4670
4671 **Example**
4672
4673 (% style="text-align:center" %)
4674 [[image:图片22.png]]
4675
4676 When M0 is ON, the data of D20 to D25 is separated according to byte units, and then stored in D10 to D12.
4677
4678 (% style="text-align:center" %)
4679 [[image:图片23.png]]
4680
4681 == WTOB/Byte Unit Data Separation ==
4682
4683 **WTOB(P)**
4684
4685 After separating the BIN 16-bit data stored after the device number specified in (s) into (n) bytes, store it after the device number specified in (d).
4686
4687 -[WTOB (s) (d)  (n)]
4688
4689 **Content, range and data type**
4690
4691 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4692 |=(s)|The start device that stores the data separation in byte unit|-|Signed BIN 16 bit|ANY16
4693 |=(d)|The start device that stores the result of separation in byte unit|-|Signed BIN 16 bit|ANY16
4694 |=(n)|Number of byte data separated|0-32767|Signed BIN 16 bit|ANY16
4695
4696 **Device used**
4697
4698 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
4699 **Pulse**
4700
4701 **extension**
4702 )))
4703 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4704 |(% rowspan="3" %)WTOB|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4705 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4706 |Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | |●|●| |●|●
4707
4708 **Features**
4709
4710 After separating the BIN 16-bit data stored after the device number specified in (s) into (n) bytes, store it after the device number specified in (d).
4711
4712 (% style="text-align:center" %)
4713 [[image:图片24.png]]
4714
4715 1. High byte;
4716 1. Low byte;
4717 1. High byte data;
4718 1. Low byte data;
4719 1. *1: Carry below the decimal point.
4720
4721 **Example**
4722
4723 In the case of (n)=5, store the data up to the lower 8 bits of (s) to (s)+2 in (d) to (d)+4:
4724
4725 (% style="text-align:center" %)
4726 [[image:图片25.png]]
4727
4728 1. (N)=5 is ignored.
4729 1. (N)=5.
4730
4731 By setting the number of bytes in (n), the range of BIN 16-bit data specified in (s) and the range of the device storing the byte data specified in (d) will be automatically determined.
4732
4733 When the number of bytes specified in (n) is 0, no processing is performed.
4734
4735 00H is automatically stored in the upper 8 bits of the byte data storage device specified in (d).
4736
4737 **Example**
4738
4739 When D12 to D14 is stored in the low 8 bits of D11 to D16
4740
4741 (% style="text-align:center" %)
4742 [[image:图片26.png]]
4743
4744 Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
4745
4746 |=**Device range storing the data before merging**|=**Device range storing separated data**
4747 |(s) to (s) + (n/2-1)|(d)+0 to (d)+(n)-1
4748
4749 **Error code**
4750
4751 |=**Error code**|=**Content**
4752 |=4084H|The value specified by (n) exceed the range of 0 to 32767
4753 |=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4754 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4755
4756 **Example**
4757
4758 (% style="text-align:center" %)
4759 [[image:图片27.png]]
4760
4761 When M0 is ON, the data of D10 to D12 are separated according to byte units, and then stored in D20 to D25.
4762
4763 (% style="text-align:center" %)
4764 [[image:图片28.png]]
4765
4766 == DIS/4-bit Separation of 16-bit Data ==
4767
4768 **DIS(P)**
4769
4770 Store the data of the low (n) bits (1 bit of 4 bits) of the BIN 16-bit data specified in (s) into the low 4-bit of the (n) point starting from the device specified in (d).
4771
4772 -[DIS (s) (d) (n)]
4773
4774 **Content, range and data type**
4775
4776 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4777 |=(s)|The start device storing the data before separation|-|Signed BIN 16 bit|ANY16
4778 |=(d)|The start device storing separated data|-|Signed BIN 16 bit|ANY16
4779 |=(n)|Separation number (0 means no processing)|0-4|Signed BIN 16 bit|ANY16
4780
4781 **Device used**
4782
4783 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4784 **Index**
4785
4786 **modification**
4787 )))|=(((
4788 **Pulse**
4789
4790 **extension**
4791 )))
4792 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4793 |(% rowspan="3" %)DIS|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4794 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4795 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4796
4797 **Features**
4798
4799 Store the low-(n) bit (1 bits of 4 bits) of the BIN 16-bit data specified in (s) in the low 4-bit of the (n) point starting from the device specified in (d).
4800
4801 (% style="text-align:center" %)
4802 [[image:图片29.png]]
4803
4804 The hig-12 bit of the point (n) starting from the device specified in (s) will become 0.
4805
4806 When (n)=0, it will become no processing, and the content of point (n) starting from the device of (d) will not change.
4807
4808 **Error code**
4809
4810 |=**Error code**|=**Content**
4811 |=4084H|The data in (n) exceed the range of 0 to 4
4812 |=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4813 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4814
4815 **Example**
4816
4817 (% style="text-align:center" %)
4818 [[image:图片30.png]]
4819
4820 When M0 is ON, D0 is separated every 4 bits and stored in D10 to D12. The result is D10 = HF, D11 = H8, D12 = HA.
4821
4822 == UNI/4-bit Combination of 16-bit Data ==
4823
4824 **UNI(P)**
4825
4826 Combine the low 4 bits of the BIN 16-bit data of point (n) starting from the device specified in (s) into the BIN 16-bit device specified in (d).
4827
4828 -[UNI (s) (d) (n)]
4829
4830 **Content, range and data type**
4831
4832 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4833 |=(s)|The start device storing the data before merging|-|Signed BIN 16 bit|ANY16
4834 |=(d)|The start device storing the merged data|-|Signed BIN 16 bit|ANY16
4835 |=(n)|Number of merger|0-4|Signed BIN 16 bit|ANY16
4836
4837 **Device used**
4838
4839 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4840 **Index**
4841
4842 **modification**
4843 )))|=(((
4844 **Pulse**
4845
4846 **extension**
4847 )))
4848 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4849 |(% rowspan="3" %)UNI|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4850 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
4851 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4852
4853 **Features**
4854
4855 Combine the low 4 bits of the BIN 16-bit data at point (n) starting from the device specified in (s) into the BIN 16-bit device specified in (d).
4856
4857 (% style="text-align:center" %)
4858 [[image:图片31.png]]
4859
4860 The high (4-n) bits of the device specified in (d) will become 0.
4861
4862 When (n)=0, it will become no processing, and the content of the device in (d) will not change.
4863
4864 **Error code**
4865
4866 |=**Code**|=**Content**
4867 |=4084H|The data in (n) exceed the range of 0 to 4
4868 |=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4869 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4870
4871 **Example**
4872
4873 (% style="text-align:center" %)
4874 [[image:图片32.png]]
4875
4876 When M0 is ON, the low 4 bits of D0 to D3 are combined and stored in D10, the value is H236F.
4877
4878 == ZRST/Data Batch Reset ==
4879
4880 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3496\wps2.png]]**ZRST(P)**
4881
4882 Perform a batch reset between the devices specified in (d1) and (d2) of the same type. It is used when interrupting operation, performing initial operation, or resetting control data.
4883
4884 -[ZRST ( d1)  (d2)]
4885
4886 **Content, range and data type**
4887
4888 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4889 |=(d1)|The start bit or word device number of batch reset|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
4890 |=(d2)|The final bit or word device number of batch reset|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
4891
4892 **Device used**
4893
4894 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4895 **Index**
4896
4897 **modification**
4898 )))|=(((
4899 **Pulse**
4900
4901 **extension**
4902 )))
4903 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4904 |(% rowspan="2" %)ZRST|Parameter 1| |●|●|●|●| | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
4905 |Parameter 2| |●|●|●|●| | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
4906
4907 **Features**
4908
4909 Perform batch reset between the devices specified in (d1) and (d2) of the same type.
4910
4911 (% style="text-align:center" %)
4912 [[image:图片33.png]]
4913
4914 When (d1) and (d2) are bit devices, write OFF (reset) in the entire device range of (d1) to (d2).
4915
4916 (% style="text-align:center" %)
4917 [[image:图片34.png]]
4918
4919 When (d1) and (d2) are word devices, write K0 in the entire device range of (d1) to (d2).
4920
4921
4922 As a separate reset instruction for the device, the RST instruction can be used for bit devices or word devices.
4923
4924 (% style="text-align:center" %)
4925 [[image:图片35.png]]
4926
4927 Reset M0
4928
4929 Reset the current value of T0
4930
4931 Reset D0
4932
4933
4934 The batch write instruction of constant (for example: K0) has FMOV (P) instruction, which can write 0 to word devices (including bit device specification).
4935
4936 (% style="text-align:center" %)
4937 [[image:图片36.png]]
4938
4939 Write K0 in D0 to D99.
4940
4941 (% class="box infomessage" %)
4942 (((
4943 **✎Note:**Please specify the same type number for (d1) and (d2), and make (d1) number <(d2) number. When (d1) number ≥ (d2) number, only 1 point will be reset for the device specified in (d1).
4944
4945 ZRST(P) instruction is a 16-bit instruction, which can specify (LC) and (HSC) devices for (d1) and (d2).
4946 )))
4947
4948 **Error code**
4949
4950 |=**Error code**|=**Content**
4951 |=4084H|When the device type specified in (d1) is different from the device type specified in (d2).
4952 |=4085H|When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
4953 |=4086H|When the device specified in the write application instruction (d1) exceeds the corresponding device range
4954
4955 **Example**
4956
4957 (% style="text-align:center" %)
4958 [[image:图片37.png]]
4959
4960 The function of this ladder diagram instruction is to set the value of the D0 to D100 device to 0.
4961
4962 == ZSET/Data Batch Set ==
4963
4964 **ZSET(P)**
4965
4966 Perform a batch set between the devices specified in (d1) and (d2) of the same type.
4967
4968 (% style="text-align:center" %)
4969 [[image:图片38.png]]
4970
4971 **Content, range and data type**
4972
4973 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type(label)**
4974 |=(d1)|The start bit device number of batch set|-|Bit|ANY_BOOL
4975 |=(d2)|The final bit device number of batch set|-|Bit|ANY_BOOL
4976
4977 **Device used**
4978
4979 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**
4980 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**
4981 |(% rowspan="2" %)ZSET|Parameter 1| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●
4982 |Parameter 2| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●
4983
4984 **Features**
4985
4986 ·Perform a batch set between the devices specified in (d1) and (d2) of the same type.
4987
4988 ·Write ON (set) in the entire device range of (d1) to (d2)
4989
4990 (% style="text-align:center" %)
4991 [[image:图片1.png]]
4992
4993 ·As a separate set instruction for the device, the SET instruction can be used for bit devices.
4994
4995 (% style="text-align:center" %)
4996 [[image:图片2.png]]
4997
4998 (% class="box infomessage" %)
4999 (((
5000 **✎Note: **
5001 Please specify the same type number for (d1) and (d2), and make (d1) number <(d2) number. When (d1) number ≥ (d2) number, only 1 point will be set for the device specified in (d1).
5002 )))
5003
5004 **Error code**
5005
5006 |=**Error code**|=**Content**
5007 |=4084H|When the device type specified in (d1) is different from the device type specified in (d2).
5008 |=4085H|When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
5009 |=4086H|When the device specified in the write application instruction (d1) exceeds the corresponding device range
5010 |=4087H|When the device type specified in (d1) and (d2) are not bit device.
5011
5012 **Example**
5013
5014 (% style="text-align:center" %)
5015 [[image:图片3.png]]
5016
5017 The function of this LAD instruction is to set the value of the M1 to M4 device to ON.
5018
5019
5020 == CRC/Cyclic Redundancy Check instruction ==
5021
5022 **CRC(P)**
5023
5024 Calculate the CRC (Cyclic Redundancy Check) value, which is one of the error checking methods used in communications. In addition to CRC, error checking methods include parity and
5025
5026 Sum check (checksum), calculate horizontal parity check value and sum check value can use CCD(P) instruction . And this instruction is used in the generator polynomial that generates the CRC value (CRC-16)
5027
5028 "X 16 +X 15 +X 2 +1".
5029
5030 -[CRC(P) (s) (d)  (n)]
5031
5032 **Content, range and data type**
5033
5034 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5035 |=(s)|The device start number storing the data of CRC value generated objects |-|Signed BIN16|ANY16
5036 |=(d)|The destination device number of the generated CRC value|-|Signed BIN16|ANY16
5037 |=(n)|The number of 8-bit data (bytes) for calculating the CRC value or the number of the device storing the number of data|1 to 256|Unsigned BIN16|ANY16_U
5038
5039 **Device used**
5040
5041 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5042 **Index**
5043
5044 **modification**
5045 )))|=(((
5046 **Pulse**
5047
5048 **extension**
5049 )))
5050 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5051 |(% rowspan="3" %)CRC|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
5052 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
5053 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| | |●
5054
5055 **Features**
5056
5057 Start with the device specified in (s), generate the CRC value of 8-bit data (byte unit) at (n) point, and store it in (d).
5058
5059 The mode used by this instruction in calculation includes 16-bit conversion mode and 8-bit conversion mode. For the operation of each mode, please refer to the following content.
5060
5061 1. 16-bit conversion mode (when SM161=OFF)
5062
5063 Calculate the upper 8 bits (byte) and lower 8 bits (byte) of the (s) device. The result is stored in 16 bits of 1 point of the device specified in (d). In the case of the following program, perform the conversion as shown below.
5064
5065 (% style="text-align:center" %)
5066 [[image:图片4.png]]
5067
5068 |(% colspan="3" rowspan="3" %) |(% colspan="3" %)**Example (s)=D100, (d)=D0, (n)=6**
5069 |(% rowspan="2" %)**Devices**|(% colspan="2" %)**Content of object data**
5070 |**8-bit**|**16-bit**
5071 |(% rowspan="9" %)CRC value generation target data storage destination|(% rowspan="2" %)(s)|Low byte|D100 low|01H|0301H
5072 |High byte|D100 high|03H|
5073 |(% rowspan="2" %)(s)+1|Low byte|D101 low|03H|0203H
5074 |High byte|D101 high|02H|
5075 |(% rowspan="2" %)(s)+2|Low byte|D102 low|00H|1400H
5076 |High byte|D102 high|14H|
5077 |...| |(% colspan="3" %)
5078 |(% rowspan="2" %)(s)+(n)/2-1|Low byte|(% colspan="3" rowspan="2" %)
5079 |High byte
5080 |(% rowspan="2" %)CRC value storage target|(% rowspan="2" %)(d)|Low byte|D0 low|E4H|41E4H
5081 |High byte|D0 high|41H|
5082
5083 2. 8-bit conversion mode (when SM8161=ON)
5084
5085 In 8-bit conversion mode, only the lower 8 bits (lower byte) of the (s) device are operated on. As a result, 2 points are used starting from the device specified in (d), the lower 8 bits (bytes) are stored in (d), and the upper 8 bits (bytes) are stored in (d)+1.
5086
5087 In the case of the following program, perform the conversion as shown below.
5088
5089 |(% colspan="3" rowspan="2" %) |(% colspan="2" %)**Example) (s)=D100, (d)=D0, (n)=6**
5090 |**Devices**|**Content of object data**
5091 |(% rowspan="8" %)CRC value generation target data storage destination|(s)|Low byte|D100 low|01H
5092 |(s)+1|Low byte|D101 low|03H
5093 |(s)+2|Low byte|D102 low|03H
5094 |(s)+3|Low byte|D103 low|02H
5095 |(s)+4|Low byte|D104 low|00H
5096 |(s)+5|Low byte|D105 low|14H
5097 |(% colspan="2" %)...|(% colspan="2" %)
5098 |(s)+(n)-1|Low byte|(% colspan="2" %)
5099 |(% rowspan="2" %)CRC value storage target|(d)|Low byte|D0|E4H
5100 |(d)+1|Low byte|D1|41H
5101
5102 In the CRC(P) instruction, the generator polynomial of the CRC value (CRC-16) uses "X16+X15+X2+1", but there are also many standardized generator polynomials for the CRC value. If the generator polynomial is different, it will become a completely different CRC value, which should be noted. The main CRC value generator polynomials are shown below.
5103
5104 |=**Name**|=**Generator polynomial**
5105 |=CRC-12|X^^12^^+X^^11^^+X^^3^^+X^^2^^+X+1
5106 |=CRC-16|X^^16^^+X^^15^^+X^^2^^+1
5107 |=CRC-32|X^^32^^+X^^26^^+X^^23^^+X^^22^^+X^^16^^+X^^12^^+X^^11^^+X^^10^^+X^^8^^+X^^7^^+X^^5^^+X^^4^^+X^^2^^+X+1
5108 |=CRC-CCITT|X^^16^^+X^^12^^+X^^5^^+1
5109
5110 (% class="box infomessage" %)
5111 (((
5112 **✎Note:
5113 **When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.
5114 )))
5115
5116 **Error code**
5117
5118 |=**Error code**|=**Content**
5119 |=4084H|The range of (n) exceeds 1 to 256
5120 |=4085H|The data address of (s) to be converted exceeds the device range
5121 |=4086H|The (d) write address exceeds the device range
5122 |=4087H|Unsupported device type is used by (s) and (d)
5123
5124 **Example**
5125
5126 * 16-bit conversion mode
5127
5128 (% style="text-align:center" %)
5129 [[image:图片6.png]]
5130
5131 * 8-bit conversion mode
5132
5133 (% style="text-align:center" %)
5134 [[image:图片7.png]]
5135
5136 = Matrix Input instructions =
5137
5138 == MTR/Matrix Input ==
5139
5140 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps1.png]]**MTR**
5141
5142 The instruction to read the input signal (switch) of 8 points multiply by n columns in the time division method of 8 input and (n) output (transistor).
5143
5144 -[MTR (s) (d1) (d2) (n)]
5145
5146 **Content, range and data type**
5147
5148 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5149 |(s)|The start device (X) number X000, X010, X020 of the row signal input of the matrix is up to the final input X number. 8 consecutively occupied.|The lowest bit number of X can only be 0|(((
5150 Bit
5151
5152
5153 )))|ANY_BOOL
5154 |(d1)|The starting device (Y) number of the column signal output of the matrix is Y000, Y010, Y020... to the final output Y number. 8 consecutively occupied.|The lowest bit number of Y can only be 0|Bit|ANY_BOOL
5155 |(d2)|The start device (Y, M, S) number of the ON output destination address is Y000, Y010, Y020..., M000, M010, M020..., S000, S010, S020... until the final Y, M, S number. Y occupies 8*(n) continuously, and the others occupy 10*(n) continuously.|-|Bit|ANY_BOOL
5156 |(n)|Set the number of columns in the matrix input.|2 to 8|Unsigned BIN 16 bit|ANY16_U
5157
5158 **Device used**
5159
5160 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5161 **Index**
5162
5163 **modification**
5164 )))|=(((
5165 **Pulse**
5166
5167 **extension**
5168 )))
5169 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5170 |(% rowspan="4" %)MTR|Parameter 1|●| | | | | | | | | | | | | | | | | | | | | | | | |
5171 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | | |
5172 |Parameter 3| |●|●|●|●| | | | | | | | | | | | | | | | | | | | |
5173 |Parameter 4| | | | | | | | | | | | | | | | | | | | | |●|●| | |
5174
5175 **Features**
5176
5177 (% style="text-align:center" %)
5178 [[image:图片8.png]]
5179
5180 This instruction generally uses the normally ON contact SM100.
5181
5182 (% style="text-align:center" %)
5183 [[image:图片9.png]]
5184
5185 According to the example in the figure:
5186
5187 M10 will turn ON when Y30 and X30 are connected, M14 will be ON when Y30 and X34 are connected, M26 will be ON when Y31 and X36 are connected
5188
5189 (D2) is recommended to use a minimum of 0, mainly when using an address such as M4, the first start is M4, and then it will continue to occupy M11, which is inconvenient to calculate and view, so it is recommended to use a software with a minimum of 0 element.
5190
5191 **Special device used**
5192
5193 |**Devices**|**Content**
5194 |SM229|SM229 will turn ON after one cycle of execution is completed
5195
5196 (% class="box infomessage" %)
5197 (((
5198 **✎Note: **
5199 The MTR instruction can only run one instruction at the same time.
5200 )))
5201
5202 **Error code**
5203
5204 |=**Error code**|=**Content**
5205 |(% rowspan="2" %)4085H|The read address of (s) and (n) exceeds the device range
5206 |(s) use the numbered device whose low bit is not 0
5207 |(% rowspan="2" %)4086HA|The write address of (d1) and (d2) exceeds the device range
5208 |(d2) use the numbered device whose low bit is not 0
5209 |4084H|(n) is not in the range of 2 to 8
5210 |4089H|Multiple MTR instructions are executed at the same time
5211
5212 = Convenient instructions =
5213
5214 == ABSD/BIN 16-bit Data Absolute Method ==
5215
5216 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps2.png]]**ABSD**
5217
5218 Create multiple output modes corresponding to the current counter (BIN 16-bit value).
5219
5220 -[ABSD (s1) (s2)  (d) (n)]
5221
5222 **Content, range and data type**
5223
5224 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5225 |=(s1)|(((
5226 The start device number storing the data table
5227
5228 (rising edge point and falling edge point)
5229 )))|-|Signed BIN 16 bit|ANY16
5230 |=(s2)|The counter number used for monitoring of the current value compared to the data table|-|Signed BIN 16 bit|ANY16
5231 |=(d)|The number of points of the output start device|-|Bit|ANY16_BOOL
5232 |=(n)|Number of table rows and output bit device points|1 to 64|Signed BIN 16 bit|ANY16
5233
5234 **Device used**
5235
5236 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5237 **Index**
5238
5239 **modification**
5240 )))|=(((
5241 **Pulse**
5242
5243 **extension**
5244 )))
5245 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5246 |(% rowspan="4" %)ABSD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5247 |Parameter 2| | | | | | | | | | | | | | | |●| | | | | | | | |●|
5248 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5249 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5250
5251 **Features**
5252
5253 Take the turntable to rotate 1 revolution (0 to 360 degrees) to control the output ON/OFF as an example. (1 degree, 1 pulse angle signal)
5254
5255 Compare the data table of row (n) starting from (s1) (row (n) multiply by 2 points) with the current value of the counter (s2), from (d) to continuous (n) in the course of one revolution The output is ON/OFF control up to the point.
5256
5257 (% style="text-align:center" %)
5258 [[image:图片10.png]]
5259
5260 Use the transfer instruction to write the following data into (s1) to (s1)+2(n)-1 in advance. For example, the rising edge point data stores 16-bit data to even-numbered devices in advance, and the falling edge point data stores 16-bit data to odd-numbered devices in advance.
5261
5262 |=(% colspan="2" %)**Rising edge point**|=(% colspan="2" %)**Falling edge point**|=(% rowspan="2" %)**Object output**
5263 |**-**|**Data value (example)**|**-**|**Data value (example)**
5264 |(S1)|40|(S1)+1|140|(D)
5265 |(S1)+2|100|(S1) +3|200|(D) +1
5266 |(S1) +4|160|(S1) +5|60|(D) +2
5267 |(S1) +6|240|(S1) +7|280|(D) +3
5268 |...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
5269 |(S1)+2(n)-2|(S1)+2(n)-1|(D) +n-1
5270
5271 If the instruction input is set to ON, (d) is the start, (n) point is the output mode as shown below. Each rising edge point and falling edge point can be individually changed by rewriting the data from (s1) to (s1)+2(n)-1.
5272
5273 (% style="text-align:center" %)
5274 [[image:图片11.png]]
5275
5276 (% class="box infomessage" %)
5277 (((
5278 **✎Note: **When specifying the number of bit devices in (s1), the device number should be a multiple of 16 (0, 16, 32, 64...), and only K4 should be specified for the number of bits.
5279
5280 The number of target output points is determined by the value of (n). (1≤(n)≤64)
5281
5282 Even if the instruction input is turned off, the output does not change.
5283 )))
5284
5285 **Error code**
5286
5287 |=**Error code**|=**Content**
5288 |=4084H|When the value specified in (n) exceeds the range of 1 to 64
5289 |=4085H|When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
5290 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5291
5292 **Example**
5293
5294 Refer to the example in the function description.
5295
5296 == DABSD/BIN 32-bit Data Absolute Method ==
5297
5298 **DABSD**
5299
5300 Create multiple output modes corresponding to the current counter (BIN 32-bit value).
5301
5302 -[DABSD  (s1)  (s2) (d) (n)]
5303
5304 **Content, range and data type**
5305
5306 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5307 |=(s1)|(((
5308 The start device number storing the data table
5309
5310 (rising edge point and falling edge point)
5311 )))|-|Signed BIN 32 bit|ANY32
5312 |=(s2)|The counter number used for monitoring of the current value compared to the data table|-|Signed BIN 32 bit|ANY32
5313 |=(d)|The number of points of the output start device|-|Bit|ANY16_BOOL
5314 |=(n)|Number of table rows and output bit device points|1 to 64|Signed BIN 32 bit|ANY32
5315
5316 **Device used**
5317
5318 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
5319 **Pulse**
5320
5321 **extension**
5322 )))
5323 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5324 |(% rowspan="4" %)DABSD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|
5325 |Parameter 2| | | | | | | | | | | | | | | |●| | | |●|●| | | |●|
5326 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5327 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
5328
5329 **Features**
5330
5331 Take the turntable to rotate 1 revolution (0 to 360 degrees) to control the output ON/OFF as an example. (1 degree, 1 pulse angle signal)
5332
5333 Compare the data table of row (n) starting from (s1) (row (n) × 4 points) with the current value of the counter (s2), from (d) to continuous (n) in the course of one revolution The output is ON/OFF control up to the point.
5334
5335 (% style="text-align:center" %)
5336 [[image:图片12.png]]
5337
5338 Use the transfer instruction to write the following data into (s1), (s1)+1 to (s1)+4(n)-2, (s1)+4(n)-1 in advance. For example, the rising edge point data stores 32-bit data to even-numbered devices in advance, and the falling edge point data stores 32-bit data to odd-numbered devices in advance.
5339
5340 |=(% colspan="2" %)**Rising edge point**|=(% colspan="2" %)**Falling edge point**|=(% rowspan="2" %)**Object output**
5341 |**-**|**Data value (example)**|**-**|**Data value (example)**
5342 |(S1)+1, (S1)|40|(S1)+3, (S1)+2|140|(D)
5343 |(S1)+5, (S1)+4|100|(S1) +7, (S1) +6|200|(D) +1
5344 |(S1) +9, (S1) +8|160|(S1)+11, (S1)+10|60|(D) +2
5345 |(S1) +13, (S1) +12|240|(S1) +15, (S1) +14|280|(D) +3
5346 |...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
5347 |(((
5348 (S1)+4(n)-3,
5349
5350 (S1)+4(n)-4
5351 )))|(((
5352 (S1)+4(n)-1,
5353
5354 (S1)+4(n)-2
5355 )))|(D) +n-1
5356
5357 If the instruction input is set to ON, (d) is the start, (n) point is the output mode as shown below. Each rising edge point and falling edge point can be individually changed by rewriting the data from (s1) to (s1)+2(n)-1.
5358
5359 (% style="text-align:center" %)
5360 [[image:图片13.png]]
5361
5362 (% class="box infomessage" %)
5363 (((
5364 **✎Note: **The high-speed counter can be specified in the DABSD instruction. When a high-speed counter is specified, the current value of the counter will have a response delay due to the scan cycle in the output mode.
5365
5366 When specifying the number of bit devices in (s1), the device number should be a multiple of 16 (0, 16, 32, 64...), and only K8 should be specified for the number of bits.
5367
5368 The number of target output points is determined by the value of (n). (1≤(n)≤64)
5369
5370 Even if the instruction input is turned off, the output does not change.
5371 )))
5372
5373 **Error code**
5374
5375 |=**Error code**|=**Content**
5376 |=4084H|When the value specified in (n) exceeds the range of 1 to 64
5377 |=4085H|When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
5378 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5379
5380 **Example**
5381
5382 Refer to the example in the function description.
5383
5384 == SER/16-bit Data Search ==
5385
5386 **SER(P)**
5387
5388 Search the same data and the maximum and minimum values from the data table.
5389
5390 -[SER (s1) (s2)  (d) (n)]
5391
5392 **Content, range and data type**
5393
5394 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5395 |=(s1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 16 bit|ANY16
5396 |=(s2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 16 bit|ANY16
5397 |=(d)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 16 bit|ANY16
5398 |=(n)|Search the number of same data, maximum and minimum|1 to 256|Signed BIN 16 bit|ANY16
5399
5400 **Device used**
5401
5402 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5403 **Index**
5404
5405 **modification**
5406 )))|=(((
5407 **Pulse**
5408
5409 **extension**
5410 )))
5411 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5412 |(% rowspan="3" %)SER|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
5413 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |● |● | |●|●
5414 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
5415 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
5416
5417 **Features**
5418
5419 For (s1) as the first (n) data, search for the same data as the BIN 16-bit data of (s2), and store the result in (d) to (d)+4.
5420
5421 In the case of the same data, the number of the same data, the first/final position, and the maximum and minimum positions of the same data are stored in the device with the first 5 points (d).
5422
5423 If there is no identical data, the number of identical data, the first/final position, and the maximum and minimum positions of the same data are stored in the device with the first 5 points (d). However, in (d) is the first 3 points of the device (the number of the same data, the first ~\~\ final position), 0 is stored.
5424
5425 • The structure and data examples of the search result table are as follows. (N=10)
5426
5427 |=(% rowspan="2" %)**The searched device (s1)**|=(% rowspan="2" %)(((
5428 **The value of the**
5429
5430 **searched data (s1)**
5431 )))|=(% rowspan="2" %)(((
5432 **Comparison data**
5433
5434 **(S2) value**
5435 )))|=(% rowspan="2" %)**Data location**|=(% colspan="3" %)**search results**
5436 |**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
5437 |(s1)|K100|(% rowspan="10" %)K100|0| |○(First time)|
5438 |(s1)+1|K111|1| | |
5439 |(s1)+2|K100|2| |○|
5440 |(s1) +3|K98|3| | |
5441 |(s1) +4|K123|4| | |
5442 |(s1) +5|K66|5| | |○
5443 |(s1) +6|K100|6| |○ (final)|
5444 |(s1) +7|K95|7| | |
5445 |(s1) +8|210|8|○| |
5446 |(s1) +9|K88|9| | |
5447
5448 • The search result table based on the above example is shown below.
5449
5450 |=**Device number**|=**Content**|=**Search result items**
5451 |(d)|3|Number of identical data
5452 |(d) +1|0|The position of the same data (first time)
5453 |(d) +2|6|The position of the same data (last time)
5454 |(d) +3|5|The final position of the minimum
5455 |(d) +4|8|The final position of maximum
5456
5457 (% class="box infomessage" %)
5458 (((
5459 **✎Note: **Perform algebraic size comparison. (-10<2)
5460
5461 When there are multiple minimum and maximum values in the data, the positions behind each are stored.
5462
5463 If driven by this instruction, the search result (d) occupies 5 points of (d), (d)+1, (d)+2, (d)+3, (d)+4. Be careful not to overlap with the device used for machine control.
5464 )))
5465
5466 **Error code**
5467
5468 |=**Error code**|=**Content**
5469 |=4084H|When the value specified in (n) exceeds the range of 0 to 256
5470 |=4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5471 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5472
5473 **Example**
5474
5475 Refer to the example in the function description.
5476
5477 == DSER/32-bit Data Search ==
5478
5479 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps3.png]]**DSER(P)**
5480
5481 Search the same data and the maximum and minimum values from the data table.
5482
5483 -[DSER (s1)  (s2) (d) (n)]
5484
5485 **Content, range and data type**
5486
5487 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5488 |=(s1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 32 bit|ANY32
5489 |=(s2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 32 bit|ANY32
5490 |=(d)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 32 bit|ANY32
5491 |=(n)|Search the number of same data, maximum and minimum|1 to 128|Signed BIN 32 bit|ANY32
5492
5493 **Device used**
5494
5495 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5496 **Index**
5497
5498 **modification**
5499 )))|=(((
5500 **Pulse**
5501
5502 **extension**
5503 )))
5504 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5505 |(% rowspan="3" %)DSER|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
5506 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
5507 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
5508 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
5509
5510 **Features**
5511
5512 For (s1)+1, (s1) as the initial (n) data, search for the same data as the BIN 32-bit data of (s2)+1, (s2), and store the result in (d)+1, (D) to (d) +9, (d) +8.
5513
5514 In the case of the same data, the number of the same data, the first/final position and the maximum and minimum values are stored in a 5-point BIN 32-bit data device starting with (d)+1 and (d) position.
5515
5516 In the case of no identical data, the number of identical data, the first/final position and the maximum and minimum values are stored in the device with (d)+1 and (d) as the starting BIN 32-bit data with 5 points position. However, 0 is stored in the 32-bit 3-point device (the number of the same data, the first~\~\last position) with (d)+1 and (d) as the starting BIN.
5517
5518 • The structure and data examples of the search result table are as follows. (N=10)
5519
5520 |=(% rowspan="2" %)**The searched device (S1)**|=(% rowspan="2" %)**The value of the searched data (S1)**|=(% rowspan="2" %)**Comparison data (S2) value**|=(% rowspan="2" %)**Data location**|=(% colspan="3" %)**search results**
5521 |**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
5522 |(S1)+1, (S1)|K100|(% rowspan="10" %)K100|0| |○ (First time)|
5523 |(S1)+3, (S1)+2|K111|1| | |
5524 |(S1)+5, (S1)+4|K100|2| |○|
5525 |(S1) +7, (S1) +6|K98|3| | |
5526 |(S1) +9, (S1) +8|K123|4| | |
5527 |(S1)+11, (S1)+10|K66|5| | |○
5528 |(S1) +13, (S1) +12|K100|6| |○ (final)|
5529 |(S1) +15, (S1) +14|K95|7| | |
5530 |(S1) +17, (S1) +16|210|8|○| |
5531 |(S1) +19, (S1) +18|K88|9| | |
5532
5533 • The search result table based on the above example is shown below.
5534
5535 |=**Device number**|=**Content**|=**Search result items**
5536 |(d)+1, (d)|3|Number of identical data
5537 |(d)+3, (d)+2|0|The position of the same data (first time)
5538 |(d) +5, (d) +4|6|The position of the same data (last time)
5539 |(d) +7, (d) +6|5|The final position of the minimum
5540 |(d) +9, (d) +8|8|The final position of maximum
5541
5542 (% class="box infomessage" %)
5543 (((
5544 **✎Note: **Perform algebraic size comparison. (-10<2)
5545
5546 When there are multiple minimum and maximum values in the data, the positions behind each are stored.
5547
5548 If driven by this instruction, the search result (d) occupies [(d)+1, (d)], [(d)+3, (d)+2,], [(d)+5, (d)+ 4], [(d)+7, (d)+6], [(d)+9, (d)+8] 5 points. Be careful not to overlap with the device used for machine control.
5549 )))
5550
5551 **Error code**
5552
5553 |=**Error code**|=**Content**
5554 |4084H|When the value specified in (n) exceeds the range of 0 to 128
5555 |4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5556 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5557
5558 **Example**
5559
5560 Refer to the example in the function description.
5561
5562 == ALT/Bit Device Output Inversion ==
5563
5564 **ALT(P)**
5565
5566 If the input turns ON, the bit device is inverted (ON→OFF).
5567
5568 -[ALT (d)]
5569
5570 **Content, range and data type**
5571
5572 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5573 |(d)|Alternate output device number|-|Bit|ANY16_BOOL
5574
5575 **Device used**
5576
5577 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5578 **Index**
5579
5580 **modification**
5581 )))|=(((
5582 **Pulse**
5583
5584 **extension**
5585 )))
5586 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5587 |ALT|Parameter 1| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
5588
5589 **Features**
5590
5591 Alternating output (level 1)
5592
5593 Each time the instruction input changes from OFF→ON, the bit device specified in (d) is turned OFF→ON inverted.
5594
5595 (% style="text-align:center" %)
5596 [[image:图片14.png]]
5597
5598 (% style="text-align:center" %)
5599 [[image:图片15.png]]
5600
5601 Divided frequency output (through alternate output (2 levels))
5602
5603 Combine multiple ALTP instructions to perform frequency division output.
5604
5605 (% style="text-align:center" %)
5606 [[image:图片16.png]]
5607
5608 (% style="text-align:center" %)
5609 [[image:图片17.png]]
5610
5611 (% class="box infomessage" %)
5612 (((
5613 **✎Note:**
5614 If you program with the ALT instruction, the action will be reversed every operation cycle. To reverse the action by the instruction ON→OFF, use the ALT instruction (pulse execution type) or set the instruction contact to LDP (pulse execution type).
5615 )))
5616
5617 **Error code**
5618
5619 |=**Error code**|=**Content**
5620 |=4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
5621 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5622
5623 **Example**
5624
5625 (1)Start/stop via an input.
5626
5627 1. After pressing the button X4, start the action of output Y1 and stop the action of Y0.
5628 1. After pressing the button X4 again, stop the action of output Y1 and start the action of Y0.
5629
5630 (% style="text-align:center" %)
5631 [[image:图片18.png]]
5632
5633 (2)Flashing action
5634
5635 1. When input X6 is ON, the contact of timer T2 will act instantaneously every 5 seconds.
5636 1. The contact of T2 makes the output Y7 alternately ON/OFF every time it is ON.
5637
5638 (% style="text-align:center" %)
5639 [[image:图片19.png]]
5640
5641 (% style="text-align:center" %)
5642 [[image:图片20.png]]
5643
5644 == INCD/BIN 16-bit Data Relative Method ==
5645
5646 **INCD**
5647
5648 Use a pair of counters to create multiple output modes.
5649
5650 -[INCD (s1) (s2) (d) (n)]
5651
5652 **Content, range and data type**
5653
5654 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5655 |(s1)|The start device number storing the set value|-|Signed BIN 16 bit|ANY16
5656 |(s2)|The start number of counter for current value monitoring|-|Signed BIN 16 bit|ANY16
5657 |(d)|The start bit device number of output|-|Bit|ANY16_BOOL
5658 |(n)|Number of output bit device points|1 to 64|Signed BIN 16 bit|ANY16
5659
5660 **Device used**
5661
5662 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5663 **Index**
5664
5665 **modification**
5666 )))|=(((
5667 **Pulse**
5668
5669 **extension**
5670 )))
5671 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5672 |(% rowspan="4" %)INCD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5673 |Parameter 2| | | | | | | | | | | | | | | |●| | | | | | | | |●|
5674 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5675 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5676
5677 **Features**
5678
5679 Compare the data table of row (n) starting from (s1) (row (n) × 2 points occupied) with the current value of the counter (s2), reset if they match, and control the output on/off in turn.
5680
5681 **Example**
5682
5683 The operation is explained by the following circuit example. (S2) Take up 2 points. C0 and C1 are equivalent to this in the following timing chart.
5684
5685 (% style="text-align:center" %)
5686 [[image:图片21.png]]
5687
5688 It is assumed that the following data is written using the transfer instruction in advance.
5689
5690 |(% colspan="2" %)**Storage device**|(% colspan="2" %)**Output**
5691 |**-**|**Data value (example)**|**-**|**Example**
5692 |(S1)|D300=20|(D)|M0
5693 |(S1)+1|D301=30|(D) +1|M1
5694 |(S1)+2|D302=10|(D) +2|M2
5695 |(S1) +3|D303=40|(D) +3|M3
5696 |...|....|...|...
5697 |(S1)+(n)-1|-|(D) +n-1|-
5698
5699 Timing diagram
5700
5701 (% style="text-align:center" %)
5702 [[image:图片22.png]]
5703
5704 If the instruction contact turns on, the M0 output turns on.
5705
5706 The output (M0) is reset when the current value of C0 reaches the comparison value D300, the count value of the process counter C1 is +1, and the current value of the counter C0 is also reset.
5707
5708 The next output M1 turns ON.
5709
5710 Compare the current value of C0 with the comparison value D301. When the comparison value is reached, the output M1 is reset, the count value of the process counter C1 is +1, and the current value of the counter C0 is also reset.
5711
5712 Compare the same to the point (K4) specified in (n). (1≤(n)≤64)
5713
5714 After the final process specified in (n) is completed, the execution end flag SM229 turns ON for 1 operation cycle. SM229 is the instruction execution end flag used in multiple instructions, so it should be used as a contact after the instruction to execute the end flag dedicated to the instruction.
5715
5716 Return to the beginning and repeat output.
5717
5718 (% class="box infomessage" %)
5719 (((
5720 **✎Note:**In (s1), when specifying the device number by specifying the digits of the bit device, the device number should be a multiple of 16 (0, 16, 32, 64...).
5721
5722 Up to 4 INCD instructions can be driven simultaneously in the program.
5723 )))
5724
5725 **Error code**
5726
5727 |=**Error code**|=**Content**
5728 |4084H|When the value specified in (n) exceeds the range of 1 to 64
5729 |4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5730 |4086H|When the device specified in the write application instruction (s2) and (d) exceeds the corresponding device range
5731 |4089H|The number of instruction drives exceeds the limit.
5732
5733 **Example**
5734
5735 Refer to the example in the function description.
5736
5737 == RAMP/Control Ramp Signal ==
5738
5739 **RAM(P)**
5740
5741 Obtain data that changes between the start (initial value) and end (target value) two values specified (n) times.
5742
5743 -[RAMP  (s1)  (s2)  (d)  (n)]
5744
5745 **Content, range and data type**
5746
5747 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5748 |(s1)|The device number that stores the initial value of the set ramp|-|Signed BIN 16 bit|ANY16
5749 |(s2)|The device number that stores the set ramp target value|-|Signed BIN 16 bit|ANY16
5750 |(d)|The device number that stores the current value data of ramp|-|Signed BIN 16 bit|ANY16
5751 |(n)|Ramp transition time (scan period)|1-32767|Signed BIN 16 bit|ANY16
5752
5753 **Device used**
5754
5755 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5756 **Index**
5757
5758 **modification**
5759 )))|=(((
5760 **Pulse**
5761
5762 **extension**
5763 )))
5764 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5765 |(% rowspan="4" %)RAMP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5766 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5767 |Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
5768 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5769
5770 **Features**
5771
5772 Specify the start value (s1) and the value to end (s2) in advance. If the instruction input is turned ON, the value divided by the number of times specified in (n) will be added to (s1) in sequence in each operation cycle The value of is stored in (d). This instruction and analog output can be combined to output soft start/stop instructions.
5773
5774 (% style="text-align:center" %)
5775 [[image:图片23.png]]
5776
5777 (d)+1 stores the number of scans (0→n times).
5778
5779 The time from the start to the end value requires operation cycle×(n) scan.
5780
5781 If the input instruction is turned OFF during operation, it will be in the execution interrupt state ((d): current value data retention. (d)+1 scan times clear), if it is turned ON again, (d) will be cleared (S1) Restart the action.
5782
5783 After the transition is completed, the instruction execution completed flag SM229 will act, and the value of (d) will return to the value of (s1).
5784
5785 (% style="text-align:center" %)
5786 [[image:图片24.png]]
5787
5788 In the case of obtaining the calculation result at a certain time interval (constant scan mode), write the specified scan time to SD120 (a value slightly longer than the actual scan time), and turn on SM120. For example, when the value is specified as 20 ms and n=100 times, the value of (d) changes from (s1) to (s2) in 2 seconds.
5789
5790 The value of the constant scan mode can also be set by the parameter setting of the engineering tool (the constant scan execution interval setting of the CPU parameter).
5791
5792 According to the ON/OFF action of the mode flag SM226, the content of (d) is changed as shown below.
5793
5794 (% style="text-align:center" %)
5795 [[image:图片25.png]]
5796
5797 (% class="box infomessage" %)
5798 (((
5799 **✎Note: **
5800 When the power failure retention device (retention area) is specified in (d), the instruction input remains ON. When the CPU module is set to RUN (start), clear (d) in advance.
5801 )))
5802
5803 **Error code**
5804
5805 |=**Error code**|=**Content**
5806 |4084H|When the value specified in (n) exceeds the specified range of 1 to 32767
5807 |4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5808 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5809
5810 **Example**
5811
5812 (% style="text-align:center" %)
5813 [[image:图片26.png]]
5814
5815 As in the above procedure, turn SM120 ON, and the program will run with a constant scan cycle (the value in SD120 is 10ms). When M0=ON, it changes from 10 to 100 within 100×10ms.
5816
5817 == ROTC/Rotary Table Proximity Control ==
5818
5819 **ROTC**
5820
5821 In order to take out the items on the rotating table, take out the window according to the requirements, and make the rotating table rotate nearby.
5822
5823 -[ROTC (s)  (n1)  (n2)  (d)]
5824
5825 **Content, range and data type**
5826
5827 |=**Parameter**|=(% colspan="2" %)**Content**|=**Range**|=**Data type**|=**Data type (label)**
5828 |(% rowspan="3" %)(s)|(% rowspan="3" %)The specified register of the calling condition (pre-set according to the transfer instruction)|(s)+0: Register for counting|(% rowspan="3" %)-|(% rowspan="3" %)Signed BIN 16 bit|(% rowspan="3" %)ANY16
5829 |(s)+1: Call the window number setting
5830 |(s)+2: Call the item number setting
5831 |(n1)|(% colspan="2" %)Number of divisions|2 to 32767|Signed BIN 16 bit|ANY16
5832 |(n2)|(% colspan="2" %)Singular in low speed zone|0 to 32767|Signed BIN 16 bit|ANY16
5833 |(% rowspan="8" %)(((
5834
5835
5836 (d)
5837 )))|(% rowspan="8" %)The specified bit of the calling condition (constitutes an internal contact circuit driven in advance from the input signal (X))|(d): phase A signal|(% rowspan="8" %)-|(% rowspan="8" %)Signed BIN 16 bit|(% rowspan="8" %)ANY16
5838 |(d)+1: phase B signal
5839 |(d)+2: zero point detection signal
5840 |(d)+3: high-speed forward rotation
5841 |(d)+4: low speed forward rotation
5842 |(d)+5: stop
5843 |(d)+6: low speed reverse rotation
5844 |(d)+7: high-speed reverse rotation
5845
5846 **Device used**
5847
5848 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5849 **Index**
5850
5851 **modification**
5852 )))|=(((
5853 **Pulse**
5854
5855 **extension**
5856 )))
5857 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5858 |(% rowspan="4" %)ROTC|Parameter 1| | | | | | | | | | | | | | | | |●|●|●| | | | | |●|
5859 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5860 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5861 |Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5862
5863 **Features**
5864
5865 In order to take out the items on the rotating table divided into n1 (=10) as shown in the figure below, take out the inserted window as required, and rotate the rotating table nearby under the condition of n2 or (s), (d) . If the following operating conditions are specified, (d)+3 to (d)+7 can be used for forward/reverse, high-speed/low-speed/stop output.
5866
5867 (% style="text-align:center" %)
5868 [[image:图片27.png]]
5869
5870 Set up the switch X2 that is used to detect the two-phase shape (X0, X1) of the forward/reverse rotation of the rotary table and window 0. Replace X0 to X2 with (d) to (d) +2 internal contacts. The start device number specified in X or (d) can be arbitrary.
5871
5872 (% style="text-align:center" %)
5873 [[image:图片28.png]]
5874
5875 (s) is a counter, which counts how many items come to window 0.
5876
5877 (s)+1 set the number of the window to be called.
5878
5879 (s)+2 sets the number of the recalled item.
5880
5881 Specify the number of divisions (n1) and low-speed operation section (n2) of the rotary table.
5882
5883 (% class="box infomessage" %)
5884 (((
5885 **✎Note: **If the instruction input is turned ON to drive the instruction, the result of (d)+3 to (d)+7 will be automatically obtained. If the instruction input is turned off, (d)+3 to (d)+7 will turn off.
5886
5887 As an example, when the rotation detection signal ((d) to (d)+2) is set to 10 actions within 1 division interval, the division number setting, calling window number setting, and article number setting should all be 10 Times the value. In this way, the setting value of the low-speed section can be set to the middle value of the number of divisions, etc.
5888
5889 When the instruction input is ON and the 0 point detection signal (M2) is turned ON, the content of the counting register (s) is cleared to 0. It is necessary to perform this clear operation in advance before starting operation.
5890
5891 At most 4 ROTC instructions can be executed at the same time.
5892 )))
5893
5894 **Error code**
5895
5896 |=**Error code**|=**Content**
5897 |(% rowspan="5" %)4084H|When the value specified in (n1) exceeds the range of 2 to 32767
5898 |When the value specified in (n2) exceeds the range of 0 to 32767
5899 |When the values specified in (n1) and (n2) meet the condition of (n1)<(n2)
5900 |When one of (s), (s)+1 and (s)+2 is negative.
5901 |When one of (s), (s)+1 and (s)+2 is (n1) or more.
5902 |4085H|When the device specified in read application instruction (s1), (n1), (n2) and (d) exceeds the corresponding device range
5903 |4086H|When the device specified in the write application instruction (s2) and (d) exceeds the corresponding device range
5904 |4089H|The number of instructions to be executed exceeds the limit.
5905
5906 **Example**
5907
5908 (% style="text-align:center" %)
5909 [[image:图片29.png]]
5910
5911
5912 |=**Variable**|=**Features**|=**Instructions**|=**Variable**|=**Function**|=**Instructions**
5913 |D200|Used as a counting register|(% rowspan="3" %)The 3 units are pre-set by the user program|M3|Run at forward direction at high velocity|(% rowspan="3" %)(((
5914 When X0 is ON, the result of M3 to M7 could be automatically obtained.
5915
5916
5917
5918 )))
5919 |D201|Call window number setting|M4|Run at forward direction at low velocity
5920 |D202|Call work piece number setting|M5|Stop
5921
5922 |M0|Phase A signal|(% rowspan="3" %)(((
5923 The user program executes before each scan of this statement:
5924
5925 [[image:1709803261707-909.png]]
5926
5927
5928 )))|M6|Run at reverse direction at low velocity|(% rowspan="3" %)When X0 is OFF, M3 to M7 are all OFF.
5929 |M1|Phase B signal|M7|Run at reverse direction at high velocity
5930 |M2|Zero point detection signal| |
5931
5932 == STMR/Special Function Timer ==
5933
5934 **STMR**
5935
5936 Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
5937
5938 -[STMR (s1)  (s2)  (d)]
5939
5940 **Content, range and data type**
5941
5942 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5943 |(s1)|Timer number used: T0 to T511 (100ms timer)|-|Device Name|ANY16
5944 |(s2)|Timer setting value|1-32767|Signed BIN 16 bit|ANY16
5945 |(d)|The start bit number of the output (occupies 4 points)|-|Bit|ANYBIT_ARRAY
5946
5947 **Device used**
5948
5949 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5950 **Index**
5951
5952 **modification**
5953 )))|=(((
5954 **Pulse**
5955
5956 **extension**
5957 )))
5958 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5959 |(% rowspan="3" %)STMR|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | |●|
5960 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5961 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5962
5963 **Features**
5964
5965 Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
5966
5967 (% style="text-align:center" %)
5968 [[image:图片30.png]]
5969
5970 1. The instruction of STMR instruction
5971 1. The setting value specified in (S2)
5972
5973 (% style="text-align:center" %)
5974 [[image:图片31.png]]
5975
5976 The blink will be in (d)+3 normally closed contact through the following program which turns on/off the STMR instruction (T10 is allocated in (s1), K100 is allocated in (s2), and M0 is allocated in (d)) Output to (d)+1, (d)+2.
5977
5978 (% style="text-align:center" %)
5979 [[image:图片33.png]]
5980
5981 The setting value of (S2) can be specified in the range of 1 to 32767 (1 to 3276.7 seconds).
5982
5983 (% class="box infomessage" %)
5984 (((
5985 **✎Note: **The timer number specified by this instruction cannot be reused with other general circuits (OUT instructions, etc.). In the case of repetition, the timer action cannot be executed correctly.
5986
5987 The timer specified in (s1) is regarded as a 100ms timer, starting from the rising edge of the instruction contact.
5988
5989 Occupy the device specified in 4 points (d) at the beginning. Be careful not to overlap with the device used for machine control.
5990
5991 When the instruction contact is turned off, (d), (d)+1, (d)+3 will turn off after the set time. (D) +2 and timer (s1) are reset immediately.
5992 )))
5993
5994 **Error code**
5995
5996 |=**Error code**|=**Content**
5997 |4084H|When the value specified in (s2) is less or equal to 0
5998 |4085H|When the device specified in the read application instruction (s2) and (d) exceeds the corresponding device range
5999
6000 **Example**
6001
6002 (% style="text-align:center" %)
6003 [[image:图片34.png]]
6004
6005 (% style="text-align:center" %)
6006 [[image:图片35.png]]
6007
6008 Y0: When X10 changes from Off→On, Y0=On, when X10 changes from On→Off, Y0=Off after a delay of 10 seconds.
6009
6010 Y1: When X10 changes from On→Off, make Y1=On output once for 10 seconds.
6011
6012 Y2: When X10 changes from Off to On, output Y2=On once for 10
6013
6014 Y3: When X10 changes from Off to On, Y3=On after 10 seconds of delay. When X10 changes from On to Off, Y3=Off after 10 seconds
6015
6016 If the component (d)+3 is introduced into the instruction stream, the oscillator output can be easily realized (this function can also be realized by the ALT instruction), as shown in the following figure:
6017
6018 (% style="text-align:center" %)
6019 [[image:图片36.png]]
6020
6021 (% style="text-align:center" %)
6022 [[image:图片37.png]]
6023
6024 == TTMR/Demonstration Timer ==
6025
6026 **TTMR**
6027
6028 Test the time when the TTMR instruction is ON. It is used when adjusting the timer setting time with buttons.
6029
6030 -[TTMR (d)  (s)]
6031
6032 **Content, range and data type**
6033
6034 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
6035 |(d)|Device for storing teaching data|-|Signed BIN 16 bit|ANY16
6036 |(s)|Multiplying ratio of teaching data|0-2|Signed BIN 16 bit|ANY16
6037
6038 **Device used**
6039
6040 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
6041 **Index**
6042
6043 **modification**
6044 )))|=(((
6045 **Pulse**
6046
6047 **extension**
6048 )))
6049 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
6050 |(% rowspan="2" %)TTMR|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6051 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
6052
6053 **Features**
6054
6055 Measure the pressing time of the execution instruction (button) in seconds, multiply it by the magnification (10^^S^^) specified in (s) and store it in the device specified in (d).
6056
6057 (% style="text-align:center" %)
6058 [[image:图片38.png]]
6059
6060 For the time stored in (d), when the hold time is[[image:图片1.png]] (unit: second), the actual value of (d) is as follows according to the magnification specified in (s).
6061
6062 |**(s)**|**Magnification**|**(D)**
6063 |K0|(((
6064 (% style="text-align:center" %)
6065 [[image:图片2.png]]
6066 )))|(D) ×1
6067 |K1|(((
6068 (% style="text-align:center" %)
6069 [[image:图片3.png]]
6070 )))|(D)×10
6071 |K2|(((
6072 (% style="text-align:center" %)
6073 [[image:图片4.png]]
6074 )))|(D) ×100
6075
6076 |**(s)**|**(d)**|**(d)+1 (unit: 100 milliseconds)**
6077 |K0 (unit: second)| |(d)+1 =(d)×10
6078 |K1 (unit: 100 milliseconds)| |(d)+1 =(d)
6079 |K2 (unit: 10 milliseconds)| |(d)+1 =(d)/10
6080
6081 **✎Note: **
6082
6083 If the instruction contact turns from ON→OFF, the current value of the hold time (d)+1 is cleared, and the teaching time (d) does not change.
6084
6085 Occupy the device specified in the 2 teaching time (d) at the beginning. Be careful not to overlap with the device used for machine control.
6086
6087 **Error code**
6088
6089 |**Error code**|**Content**
6090 |4084H|When the value specified in (n) exceeds the range of 0 to 2
6091 |4085H|When the device specified in read application instruction (d) and (s) exceeds the corresponding device range
6092 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
6093
6094 **Example**
6095
6096 Example 1