欢迎图片

Wiki source code of 06 Basic instructions

Version 6.1 by Jiahao Lai on 2025/09/23 17:31

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
4087
4088
4089
4090
4091
4092
4093
4094 **Error code**
4095
4096 |=**Error code**|=**Content**
4097 |=(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4098 |=When the value specified in (n2) exceeds the range of 1 to 6
4099 |=When the value specified in (n3) exceeds the range of 1 to n2
4100 |=4085H|When the device specified in read application instruction (s), (n1), (n2 )and (n3) exceeds the corresponding device range
4101 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4102 |=4087H|When the (d) parameter in the application instruction uses an unsupported device
4103 |=4089H|The number of application instructions exceeds the limit.
4104
4105 **Example**
4106
4107 Refer to the function description example.
4108
4109 (% style="text-align:center" %)
4110 [[image:图片9.png]]
4111
4112 == SORT2/16-bit Data Sorting ==
4113
4114 **SORT2(P)**
4115
4116 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.
4117
4118 -[SORT2 (s)  (n1)  (n2)  (d) (n3)]
4119
4120 **Content, range and data type**
4121
4122 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4123 |=(s)|The start device number storing the data table|-|Signed BIN 16 bit|ANY16
4124 |=(n1)|Number of data (rows)|1 to 32|Signed BIN 16 bit|ANY16
4125 |=(n2)|Number of group data (columns)|1 to 6|Signed BIN 16 bit|ANY16
4126 |=(d)|The start device number storing the operation result|-|Signed BIN 16 bit|ANY16
4127 |=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 16 bit|ANY16
4128
4129 **Device used**
4130
4131 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4132 **Index**
4133
4134 **modification**
4135 )))|=(((
4136 **Pulse**
4137
4138 **extension**
4139 )))
4140 |=**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**
4141 |=(% rowspan="5" %)SORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4142 |=Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4143 |=Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4144 |=Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4145 |=Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4146
4147 **Features**
4148
4149 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).
4150
4151 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).
4152
4153 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4154 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4155 |**Management number**|**Height**|**Weight**|**Age**
4156 |(% rowspan="3" %)When the number of data (n1)=3|Line NO.1|(s)|(s)+1|(s) +2|(s) +3
4157 |Line NO.2|(s) +4|(s) +5|(s) +6|(s) +7
4158 |Line NO.3|(s) +8|(s) +9|(s) +10|(s) +100
4159
4160 Sequence is set by the ON/OFF status of SM165
4161
4162 |= |=**Sort order setting instruction**
4163 |SM165=ON|Descending
4164 |SM165=OFF|Ascending
4165
4166 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4167
4168 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.
4169
4170 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4171 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4172 |**Management number**|**Height**|**Weight**|**Age**
4173 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)|(s)+1|(s) +2|(s) +3
4174 |1|150|45|20
4175 |(% rowspan="2" %)Line NO.2|(s) +4|(s) +5|(s) +6|(s) +7
4176 |2|180|50|40
4177 |(% rowspan="2" %)Line NO.3|(s) +8|(s) +9|(s) +10|(s) +100
4178 |3|160|70|30
4179 |(% rowspan="2" %)Line NO.4|(s) +12|(s) +13|(s) +14|(s) +15
4180 |4|100|20|8
4181 |(% rowspan="2" %)Line NO.5|(s) +16|(s) +17|(s) +18|(s) +19
4182 |5|150|50|45
4183
4184 Press (n3)=K2 (column number 2) to execute the sorting result (SM165=OFF in the case of ascending order)
4185
4186 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4187 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4188 |**Management number**|**Height**|**Weight**|**Age**
4189 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +1|(d) +2|(d) +3
4190 |4|100|20|8
4191 |(% rowspan="2" %)Line NO.2|(d) +4|(d) +5|(d) +6|(d) +7
4192 |1|150|45|20
4193 |(% rowspan="2" %)Line NO.3|(d) +8|(d) +9|(d) +10|(d) +100
4194 |5|150|50|45
4195 |(% rowspan="2" %)Line NO.4|(d) +12|(d) +13|(d) +14|(d) +15
4196 |3|160|70|30
4197 |(% rowspan="2" %)Line NO.5|(d) +16|(d) +17|(d) +18|(d) +19
4198 |2|180|50|40
4199
4200 Press (n3)=K3 (column number 3) to execute the sorting result (SM165=ON in the case of ascending order)
4201
4202 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4203 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4204 |**Management number**|**Height**|**Weight**|**Age**
4205 |(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +1|(d) +2|(d) +3
4206 |3|160|70|30
4207 |(% rowspan="2" %)Line NO.2|(d) +4|(d) +5|(d) +6|(d) +7
4208 |2|180|50|40
4209 |(% rowspan="2" %)Line NO.3|(d) +8|(d) +9|(d) +10|(d) +100
4210 |5|150|50|45
4211 |(% rowspan="2" %)Line NO.4|(d) +12|(d) +13|(d) +14|(d) +15
4212 |1|150|45|20
4213 |(% rowspan="2" %)Line NO.5|(d) +16|(d) +17|(d) +18|(d) +19
4214 |4|100|20|8
4215
4216 (% class="box infomessage" %)
4217 (((
4218 **✎Note: **Do not change the operand and data content during operation.
4219
4220 When executing again, the instruction input should be turned OFF once.
4221
4222 The SORT2 instruction can only be written in the program to drive 2 at most.
4223
4224 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.
4225
4226 Do not overlap the source data and the sorted data.
4227 )))
4228
4229 (% style="text-align:center" %)
4230 [[image:图片10.png]]
4231
4232 **Error code**
4233
4234 |=**Error code**|=**Content**
4235 |(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4236 |When the value specified in (n2) exceeds the range of 1 to 6
4237 |When the value specified in (n3) exceeds the range of 1 to n2
4238 |4085H|When the device specified in read application instruction (s), (d), (n1), (n2) and (n3) exceeds the corresponding device range
4239 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4240 |4089H|The number of application instructions exceeded the limit.
4241
4242 **Example**
4243
4244 Refer to the function description example.
4245
4246 (% style="text-align:center" %)
4247 [[image:图片11.png]]
4248
4249 == DSORT2/32-bit Data Sorting ==
4250
4251 **DSORT2(P)**
4252
4253 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).
4254
4255 -[DSORT2 (s) (n1)  (n2)  (d)  (n3)]
4256
4257 **Content, range and data type**
4258
4259 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4260 |=(s)|The start device number storing the data table|-|Signed BIN 32 bit|ANY32
4261 |=(n1)|Number of data (rows)|1 to 32|Signed BIN 32 bit|ANY32
4262 |=(n2)|Number of group data (columns)|1 to 6|Signed BIN 32 bit|ANY32
4263 |=(d)|The start device number storing the operation result|-|Signed BIN 32 bit|ANY32
4264 |=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 32 bit|ANY32
4265
4266 **Device used**
4267
4268 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
4269 **Pulse**
4270
4271 **extension**
4272 )))
4273 |**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**
4274 |(% rowspan="5" %)DSORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4275 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4276 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4277 |Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4278 |Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4279
4280 **Features**
4281
4282 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).
4283
4284 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).
4285
4286 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4287 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4288 |**Management number**|**Height**|**Weight**|**Age**
4289 |(% 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
4290 |Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4291 |Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4292
4293 Sequence is set by the ON/OFF status of SM165
4294
4295 |= |=**Sort order setting instructions**
4296 |SM165=ON|Descending
4297 |SM165=OFF|Ascending
4298
4299 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4300
4301 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.
4302
4303
4304 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4305 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4306 |**Management number**|**height**|**body weight**|**age**
4307 |(% 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
4308 |1|150|45|20
4309 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4310 |2|180|50|40
4311 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4312 |3|160|70|30
4313 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4314 |4|100|20|8
4315 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4316 |5|150|50|45
4317
4318 Press (n3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)
4319
4320 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4321 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4322 |**Management number**|**height**|**body weight**|**age**
4323 |(% 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
4324 |4|100|20|8
4325 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4326 |1|150|45|20
4327 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4328 |5|150|50|45
4329 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4330 |3|160|70|30
4331 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4332 |2|180|50|40
4333
4334 Press (n3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)
4335
4336 |=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4337 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4338 |**Management number**|**height**|**body weight**|**age**
4339 |(% 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
4340 |3|160|70|30
4341 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4342 |2|180|50|40
4343 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4344 |5|150|50|45
4345 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4346 |1|150|45|20
4347 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4348 |4|100|20|8
4349
4350 **✎Note: **
4351
4352 Do not change the operand and data content during operation.
4353
4354 When executing again, the instruction input should be turned OFF once.
4355
4356 The SORT2 instruction can only be written twice in the program.
4357
4358 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.
4359
4360 Do not overlap the source data and the sorted data.
4361
4362
4363 **DSORT2(P)**
4364
4365 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).
4366
4367 -[DSORT2 (s) (n1)  (n2)  (d)  (n3)]
4368
4369 **Content, range and data type**
4370
4371 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
4372 |(s)|The start device number storing the data table|-|Signed BIN 32 bit|ANY32
4373 |(n1)|Number of data (rows)|1 to 32|Signed BIN 32 bit|ANY32
4374 |(n2)|Number of group data (columns)|1 to 6|Signed BIN 32 bit|ANY32
4375 |(d)|The start device number storing the operation result|-|Signed BIN 32 bit|ANY32
4376 |(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 32 bit|ANY32
4377
4378 **Device used**
4379
4380 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
4381 **Pulse**
4382
4383 **extension**
4384 )))
4385 |**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**
4386 |(% rowspan="5" %)DSORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4387 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4388 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4389 |Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4390 |Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4391
4392 **Features**
4393
4394 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).
4395
4396 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).
4397
4398 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4399 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4400 |**Management number**|**Height**|**Weight**|**Age**
4401 |(% 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
4402 |Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4403 |Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4404
4405 Sequence is set by the ON/OFF status of SM165
4406
4407 | |**Sort order setting instructions**
4408 |SM165=ON|Descending
4409 |SM165=OFF|Ascending
4410
4411 Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4412
4413 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.
4414
4415
4416 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4417 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4418 |**Management number**|**height**|**body weight**|**age**
4419 |(% 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
4420 |1|150|45|20
4421 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4422 |2|180|50|40
4423 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4424 |3|160|70|30
4425 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4426 |4|100|20|8
4427 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4428 |5|150|50|45
4429
4430 Press (n3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)
4431
4432 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4433 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4434 |**Management number**|**height**|**body weight**|**age**
4435 |(% 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
4436 |4|100|20|8
4437 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4438 |1|150|45|20
4439 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4440 |5|150|50|45
4441 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4442 |3|160|70|30
4443 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4444 |2|180|50|40
4445
4446 Press (n3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)
4447
4448 |(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4449 |**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4450 |**Management number**|**height**|**body weight**|**age**
4451 |(% 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
4452 |3|160|70|30
4453 |(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4454 |2|180|50|40
4455 |(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4456 |5|150|50|45
4457 |(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4458 |1|150|45|20
4459 |(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4460 |4|100|20|8
4461
4462 (% class="box infomessage" %)
4463 (((
4464 **✎Note:**Do not change the operand and data content during operation.
4465
4466 When executing again, the instruction input should be turned OFF once.
4467
4468 The SORT2 instruction can only be written twice in the program.
4469
4470 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.
4471
4472 Do not overlap the source data and the sorted data.
4473 )))
4474
4475 (% style="text-align:center" %)
4476 [[image:图片12.png]]
4477
4478 **Error code**
4479
4480 |=**Error code**|=**Content**
4481 |=(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4482 |=When the value specified in (n2) exceeds the range of 1 to 6
4483 |=When the value specified in (n3) exceeds the range of 1 to n2
4484 |=4085H|When the device specified in read application instruction (s), (d), (n1), (n2 )and (n3) exceeds the corresponding device range
4485 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4486 |=4089H|The number of application instructions exceeded the limit.
4487
4488 **Example**
4489
4490 Refer to the function description example.
4491
4492 (% style="text-align:center" %)
4493 [[image:图片13.png]]
4494
4495 == SWAP/16-bit Data High and Low Byte Swap ==
4496
4497 **SWAP(P) **
4498
4499 Swap the high and low 8-bit value of the device specified in (d).
4500
4501 -[SWAP (d)]
4502
4503 **Content, range and data type**
4504
4505 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4506 |(d)|Word device with high and low byte swap|-|Signed BIN 16 bit|ANY16
4507
4508 **Device used**
4509
4510 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4511 **Index**
4512
4513 **modification**
4514 )))|=(((
4515 **Pulse**
4516
4517 **extension**
4518 )))
4519 |**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**
4520 |SWAP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
4521
4522 **Features**
4523
4524 Convert the high and low 8-bit value of the device specified in (d).
4525
4526 (% style="text-align:center" %)
4527 [[image:图片14.png]]
4528
4529 **Error code**
4530
4531 |=**Error code**|=**Content**
4532 |=4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
4533 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4534
4535 **Example**
4536
4537 (% style="text-align:center" %)
4538 [[image:图片15.png]]
4539
4540 When the rising edge of M0 is triggered, swap the low 8 bits and high 8 bits of D0 to get H8F2A.
4541
4542 == DSWAP/32-bit Data High and Low Byte Swap ==
4543
4544 **DSWAP(P)**
4545
4546 The devices specified in (d) and (d)+1 will be converted to the high and low 8-bit values respectively.
4547
4548 -[DSWAP (d)]
4549
4550 **Content, range and data type**
4551
4552 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4553 |=(d)|Word device with high and low byte swap|-|Signed BIN 32 bit|ANY32
4554
4555 **Device used**
4556
4557 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4558 **Index**
4559
4560 **modification**
4561 )))|=(((
4562 **Pulse**
4563
4564 **extension**
4565 )))
4566 |**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**
4567 |DSWAP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
4568
4569 **Features**
4570
4571 The devices specified in (d) and (d)+1 will be converted to the upper and lower 8-bit values respectively.
4572
4573 (% style="text-align:center" %)
4574 [[image:图片16.png]]
4575
4576 (% class="box infomessage" %)
4577 (((
4578 **✎Note: **
4579 If continuous execution instructions are used, conversion will be performed every scan cycle.
4580 )))
4581
4582 **Error code**
4583
4584 |=**Error code**|=**Content**
4585 |4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
4586 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4587
4588 **Example**
4589
4590 (% style="text-align:center" %)
4591 [[image:图片17.png]]
4592
4593 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.
4594
4595 (% style="text-align:center" %)
4596 [[image:图片18.png]]
4597
4598 == BTOW/Byte Unit Data Merge ==
4599
4600 **BTOW(P)**
4601
4602 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).
4603
4604 -[BTOW (s)  (d) (n)]
4605
4606 **Content, range and data type**
4607
4608 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4609 |(s)|The start device that stores the data merging in byte units|-|Signed BIN 16 bit|ANY16
4610 |(d)|The start device that stores the result of merging in byte units|-|Signed BIN 16 bit|ANY16
4611 |(n)|Number of byte data merged|0-32767|Signed BIN 16 bit|ANY16
4612
4613 **Device used**
4614
4615 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4616 **Index**
4617
4618 **modification**
4619 )))|=(((
4620 **Pulse**
4621
4622 **extension**
4623 )))
4624 |**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**
4625 |(% rowspan="3" %)BTOW|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4626 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4627 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4628
4629 **Features**
4630
4631 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.
4632
4633 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.
4634
4635 (% style="text-align:center" %)
4636 [[image:图片19.png]]
4637
4638 £: the £th byte data;
4639
4640 (1): Ignore the high byte
4641
4642 *1: Carry below the decimal point.
4643
4644 **Example**
4645
4646 When (n)=5, the data up to the lower 8 bits of (s)+(s)+4 is stored in (d)+(d)+2.
4647
4648 (% style="text-align:center" %)
4649 [[image:图片20.png]]
4650
4651 (1): When (n)=5
4652
4653 (2): Change to 00H
4654
4655 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.
4656
4657 When the number of bytes specified in (n) is 0, no processing is performed.
4658
4659 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.
4660
4661 **Example**
4662
4663 When the low 8 bits of D11 to D16 is stored in D12 to D14.
4664
4665 (% style="text-align:center" %)
4666 [[image:图片21.png]]
4667
4668 Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
4669
4670 |**Device range storing the data before merging**|**Device range for storing merged data**
4671 |(S)+0 to (s)+(n)-1|(D) to (d) + (n/2-1)
4672
4673 **Error code**
4674
4675 |=**Error code**|=**Content**
4676 |=4084H|The value specified in (n) exceed range of 0 to 32767
4677 |=4085H|When the device specified in the write application instruction (s),(d) and (n) exceeds the corresponding device range
4678
4679 **Example**
4680
4681 (% style="text-align:center" %)
4682 [[image:图片22.png]]
4683
4684 When M0 is ON, the data of D20 to D25 is separated according to byte units, and then stored in D10 to D12.
4685
4686 (% style="text-align:center" %)
4687 [[image:图片23.png]]
4688
4689 == WTOB/Byte Unit Data Separation ==
4690
4691 **WTOB(P)**
4692
4693 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).
4694
4695 -[WTOB (s) (d)  (n)]
4696
4697 **Content, range and data type**
4698
4699 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4700 |=(s)|The start device that stores the data separation in byte unit|-|Signed BIN 16 bit|ANY16
4701 |=(d)|The start device that stores the result of separation in byte unit|-|Signed BIN 16 bit|ANY16
4702 |=(n)|Number of byte data separated|0-32767|Signed BIN 16 bit|ANY16
4703
4704 **Device used**
4705
4706 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
4707 **Pulse**
4708
4709 **extension**
4710 )))
4711 |**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**
4712 |(% rowspan="3" %)WTOB|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4713 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4714 |Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | |●|●| |●|●
4715
4716 **Features**
4717
4718 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).
4719
4720 (% style="text-align:center" %)
4721 [[image:图片24.png]]
4722
4723 1. High byte;
4724 1. Low byte;
4725 1. High byte data;
4726 1. Low byte data;
4727 1. *1: Carry below the decimal point.
4728
4729 **Example**
4730
4731 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:
4732
4733 (% style="text-align:center" %)
4734 [[image:图片25.png]]
4735
4736 1. (N)=5 is ignored.
4737 1. (N)=5.
4738
4739 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.
4740
4741 When the number of bytes specified in (n) is 0, no processing is performed.
4742
4743 00H is automatically stored in the upper 8 bits of the byte data storage device specified in (d).
4744
4745 **Example**
4746
4747 When D12 to D14 is stored in the low 8 bits of D11 to D16
4748
4749 (% style="text-align:center" %)
4750 [[image:图片26.png]]
4751
4752 Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
4753
4754 |=**Device range storing the data before merging**|=**Device range storing separated data**
4755 |(s) to (s) + (n/2-1)|(d)+0 to (d)+(n)-1
4756
4757 **Error code**
4758
4759 |=**Error code**|=**Content**
4760 |=4084H|The value specified by (n) exceed the range of 0 to 32767
4761 |=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4762 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4763
4764 **Example**
4765
4766 (% style="text-align:center" %)
4767 [[image:图片27.png]]
4768
4769 When M0 is ON, the data of D10 to D12 are separated according to byte units, and then stored in D20 to D25.
4770
4771 (% style="text-align:center" %)
4772 [[image:图片28.png]]
4773
4774 == DIS/4-bit Separation of 16-bit Data ==
4775
4776 **DIS(P)**
4777
4778 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).
4779
4780 -[DIS (s) (d) (n)]
4781
4782 **Content, range and data type**
4783
4784 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4785 |=(s)|The start device storing the data before separation|-|Signed BIN 16 bit|ANY16
4786 |=(d)|The start device storing separated data|-|Signed BIN 16 bit|ANY16
4787 |=(n)|Separation number (0 means no processing)|0-4|Signed BIN 16 bit|ANY16
4788
4789 **Device used**
4790
4791 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4792 **Index**
4793
4794 **modification**
4795 )))|=(((
4796 **Pulse**
4797
4798 **extension**
4799 )))
4800 |**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**
4801 |(% rowspan="3" %)DIS|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4802 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4803 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4804
4805 **Features**
4806
4807 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).
4808
4809 (% style="text-align:center" %)
4810 [[image:图片29.png]]
4811
4812 The hig-12 bit of the point (n) starting from the device specified in (s) will become 0.
4813
4814 When (n)=0, it will become no processing, and the content of point (n) starting from the device of (d) will not change.
4815
4816 **Error code**
4817
4818 |=**Error code**|=**Content**
4819 |=4084H|The data in (n) exceed the range of 0 to 4
4820 |=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4821 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4822
4823 **Example**
4824
4825 (% style="text-align:center" %)
4826 [[image:图片30.png]]
4827
4828 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.
4829
4830 == UNI/4-bit Combination of 16-bit Data ==
4831
4832 **UNI(P)**
4833
4834 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).
4835
4836 -[UNI (s) (d) (n)]
4837
4838 **Content, range and data type**
4839
4840 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4841 |=(s)|The start device storing the data before merging|-|Signed BIN 16 bit|ANY16
4842 |=(d)|The start device storing the merged data|-|Signed BIN 16 bit|ANY16
4843 |=(n)|Number of merger|0-4|Signed BIN 16 bit|ANY16
4844
4845 **Device used**
4846
4847 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4848 **Index**
4849
4850 **modification**
4851 )))|=(((
4852 **Pulse**
4853
4854 **extension**
4855 )))
4856 |**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**
4857 |(% rowspan="3" %)UNI|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4858 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
4859 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4860
4861 **Features**
4862
4863 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).
4864
4865 (% style="text-align:center" %)
4866 [[image:图片31.png]]
4867
4868 The high (4-n) bits of the device specified in (d) will become 0.
4869
4870 When (n)=0, it will become no processing, and the content of the device in (d) will not change.
4871
4872 **Error code**
4873
4874 |=**Code**|=**Content**
4875 |=4084H|The data in (n) exceed the range of 0 to 4
4876 |=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4877 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4878
4879 **Example**
4880
4881 (% style="text-align:center" %)
4882 [[image:图片32.png]]
4883
4884 When M0 is ON, the low 4 bits of D0 to D3 are combined and stored in D10, the value is H236F.
4885
4886 == ZRST/Data Batch Reset ==
4887
4888 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3496\wps2.png]]**ZRST(P)**
4889
4890 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.
4891
4892 -[ZRST ( d1)  (d2)]
4893
4894 **Content, range and data type**
4895
4896 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4897 |=(d1)|The start bit or word device number of batch reset|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
4898 |=(d2)|The final bit or word device number of batch reset|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
4899
4900 **Device used**
4901
4902 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4903 **Index**
4904
4905 **modification**
4906 )))|=(((
4907 **Pulse**
4908
4909 **extension**
4910 )))
4911 |**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**
4912 |(% rowspan="2" %)ZRST|Parameter 1| |●|●|●|●| | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
4913 |Parameter 2| |●|●|●|●| | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
4914
4915 **Features**
4916
4917 Perform batch reset between the devices specified in (d1) and (d2) of the same type.
4918
4919 (% style="text-align:center" %)
4920 [[image:图片33.png]]
4921
4922 When (d1) and (d2) are bit devices, write OFF (reset) in the entire device range of (d1) to (d2).
4923
4924 (% style="text-align:center" %)
4925 [[image:图片34.png]]
4926
4927 When (d1) and (d2) are word devices, write K0 in the entire device range of (d1) to (d2).
4928
4929
4930 As a separate reset instruction for the device, the RST instruction can be used for bit devices or word devices.
4931
4932 (% style="text-align:center" %)
4933 [[image:图片35.png]]
4934
4935 Reset M0
4936
4937 Reset the current value of T0
4938
4939 Reset D0
4940
4941
4942 The batch write instruction of constant (for example: K0) has FMOV (P) instruction, which can write 0 to word devices (including bit device specification).
4943
4944 (% style="text-align:center" %)
4945 [[image:图片36.png]]
4946
4947 Write K0 in D0 to D99.
4948
4949 (% class="box infomessage" %)
4950 (((
4951 **✎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).
4952
4953 ZRST(P) instruction is a 16-bit instruction, which can specify (LC) and (HSC) devices for (d1) and (d2).
4954 )))
4955
4956 **Error code**
4957
4958 |=**Error code**|=**Content**
4959 |=4084H|When the device type specified in (d1) is different from the device type specified in (d2).
4960 |=4085H|When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
4961 |=4086H|When the device specified in the write application instruction (d1) exceeds the corresponding device range
4962
4963 **Example**
4964
4965 (% style="text-align:center" %)
4966 [[image:图片37.png]]
4967
4968 The function of this ladder diagram instruction is to set the value of the D0 to D100 device to 0.
4969
4970 == ZSET/Data Batch Set ==
4971
4972 **ZSET(P)**
4973
4974 Perform a batch set between the devices specified in (d1) and (d2) of the same type.
4975
4976 (% style="text-align:center" %)
4977 [[image:图片38.png]]
4978
4979 **Content, range and data type**
4980
4981 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type(label)**
4982 |=(d1)|The start bit device number of batch set|-|Bit|ANY_BOOL
4983 |=(d2)|The final bit device number of batch set|-|Bit|ANY_BOOL
4984
4985 **Device used**
4986
4987 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**
4988 |**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]**
4989 |(% rowspan="2" %)ZSET|Parameter 1| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●
4990 |Parameter 2| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●
4991
4992 **Features**
4993
4994 ·Perform a batch set between the devices specified in (d1) and (d2) of the same type.
4995
4996 ·Write ON (set) in the entire device range of (d1) to (d2)
4997
4998 (% style="text-align:center" %)
4999 [[image:图片1.png]]
5000
5001 ·As a separate set instruction for the device, the SET instruction can be used for bit devices.
5002
5003 (% style="text-align:center" %)
5004 [[image:图片2.png]]
5005
5006 (% class="box infomessage" %)
5007 (((
5008 **✎Note: **
5009 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).
5010 )))
5011
5012 **Error code**
5013
5014 |=**Error code**|=**Content**
5015 |=4084H|When the device type specified in (d1) is different from the device type specified in (d2).
5016 |=4085H|When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
5017 |=4086H|When the device specified in the write application instruction (d1) exceeds the corresponding device range
5018 |=4087H|When the device type specified in (d1) and (d2) are not bit device.
5019
5020 **Example**
5021
5022 (% style="text-align:center" %)
5023 [[image:图片3.png]]
5024
5025 The function of this LAD instruction is to set the value of the M1 to M4 device to ON.
5026
5027
5028 == CRC/Cyclic Redundancy Check instruction ==
5029
5030 **CRC(P)**
5031
5032 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
5033
5034 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)
5035
5036 "X 16 +X 15 +X 2 +1".
5037
5038 -[CRC(P) (s) (d)  (n)]
5039
5040 **Content, range and data type**
5041
5042 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5043 |=(s)|The device start number storing the data of CRC value generated objects |-|Signed BIN16|ANY16
5044 |=(d)|The destination device number of the generated CRC value|-|Signed BIN16|ANY16
5045 |=(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
5046
5047 **Device used**
5048
5049 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5050 **Index**
5051
5052 **modification**
5053 )))|=(((
5054 **Pulse**
5055
5056 **extension**
5057 )))
5058 |**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**
5059 |(% rowspan="3" %)CRC|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
5060 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
5061 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| | |●
5062
5063 **Features**
5064
5065 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).
5066
5067 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.
5068
5069 1. 16-bit conversion mode (when SM161=OFF)
5070
5071 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.
5072
5073 (% style="text-align:center" %)
5074 [[image:图片4.png]]
5075
5076 |(% colspan="3" rowspan="3" %) |(% colspan="3" %)**Example (s)=D100, (d)=D0, (n)=6**
5077 |(% rowspan="2" %)**Devices**|(% colspan="2" %)**Content of object data**
5078 |**8-bit**|**16-bit**
5079 |(% rowspan="9" %)CRC value generation target data storage destination|(% rowspan="2" %)(s)|Low byte|D100 low|01H|0301H
5080 |High byte|D100 high|03H|
5081 |(% rowspan="2" %)(s)+1|Low byte|D101 low|03H|0203H
5082 |High byte|D101 high|02H|
5083 |(% rowspan="2" %)(s)+2|Low byte|D102 low|00H|1400H
5084 |High byte|D102 high|14H|
5085 |...| |(% colspan="3" %)
5086 |(% rowspan="2" %)(s)+(n)/2-1|Low byte|(% colspan="3" rowspan="2" %)
5087 |High byte
5088 |(% rowspan="2" %)CRC value storage target|(% rowspan="2" %)(d)|Low byte|D0 low|E4H|41E4H
5089 |High byte|D0 high|41H|
5090
5091 2. 8-bit conversion mode (when SM8161=ON)
5092
5093 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.
5094
5095 In the case of the following program, perform the conversion as shown below.
5096
5097 |(% colspan="3" rowspan="2" %) |(% colspan="2" %)**Example) (s)=D100, (d)=D0, (n)=6**
5098 |**Devices**|**Content of object data**
5099 |(% rowspan="8" %)CRC value generation target data storage destination|(s)|Low byte|D100 low|01H
5100 |(s)+1|Low byte|D101 low|03H
5101 |(s)+2|Low byte|D102 low|03H
5102 |(s)+3|Low byte|D103 low|02H
5103 |(s)+4|Low byte|D104 low|00H
5104 |(s)+5|Low byte|D105 low|14H
5105 |(% colspan="2" %)...|(% colspan="2" %)
5106 |(s)+(n)-1|Low byte|(% colspan="2" %)
5107 |(% rowspan="2" %)CRC value storage target|(d)|Low byte|D0|E4H
5108 |(d)+1|Low byte|D1|41H
5109
5110 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.
5111
5112 |=**Name**|=**Generator polynomial**
5113 |=CRC-12|X^^12^^+X^^11^^+X^^3^^+X^^2^^+X+1
5114 |=CRC-16|X^^16^^+X^^15^^+X^^2^^+1
5115 |=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
5116 |=CRC-CCITT|X^^16^^+X^^12^^+X^^5^^+1
5117
5118 (% class="box infomessage" %)
5119 (((
5120 **✎Note:
5121 **When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.
5122 )))
5123
5124 **Error code**
5125
5126 |=**Error code**|=**Content**
5127 |=4084H|The range of (n) exceeds 1 to 256
5128 |=4085H|The data address of (s) to be converted exceeds the device range
5129 |=4086H|The (d) write address exceeds the device range
5130 |=4087H|Unsupported device type is used by (s) and (d)
5131
5132 **Example**
5133
5134 * 16-bit conversion mode
5135
5136 (% style="text-align:center" %)
5137 [[image:图片6.png]]
5138
5139 * 8-bit conversion mode
5140
5141 (% style="text-align:center" %)
5142 [[image:图片7.png]]
5143
5144 = Matrix Input instructions =
5145
5146 == MTR/Matrix Input ==
5147
5148 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps1.png]]**MTR**
5149
5150 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).
5151
5152 -[MTR (s) (d1) (d2) (n)]
5153
5154 **Content, range and data type**
5155
5156 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5157 |(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|(((
5158 Bit
5159
5160
5161 )))|ANY_BOOL
5162 |(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
5163 |(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
5164 |(n)|Set the number of columns in the matrix input.|2 to 8|Unsigned BIN 16 bit|ANY16_U
5165
5166 **Device used**
5167
5168 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5169 **Index**
5170
5171 **modification**
5172 )))|=(((
5173 **Pulse**
5174
5175 **extension**
5176 )))
5177 |**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**
5178 |(% rowspan="4" %)MTR|Parameter 1|●| | | | | | | | | | | | | | | | | | | | | | | | |
5179 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | | |
5180 |Parameter 3| |●|●|●|●| | | | | | | | | | | | | | | | | | | | |
5181 |Parameter 4| | | | | | | | | | | | | | | | | | | | | |●|●| | |
5182
5183 **Features**
5184
5185 (% style="text-align:center" %)
5186 [[image:图片8.png]]
5187
5188 This instruction generally uses the normally ON contact SM100.
5189
5190 (% style="text-align:center" %)
5191 [[image:图片9.png]]
5192
5193 According to the example in the figure:
5194
5195 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
5196
5197 (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.
5198
5199 **Special device used**
5200
5201 |**Devices**|**Content**
5202 |SM229|SM229 will turn ON after one cycle of execution is completed
5203
5204 (% class="box infomessage" %)
5205 (((
5206 **✎Note: **
5207 The MTR instruction can only run one instruction at the same time.
5208 )))
5209
5210 **Error code**
5211
5212 |=**Error code**|=**Content**
5213 |(% rowspan="2" %)4085H|The read address of (s) and (n) exceeds the device range
5214 |(s) use the numbered device whose low bit is not 0
5215 |(% rowspan="2" %)4086HA|The write address of (d1) and (d2) exceeds the device range
5216 |(d2) use the numbered device whose low bit is not 0
5217 |4084H|(n) is not in the range of 2 to 8
5218 |4089H|Multiple MTR instructions are executed at the same time
5219
5220 = Convenient instructions =
5221
5222 == ABSD/BIN 16-bit Data Absolute Method ==
5223
5224 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps2.png]]**ABSD**
5225
5226 Create multiple output modes corresponding to the current counter (BIN 16-bit value).
5227
5228 -[ABSD (s1) (s2)  (d) (n)]
5229
5230 **Content, range and data type**
5231
5232 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5233 |=(s1)|(((
5234 The start device number storing the data table
5235
5236 (rising edge point and falling edge point)
5237 )))|-|Signed BIN 16 bit|ANY16
5238 |=(s2)|The counter number used for monitoring of the current value compared to the data table|-|Signed BIN 16 bit|ANY16
5239 |=(d)|The number of points of the output start device|-|Bit|ANY16_BOOL
5240 |=(n)|Number of table rows and output bit device points|1 to 64|Signed BIN 16 bit|ANY16
5241
5242 **Device used**
5243
5244 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5245 **Index**
5246
5247 **modification**
5248 )))|=(((
5249 **Pulse**
5250
5251 **extension**
5252 )))
5253 |**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**
5254 |(% rowspan="4" %)ABSD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5255 |Parameter 2| | | | | | | | | | | | | | | |●| | | | | | | | |●|
5256 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5257 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5258
5259 **Features**
5260
5261 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)
5262
5263 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.
5264
5265 (% style="text-align:center" %)
5266 [[image:图片10.png]]
5267
5268 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.
5269
5270 |=(% colspan="2" %)**Rising edge point**|=(% colspan="2" %)**Falling edge point**|=(% rowspan="2" %)**Object output**
5271 |**-**|**Data value (example)**|**-**|**Data value (example)**
5272 |(S1)|40|(S1)+1|140|(D)
5273 |(S1)+2|100|(S1) +3|200|(D) +1
5274 |(S1) +4|160|(S1) +5|60|(D) +2
5275 |(S1) +6|240|(S1) +7|280|(D) +3
5276 |...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
5277 |(S1)+2(n)-2|(S1)+2(n)-1|(D) +n-1
5278
5279 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.
5280
5281 (% style="text-align:center" %)
5282 [[image:图片11.png]]
5283
5284 (% class="box infomessage" %)
5285 (((
5286 **✎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.
5287
5288 The number of target output points is determined by the value of (n). (1≤(n)≤64)
5289
5290 Even if the instruction input is turned off, the output does not change.
5291 )))
5292
5293 **Error code**
5294
5295 |=**Error code**|=**Content**
5296 |=4084H|When the value specified in (n) exceeds the range of 1 to 64
5297 |=4085H|When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
5298 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5299
5300 **Example**
5301
5302 Refer to the example in the function description.
5303
5304 == DABSD/BIN 32-bit Data Absolute Method ==
5305
5306 **DABSD**
5307
5308 Create multiple output modes corresponding to the current counter (BIN 32-bit value).
5309
5310 -[DABSD  (s1)  (s2) (d) (n)]
5311
5312 **Content, range and data type**
5313
5314 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5315 |=(s1)|(((
5316 The start device number storing the data table
5317
5318 (rising edge point and falling edge point)
5319 )))|-|Signed BIN 32 bit|ANY32
5320 |=(s2)|The counter number used for monitoring of the current value compared to the data table|-|Signed BIN 32 bit|ANY32
5321 |=(d)|The number of points of the output start device|-|Bit|ANY16_BOOL
5322 |=(n)|Number of table rows and output bit device points|1 to 64|Signed BIN 32 bit|ANY32
5323
5324 **Device used**
5325
5326 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
5327 **Pulse**
5328
5329 **extension**
5330 )))
5331 |**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**
5332 |(% rowspan="4" %)DABSD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|
5333 |Parameter 2| | | | | | | | | | | | | | | |●| | | |●|●| | | |●|
5334 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5335 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
5336
5337 **Features**
5338
5339 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)
5340
5341 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.
5342
5343 (% style="text-align:center" %)
5344 [[image:图片12.png]]
5345
5346 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.
5347
5348 |=(% colspan="2" %)**Rising edge point**|=(% colspan="2" %)**Falling edge point**|=(% rowspan="2" %)**Object output**
5349 |**-**|**Data value (example)**|**-**|**Data value (example)**
5350 |(S1)+1, (S1)|40|(S1)+3, (S1)+2|140|(D)
5351 |(S1)+5, (S1)+4|100|(S1) +7, (S1) +6|200|(D) +1
5352 |(S1) +9, (S1) +8|160|(S1)+11, (S1)+10|60|(D) +2
5353 |(S1) +13, (S1) +12|240|(S1) +15, (S1) +14|280|(D) +3
5354 |...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
5355 |(((
5356 (S1)+4(n)-3,
5357
5358 (S1)+4(n)-4
5359 )))|(((
5360 (S1)+4(n)-1,
5361
5362 (S1)+4(n)-2
5363 )))|(D) +n-1
5364
5365 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.
5366
5367 (% style="text-align:center" %)
5368 [[image:图片13.png]]
5369
5370 (% class="box infomessage" %)
5371 (((
5372 **✎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.
5373
5374 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.
5375
5376 The number of target output points is determined by the value of (n). (1≤(n)≤64)
5377
5378 Even if the instruction input is turned off, the output does not change.
5379 )))
5380
5381 **Error code**
5382
5383 |=**Error code**|=**Content**
5384 |=4084H|When the value specified in (n) exceeds the range of 1 to 64
5385 |=4085H|When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
5386 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5387
5388 **Example**
5389
5390 Refer to the example in the function description.
5391
5392 == SER/16-bit Data Search ==
5393
5394 **SER(P)**
5395
5396 Search the same data and the maximum and minimum values from the data table.
5397
5398 -[SER (s1) (s2)  (d) (n)]
5399
5400 **Content, range and data type**
5401
5402 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5403 |=(s1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 16 bit|ANY16
5404 |=(s2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 16 bit|ANY16
5405 |=(d)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 16 bit|ANY16
5406 |=(n)|Search the number of same data, maximum and minimum|1 to 256|Signed BIN 16 bit|ANY16
5407
5408 **Device used**
5409
5410 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5411 **Index**
5412
5413 **modification**
5414 )))|=(((
5415 **Pulse**
5416
5417 **extension**
5418 )))
5419 |**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**
5420 |(% rowspan="3" %)SER|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
5421 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |● |● | |●|●
5422 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
5423 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
5424
5425 **Features**
5426
5427 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.
5428
5429 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).
5430
5431 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.
5432
5433 • The structure and data examples of the search result table are as follows. (N=10)
5434
5435 |=(% rowspan="2" %)**The searched device (s1)**|=(% rowspan="2" %)(((
5436 **The value of the**
5437
5438 **searched data (s1)**
5439 )))|=(% rowspan="2" %)(((
5440 **Comparison data**
5441
5442 **(S2) value**
5443 )))|=(% rowspan="2" %)**Data location**|=(% colspan="3" %)**search results**
5444 |**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
5445 |(s1)|K100|(% rowspan="10" %)K100|0| |○(First time)|
5446 |(s1)+1|K111|1| | |
5447 |(s1)+2|K100|2| |○|
5448 |(s1) +3|K98|3| | |
5449 |(s1) +4|K123|4| | |
5450 |(s1) +5|K66|5| | |○
5451 |(s1) +6|K100|6| |○ (final)|
5452 |(s1) +7|K95|7| | |
5453 |(s1) +8|210|8|○| |
5454 |(s1) +9|K88|9| | |
5455
5456 • The search result table based on the above example is shown below.
5457
5458 |=**Device number**|=**Content**|=**Search result items**
5459 |(d)|3|Number of identical data
5460 |(d) +1|0|The position of the same data (first time)
5461 |(d) +2|6|The position of the same data (last time)
5462 |(d) +3|5|The final position of the minimum
5463 |(d) +4|8|The final position of maximum
5464
5465 (% class="box infomessage" %)
5466 (((
5467 **✎Note: **Perform algebraic size comparison. (-10<2)
5468
5469 When there are multiple minimum and maximum values in the data, the positions behind each are stored.
5470
5471 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.
5472 )))
5473
5474 **Error code**
5475
5476 |=**Error code**|=**Content**
5477 |=4084H|When the value specified in (n) exceeds the range of 0 to 256
5478 |=4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5479 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5480
5481 **Example**
5482
5483 Refer to the example in the function description.
5484
5485 == DSER/32-bit Data Search ==
5486
5487 [[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps3.png]]**DSER(P)**
5488
5489 Search the same data and the maximum and minimum values from the data table.
5490
5491 -[DSER (s1)  (s2) (d) (n)]
5492
5493 **Content, range and data type**
5494
5495 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5496 |=(s1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 32 bit|ANY32
5497 |=(s2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 32 bit|ANY32
5498 |=(d)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 32 bit|ANY32
5499 |=(n)|Search the number of same data, maximum and minimum|1 to 128|Signed BIN 32 bit|ANY32
5500
5501 **Device used**
5502
5503 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5504 **Index**
5505
5506 **modification**
5507 )))|=(((
5508 **Pulse**
5509
5510 **extension**
5511 )))
5512 |**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**
5513 |(% rowspan="3" %)DSER|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
5514 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
5515 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
5516 | |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
5517
5518 **Features**
5519
5520 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.
5521
5522 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.
5523
5524 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.
5525
5526 • The structure and data examples of the search result table are as follows. (N=10)
5527
5528 |=(% 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**
5529 |**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
5530 |(S1)+1, (S1)|K100|(% rowspan="10" %)K100|0| |○ (First time)|
5531 |(S1)+3, (S1)+2|K111|1| | |
5532 |(S1)+5, (S1)+4|K100|2| |○|
5533 |(S1) +7, (S1) +6|K98|3| | |
5534 |(S1) +9, (S1) +8|K123|4| | |
5535 |(S1)+11, (S1)+10|K66|5| | |○
5536 |(S1) +13, (S1) +12|K100|6| |○ (final)|
5537 |(S1) +15, (S1) +14|K95|7| | |
5538 |(S1) +17, (S1) +16|210|8|○| |
5539 |(S1) +19, (S1) +18|K88|9| | |
5540
5541 • The search result table based on the above example is shown below.
5542
5543 |=**Device number**|=**Content**|=**Search result items**
5544 |(d)+1, (d)|3|Number of identical data
5545 |(d)+3, (d)+2|0|The position of the same data (first time)
5546 |(d) +5, (d) +4|6|The position of the same data (last time)
5547 |(d) +7, (d) +6|5|The final position of the minimum
5548 |(d) +9, (d) +8|8|The final position of maximum
5549
5550 (% class="box infomessage" %)
5551 (((
5552 **✎Note: **Perform algebraic size comparison. (-10<2)
5553
5554 When there are multiple minimum and maximum values in the data, the positions behind each are stored.
5555
5556 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.
5557 )))
5558
5559 **Error code**
5560
5561 |=**Error code**|=**Content**
5562 |4084H|When the value specified in (n) exceeds the range of 0 to 128
5563 |4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5564 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5565
5566 **Example**
5567
5568 Refer to the example in the function description.
5569
5570 == ALT/Bit Device Output Inversion ==
5571
5572 **ALT(P)**
5573
5574 If the input turns ON, the bit device is inverted (ON→OFF).
5575
5576 -[ALT (d)]
5577
5578 **Content, range and data type**
5579
5580 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5581 |(d)|Alternate output device number|-|Bit|ANY16_BOOL
5582
5583 **Device used**
5584
5585 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5586 **Index**
5587
5588 **modification**
5589 )))|=(((
5590 **Pulse**
5591
5592 **extension**
5593 )))
5594 |**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**
5595 |ALT|Parameter 1| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
5596
5597 **Features**
5598
5599 Alternating output (level 1)
5600
5601 Each time the instruction input changes from OFF→ON, the bit device specified in (d) is turned OFF→ON inverted.
5602
5603 (% style="text-align:center" %)
5604 [[image:图片14.png]]
5605
5606 (% style="text-align:center" %)
5607 [[image:图片15.png]]
5608
5609 Divided frequency output (through alternate output (2 levels))
5610
5611 Combine multiple ALTP instructions to perform frequency division output.
5612
5613 (% style="text-align:center" %)
5614 [[image:图片16.png]]
5615
5616 (% style="text-align:center" %)
5617 [[image:图片17.png]]
5618
5619 (% class="box infomessage" %)
5620 (((
5621 **✎Note:**
5622 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).
5623 )))
5624
5625 **Error code**
5626
5627 |=**Error code**|=**Content**
5628 |=4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
5629 |=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5630
5631 **Example**
5632
5633 (1)Start/stop via an input.
5634
5635 1. After pressing the button X4, start the action of output Y1 and stop the action of Y0.
5636 1. After pressing the button X4 again, stop the action of output Y1 and start the action of Y0.
5637
5638 (% style="text-align:center" %)
5639 [[image:图片18.png]]
5640
5641 (2)Flashing action
5642
5643 1. When input X6 is ON, the contact of timer T2 will act instantaneously every 5 seconds.
5644 1. The contact of T2 makes the output Y7 alternately ON/OFF every time it is ON.
5645
5646 (% style="text-align:center" %)
5647 [[image:图片19.png]]
5648
5649 (% style="text-align:center" %)
5650 [[image:图片20.png]]
5651
5652 == INCD/BIN 16-bit Data Relative Method ==
5653
5654 **INCD**
5655
5656 Use a pair of counters to create multiple output modes.
5657
5658 -[INCD (s1) (s2) (d) (n)]
5659
5660 **Content, range and data type**
5661
5662 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5663 |(s1)|The start device number storing the set value|-|Signed BIN 16 bit|ANY16
5664 |(s2)|The start number of counter for current value monitoring|-|Signed BIN 16 bit|ANY16
5665 |(d)|The start bit device number of output|-|Bit|ANY16_BOOL
5666 |(n)|Number of output bit device points|1 to 64|Signed BIN 16 bit|ANY16
5667
5668 **Device used**
5669
5670 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5671 **Index**
5672
5673 **modification**
5674 )))|=(((
5675 **Pulse**
5676
5677 **extension**
5678 )))
5679 |**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**
5680 |(% rowspan="4" %)INCD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5681 |Parameter 2| | | | | | | | | | | | | | | |●| | | | | | | | |●|
5682 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5683 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5684
5685 **Features**
5686
5687 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.
5688
5689 **Example**
5690
5691 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.
5692
5693 (% style="text-align:center" %)
5694 [[image:图片21.png]]
5695
5696 It is assumed that the following data is written using the transfer instruction in advance.
5697
5698 |(% colspan="2" %)**Storage device**|(% colspan="2" %)**Output**
5699 |**-**|**Data value (example)**|**-**|**Example**
5700 |(S1)|D300=20|(D)|M0
5701 |(S1)+1|D301=30|(D) +1|M1
5702 |(S1)+2|D302=10|(D) +2|M2
5703 |(S1) +3|D303=40|(D) +3|M3
5704 |...|....|...|...
5705 |(S1)+(n)-1|-|(D) +n-1|-
5706
5707 Timing diagram
5708
5709 (% style="text-align:center" %)
5710 [[image:图片22.png]]
5711
5712 If the instruction contact turns on, the M0 output turns on.
5713
5714 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.
5715
5716 The next output M1 turns ON.
5717
5718 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.
5719
5720 Compare the same to the point (K4) specified in (n). (1≤(n)≤64)
5721
5722 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.
5723
5724 Return to the beginning and repeat output.
5725
5726 (% class="box infomessage" %)
5727 (((
5728 **✎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...).
5729
5730 Up to 4 INCD instructions can be driven simultaneously in the program.
5731 )))
5732
5733 **Error code**
5734
5735 |=**Error code**|=**Content**
5736 |4084H|When the value specified in (n) exceeds the range of 1 to 64
5737 |4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5738 |4086H|When the device specified in the write application instruction (s2) and (d) exceeds the corresponding device range
5739 |4089H|The number of instruction drives exceeds the limit.
5740
5741 **Example**
5742
5743 Refer to the example in the function description.
5744
5745 == RAMP/Control Ramp Signal ==
5746
5747 **RAM(P)**
5748
5749 Obtain data that changes between the start (initial value) and end (target value) two values specified (n) times.
5750
5751 -[RAMP  (s1)  (s2)  (d)  (n)]
5752
5753 **Content, range and data type**
5754
5755 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5756 |(s1)|The device number that stores the initial value of the set ramp|-|Signed BIN 16 bit|ANY16
5757 |(s2)|The device number that stores the set ramp target value|-|Signed BIN 16 bit|ANY16
5758 |(d)|The device number that stores the current value data of ramp|-|Signed BIN 16 bit|ANY16
5759 |(n)|Ramp transition time (scan period)|1-32767|Signed BIN 16 bit|ANY16
5760
5761 **Device used**
5762
5763 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5764 **Index**
5765
5766 **modification**
5767 )))|=(((
5768 **Pulse**
5769
5770 **extension**
5771 )))
5772 |**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**
5773 |(% rowspan="4" %)RAMP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5774 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5775 |Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
5776 |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5777
5778 **Features**
5779
5780 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.
5781
5782 (% style="text-align:center" %)
5783 [[image:图片23.png]]
5784
5785 (d)+1 stores the number of scans (0→n times).
5786
5787 The time from the start to the end value requires operation cycle×(n) scan.
5788
5789 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.
5790
5791 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).
5792
5793 (% style="text-align:center" %)
5794 [[image:图片24.png]]
5795
5796 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.
5797
5798 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).
5799
5800 According to the ON/OFF action of the mode flag SM226, the content of (d) is changed as shown below.
5801
5802 (% style="text-align:center" %)
5803 [[image:图片25.png]]
5804
5805 (% class="box infomessage" %)
5806 (((
5807 **✎Note: **
5808 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.
5809 )))
5810
5811 **Error code**
5812
5813 |=**Error code**|=**Content**
5814 |4084H|When the value specified in (n) exceeds the specified range of 1 to 32767
5815 |4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5816 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5817
5818 **Example**
5819
5820 (% style="text-align:center" %)
5821 [[image:图片26.png]]
5822
5823 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.
5824
5825 == ROTC/Rotary Table Proximity Control ==
5826
5827 **ROTC**
5828
5829 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.
5830
5831 -[ROTC (s)  (n1)  (n2)  (d)]
5832
5833 **Content, range and data type**
5834
5835 |=**Parameter**|=(% colspan="2" %)**Content**|=**Range**|=**Data type**|=**Data type (label)**
5836 |(% 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
5837 |(s)+1: Call the window number setting
5838 |(s)+2: Call the item number setting
5839 |(n1)|(% colspan="2" %)Number of divisions|2 to 32767|Signed BIN 16 bit|ANY16
5840 |(n2)|(% colspan="2" %)Singular in low speed zone|0 to 32767|Signed BIN 16 bit|ANY16
5841 |(% rowspan="8" %)(((
5842
5843
5844 (d)
5845 )))|(% 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
5846 |(d)+1: phase B signal
5847 |(d)+2: zero point detection signal
5848 |(d)+3: high-speed forward rotation
5849 |(d)+4: low speed forward rotation
5850 |(d)+5: stop
5851 |(d)+6: low speed reverse rotation
5852 |(d)+7: high-speed reverse rotation
5853
5854 **Device used**
5855
5856 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5857 **Index**
5858
5859 **modification**
5860 )))|=(((
5861 **Pulse**
5862
5863 **extension**
5864 )))
5865 |**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**
5866 |(% rowspan="4" %)ROTC|Parameter 1| | | | | | | | | | | | | | | | |●|●|●| | | | | |●|
5867 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5868 |Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5869 |Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5870
5871 **Features**
5872
5873 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.
5874
5875 (% style="text-align:center" %)
5876 [[image:图片27.png]]
5877
5878 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.
5879
5880 (% style="text-align:center" %)
5881 [[image:图片28.png]]
5882
5883 (s) is a counter, which counts how many items come to window 0.
5884
5885 (s)+1 set the number of the window to be called.
5886
5887 (s)+2 sets the number of the recalled item.
5888
5889 Specify the number of divisions (n1) and low-speed operation section (n2) of the rotary table.
5890
5891 (% class="box infomessage" %)
5892 (((
5893 **✎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.
5894
5895 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.
5896
5897 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.
5898
5899 At most 4 ROTC instructions can be executed at the same time.
5900 )))
5901
5902 **Error code**
5903
5904 |=**Error code**|=**Content**
5905 |(% rowspan="5" %)4084H|When the value specified in (n1) exceeds the range of 2 to 32767
5906 |When the value specified in (n2) exceeds the range of 0 to 32767
5907 |When the values specified in (n1) and (n2) meet the condition of (n1)<(n2)
5908 |When one of (s), (s)+1 and (s)+2 is negative.
5909 |When one of (s), (s)+1 and (s)+2 is (n1) or more.
5910 |4085H|When the device specified in read application instruction (s1), (n1), (n2) and (d) exceeds the corresponding device range
5911 |4086H|When the device specified in the write application instruction (s2) and (d) exceeds the corresponding device range
5912 |4089H|The number of instructions to be executed exceeds the limit.
5913
5914 **Example**
5915
5916 (% style="text-align:center" %)
5917 [[image:图片29.png]]
5918
5919
5920 |=**Variable**|=**Features**|=**Instructions**|=**Variable**|=**Function**|=**Instructions**
5921 |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" %)(((
5922 When X0 is ON, the result of M3 to M7 could be automatically obtained.
5923
5924
5925
5926 )))
5927 |D201|Call window number setting|M4|Run at forward direction at low velocity
5928 |D202|Call work piece number setting|M5|Stop
5929
5930 |M0|Phase A signal|(% rowspan="3" %)(((
5931 The user program executes before each scan of this statement:
5932
5933 [[image:1709803261707-909.png]]
5934
5935
5936 )))|M6|Run at reverse direction at low velocity|(% rowspan="3" %)When X0 is OFF, M3 to M7 are all OFF.
5937 |M1|Phase B signal|M7|Run at reverse direction at high velocity
5938 |M2|Zero point detection signal| |
5939
5940 == STMR/Special Function Timer ==
5941
5942 **STMR**
5943
5944 Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
5945
5946 -[STMR (s1)  (s2)  (d)]
5947
5948 **Content, range and data type**
5949
5950 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5951 |(s1)|Timer number used: T0 to T511 (100ms timer)|-|Device Name|ANY16
5952 |(s2)|Timer setting value|1-32767|Signed BIN 16 bit|ANY16
5953 |(d)|The start bit number of the output (occupies 4 points)|-|Bit|ANYBIT_ARRAY
5954
5955 **Device used**
5956
5957 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5958 **Index**
5959
5960 **modification**
5961 )))|=(((
5962 **Pulse**
5963
5964 **extension**
5965 )))
5966 |**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**
5967 |(% rowspan="3" %)STMR|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | |●|
5968 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5969 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5970
5971 **Features**
5972
5973 Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
5974
5975 (% style="text-align:center" %)
5976 [[image:图片30.png]]
5977
5978 1. The instruction of STMR instruction
5979 1. The setting value specified in (S2)
5980
5981 (% style="text-align:center" %)
5982 [[image:图片31.png]]
5983
5984 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.
5985
5986 (% style="text-align:center" %)
5987 [[image:图片33.png]]
5988
5989 The setting value of (S2) can be specified in the range of 1 to 32767 (1 to 3276.7 seconds).
5990
5991 (% class="box infomessage" %)
5992 (((
5993 **✎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.
5994
5995 The timer specified in (s1) is regarded as a 100ms timer, starting from the rising edge of the instruction contact.
5996
5997 Occupy the device specified in 4 points (d) at the beginning. Be careful not to overlap with the device used for machine control.
5998
5999 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.
6000 )))
6001
6002 **Error code**
6003
6004 |=**Error code**|=**Content**
6005 |4084H|When the value specified in (s2) is less or equal to 0
6006 |4085H|When the device specified in the read application instruction (s2) and (d) exceeds the corresponding device range
6007
6008 **Example**
6009
6010 (% style="text-align:center" %)
6011 [[image:图片34.png]]
6012
6013 (% style="text-align:center" %)
6014 [[image:图片35.png]]
6015
6016 Y0: When X10 changes from Off→On, Y0=On, when X10 changes from On→Off, Y0=Off after a delay of 10 seconds.
6017
6018 Y1: When X10 changes from On→Off, make Y1=On output once for 10 seconds.
6019
6020 Y2: When X10 changes from Off to On, output Y2=On once for 10
6021
6022 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
6023
6024 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:
6025
6026 (% style="text-align:center" %)
6027 [[image:图片36.png]]
6028
6029 (% style="text-align:center" %)
6030 [[image:图片37.png]]
6031
6032 == TTMR/Demonstration Timer ==
6033
6034 **TTMR**
6035
6036 Test the time when the TTMR instruction is ON. It is used when adjusting the timer setting time with buttons.
6037
6038 -[TTMR (d)  (s)]
6039
6040 **Content, range and data type**
6041
6042 |=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
6043 |(d)|Device for storing teaching data|-|Signed BIN 16 bit|ANY16
6044 |(s)|Multiplying ratio of teaching data|0-2|Signed BIN 16 bit|ANY16
6045
6046 **Device used**
6047
6048 |=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
6049 **Index**
6050
6051 **modification**
6052 )))|=(((
6053 **Pulse**
6054
6055 **extension**
6056 )))
6057 |**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**
6058 |(% rowspan="2" %)TTMR|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6059 |Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
6060
6061 **Features**
6062
6063 Measure the 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).
6064
6065 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7464\wps2.jpg]]
6066
6067 (% style="text-align:center" %)
6068 [[image:企业微信截图_17580029957928.png||height="259" width="538"]]
6069
6070 For the time stored in (d), when the execution time is[[image:图片1.png]] (unit: second), the actual value of (d) is as follows according to the magnification specified in (s).
6071
6072 |**(s)**|**Magnification**|**(D)**
6073 |K0|(((
6074 (% style="text-align:center" %)
6075 [[image:图片2.png]]
6076 )))|(D) ×1
6077 |K1|(((
6078 (% style="text-align:center" %)
6079 [[image:图片3.png]]
6080 )))|(D)×10
6081 |K2|(((
6082 (% style="text-align:center" %)
6083 [[image:图片4.png]]
6084 )))|(D) ×100
6085
6086 |**(s)**|**(d)**|**(d)+1 (unit: 100 milliseconds)**
6087 |K0 (unit: second)| |(d)+1 =(d)×10
6088 |K1 (unit: 100 milliseconds)| |(d)+1 =(d)
6089 |K2 (unit: 10 milliseconds)| |(d)+1 =(d)/10
6090
6091 **✎Note: **
6092
6093 If the instruction contact turns from ON→OFF, the current value of the execution time (d)+1 is cleared, and the teaching time (d) does not change.
6094
6095 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.
6096
6097 **Error code**
6098
6099 |**Error code**|**Content**
6100 |4084H|When the value specified in (n) exceeds the range of 0 to 2
6101 |4085H|When the device specified in read application instruction (d) and (s) exceeds the corresponding device range
6102 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
6103
6104 **Example**
6105
6106 Example 1
6107
6108 = **External IO instructions** =
6109
6110 == **ARWS/Arrow Switch** ==
6111
6112 **ARWS**
6113
6114 Use the arrow switches for digit movement and increase or decrease of digit values to input data instructions.
6115
6116 -[ARWS  (s)  (d1)  (d2) (n)]
6117
6118 **Content, range and data type**
6119
6120 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6121 |(s)|The start device number that input|-|BIN16 bit|ANY_BOOL
6122 |(d1)|The word device number storing BCD conversion data|-|BIN16 bit|ANY_BOOL
6123 |(d2)|The start bit device (Y) that connect the display of the 7-segment digital tube|0 to 9999|BIN16 bit|ANY16_S
6124 |(n)|Specify the number of digits displayed by the 7-segment digital tube (Setting range: K0 to K3)|0 to 3|BIN16 bit|ANY16_S
6125
6126 **Device used**
6127
6128 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6129 **Index**
6130
6131 **modification**
6132 )))|(((
6133 **Pulse**
6134
6135 **extension**
6136 )))
6137 |**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**
6138 |(% rowspan="4" %)ARWS|Parameter 1|●|●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
6139 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6140 |Parameter 3| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6141 |Parameter 4| | | | | | | | | | | | | | | | | | | | | |●|●| | |
6142
6143 **Features**
6144
6145 16-bit operation (ARWS). The 16-bit BIN value from 0 to 9999 is stored in D+1. For the sake of convenience, the following description is displayed in BCD conversion.
6146
6147 When the instruction input is ON, the ARWS instruction will operate as shown below[[image:1758526599000-920.png]]
6148
6149 Display and operation part of the content
6150
6151 [[image:1758552469974-996.png]]
6152
6153
6154 (1) The digit specification of n displayed by the 7-segment digital tube with BCD code
6155
6156 A 4-digit (10^^3^^ digit) is used as an example in the following operation description, .
6157
6158 (2) The action of the digit selection switch (S+2, S+3)
6159
6160 1)The action when input S+2 with reduced digits is ON.Each time the switch is pressed, the number of digits specification is changed according to 10^^3^^ →10^^2^^ →10^^1^^ →10^^0^^ →10^^3.^^
6161
6162 2)The action when the input S+3 with increased digits is ON. Each time the switch is pressed, the number of digits specification is changed according to 10^^3 ^^→ 10^^0 ^^→ 10^^1 ^^→ 10^^2 ^^→ 10^^3^^.
6163
6164 (3) The action of the LED for displaying the selected digits (D2+4 to D2+7). The specified number of digits can be displayed by LED by strobe signal D2+4 to D2+7.
6165
6166 (4) The operation of the data change switch in units of digits (S, S+1). The data is changed for the number of digits specified by the "digit selection switch" above.
6167
6168 1) Increase the action when the input is ON. Each time the switch is pressed, the content of D1 changes according to 0→1→2→...→8→9→0→1.
6169
6170 2) Reduce the action when the input is ON. Each time the switch is pressed, the content of D1 changes according to 0→9→8→7...1→0→9.
6171
6172 These contents can be displayed in the 7-segment digital tube display.
6173
6174 As shown above, through a series of operations, you can write the target value into D1 while viewing the 7-segment display.
6175
6176 **✎Note:**
6177
6178 * The setting of parameter n
6179
6180 Please refer to the parameter setting of SEGL (FNC 74) instruction. The setting range is 0 to 3. 
6181
6182 * The output format of the programmable controller, please use a transistor output type programmable controller.
6183 * About scan time (operation cycle) and display timing
6184 * The ARWS instruction is executed synchronously with the scan time (operation cycle) of the programmable controller.
6185 * In order to perform a series of displays, the scan time of the programmable controller needs to exceed 10ms.
6186 * When it is less than 10ms, please use the constant scan mode and run with a scan time longer than 10ms.
6187 * Number of occupied points of the device
6188
6189 1. The input of the device s occupies 4 points.
6190 1. The output of the device d2 occupies 8 points.
6191
6192 * Restrictions on the times of the uses of instructions
6193
6194 Only one ARWS instruction can be used in the program.
6195
6196 **Error code**
6197
6198 |**Error code**|**Content**
6199 |4084H|The data input in the application instruction (d1) and (d2) exceeds the specified range
6200 |4085H|The output result of the read application instruction (s), (d1) and (d2) exceeds the device range
6201 |4086H|The output result of the write application instruction (d1) and (d2) exceeds the device range
6202
6203 **Example**
6204
6205 [[image:1758552725118-406.png]]
6206
6207
6208 The corresponding hardware wiring is shown in the figure below, and the PLC should be transistor output type:
6209
6210 [[image:1758552774857-894.png]]
6211
6212
6213 (1) The digital tube in the figure shows the value of D0. Press X10 to X13 to modify the value. The value of D0 can only be between 0 and 9999.
6214
6215 (2) When X20 is ON, the cursor position is thousands. Each time the back key (X12) is pressed, the specified position is switched in the order of "thousands → hundred → ten → pieces → thousand"; if the forward key (X13) is pressed, the switching sequence is reversed; the cursor position is determined by the strobe pulse signal (YO04 to YOO7) LED indication of connection.
6216
6217 (3) For the cursor position, each time you press the increment key (X11), the content of the position changes by 0 → 1→ 2→……8→9→0→1, and when you press the decrement key (X10), press 0 →9→8→7→…… 1→0→9 changes, the modified value takes effect immediately.
6218
6219 = [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps1.png]]**DSW/Numeric key input** =
6220
6221 **DSW**
6222
6223 This instruction is to read the state of the matrix type setting switch, with 4 BCD setting switches as a group, and store the setting value in the specified unit after reading it. Up to 2 groups of setting switches can be read.
6224
6225 -[DSW (s)  (d1)  (d2)  (n)]
6226
6227 **Content, range and data type**
6228
6229 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6230 |(s)|The start device (X) number connected to the digital switch (occupies 4 points)|-|Bit|ANY_BOOL
6231 |(d1)|(((
6232 The start device (Y) number that strobe signal outputed
6233
6234 (occupies 4 points)
6235 )))|-|Bit|ANY_BOOL
6236 |(d2)|The device number that stores the value of the digital switch (occupies n points)|0 to 9999|Signed BIN16|ANY16_S
6237 |(n)|Number of groups of digital switches (4 digits a group) (n=1 or 2)|1 to 2|Signed BIN16|ANY16_S
6238
6239 **Device used**
6240
6241 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6242 **Index**
6243
6244 **modification**
6245 )))|(((
6246 **Pulse**
6247
6248 **extension**
6249 )))
6250 |**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**
6251 |(% rowspan="4" %)DSW|Parameter 1|●| | | | | | | | | | | | | | | | | | | | | | | |●|
6252 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6253 |Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6254 |Parameter 4| | | | | | | | | | | | | | | | | | | | | |●|●| | |
6255
6256 **Features**
6257
6258 This instruction is to read the state of the matrix type setting switch, with 4 BCD setting switches as a group, and store the setting value in the specified unit after reading it. Up to 2 groups of setting switches can be read.
6259
6260 (1) About the input value (d1)
6261
6262 4 digits from 0 to 9,999 could be read.
6263
6264 Data is saved in BIN (binary number) value.
6265
6266 The first group is saved in (d2), and the second group is saved in (d2)+1.
6267
6268 (2) Specification of the number of groups n
6269
6270 * When using 4 digits/1 group×1 [n=K1] pass the strobe signal
6271
6272 From (s) to [(s)+3], sequentially read the BCD 4-digit digital switches connected in (d1) to [(d1)+3], and save the value as BIN value in (d2).
6273
6274 * When using 4 digits/1 group×2 [n=K2] pass the strobe signal
6275
6276 From (s) to [(s)+3], sequentially read the BCD 4-digit digital switches connected in (d1) to [(d1)+3], and save the value as BIN value in (d2).
6277
6278 Through the strobe signal (d1) to [(d1)+3], read the BCD 4-digit digital switch connected in (s)+4 to [(s)+7] in turn, and save its value as a BIN value To (d2)+1.
6279
6280 **✎Note: **
6281
6282 (1) When the instruction contact is OFF
6283
6284 Even if it is OFF, the content of (d2) does not change, but from (d1) to [(d1)+3] all become OFF.
6285
6286 (2) Occupied points of the device
6287
6288 1) When using 4 digits 2 groups (n=K2), 2 points starting from (d2) are occupied.
6289
6290 2) When it is 4 digits and 1 group (s), 4 points are occupied, and when it is 4 digits and 2 groups, 8 points are occupied.
6291
6292 (3) When connecting a digital switch with less than 4 digits
6293
6294 For unused digits, the strobe signal <output for specified digits> (d1) does not need to be wired, but even if there are unused digits, its output is already occupied by this instruction, so it cannot be used for other purposes. Be sure to leave unused output empty.
6295
6296 (4) It is recommended to use transistor output type
6297
6298 In order to read the value of the digital switch continuously, be sure to use a transistor output type programmable controller.
6299
6300 (5) About digital switches
6301
6302 Please use a digital switch of BCD output type.
6303
6304 (6) About the read timing of keyboard input
6305
6306 In order to prevent reading omissions caused by the filter delay of keyboard input, please use the “Constant Scan Mode” and “Timer Interrupt” functions flexibly.
6307
6308 (7) The limit number of instructions
6309
6310 A maximum of two can be used at the same time
6311
6312 **Related device**
6313
6314 |**Devices**|**Name**|**Content**
6315 |SM229|End of instruction execution|After a reading cycle is over, SM229 will be set for a scan cycle
6316
6317 **Error code**
6318
6319 |**Error code**|**Content**
6320 |4084H|The data input in the application instruction (n) and (d2) exceeds the specified range
6321 |4085H|The output result of the read application instruction (s) and (d2) exceeds the device range
6322 |4086H|The output result of the write application instruction (d1) and (d2) exceeds the device range
6323 |4089H|The number of application instructions exceeds the limit
6324
6325 **Example**
6326
6327 Program
6328
6329 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps2.jpg]][[image:1758553361414-300.png]]
6330
6331 Wiring diagram
6332
6333 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps3.jpg]][[image:1758553386520-904.png]]
6334
6335 * DSW operates while M1 (digital switch read input) is ON.
6336
6337 DSW will operate until the end of one cycle of operation and the instruction execution end flag (SM229) turns ON.
6338
6339 = **HKY/Hexadecimal Numeric Key Input** =
6340
6341 **HKY**
6342
6343 Use the keyboard (16 keys) of 0 to F to input, set the numerical value (0 to 9) and operating conditions (A to F function keys) and other instructions for data input.
6344
6345 When the extended function is ON, the hexadecimal number of the 0 to F keys could be used for keyboard input.
6346
6347 -[HKY  (s)  (d1)  (d2)  (d3)]
6348
6349 **Content, range and data type**
6350
6351 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6352 |(s)|The start bit device (X) number that input 16-key (occupies 4 points)|-|Bit|ANY_BOOL
6353 |(d1)|The start device (Y) number that outputs (occupies 4 points)|-|Bit|ANY_BOOL
6354 |(d2)|The device number that stores the value input from the 16 keys|0 to 9999|BIN16 bit|ANY16_S
6355 |(d3)|The start bit device number whose key is ON (occupies 8 points)|-|BIN16 bit|ANY16_S
6356
6357 **Device used**
6358
6359 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6360 **Index**
6361
6362 **modification**
6363 )))|(((
6364 **Pulse**
6365
6366 **extension**
6367 )))
6368 |**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**
6369 |(% rowspan="4" %)HKY|Parameter 1|●| | | | | | | | | | | | | | | | | | | | | | | |●|
6370 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6371 |Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6372 |Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
6373
6374 **Features**
6375
6376 16-bit operation (HKY)
6377
6378 Scan the input [S to S+3] and column output [D1 to D1+3] signals connected with 16 keys (0 to F), press the 0 to 9 keys, the value will be saved in D2, and the keyboard detection will be output to D3 +7 in.
6379
6380 In addition, after pressing the A to F keys, the key information corresponding to the keyboard [D3 to D3+5] is ON, and the keyboard detection is output to D3+6.
6381
6382 1. About using the keys 0 to 9 to input the values D3, D3+7
6383
6384 If it is more than 9,999, overflow from the high digit. The entered value is stored in D2 as BIN (binary number).
6385
6386 When any key from 0 to 9 is pressed, the keyboard detection output D3+7 is ON.
6387
6388 1. Information about A to F keys D3 to D3+6
6389
6390 Corresponding to the A to F keys, the first 6 o'clock of D3 is ON. When any key from A to F is pressed, the keyboard detection output D3+6 is ON.
6391
6392 |**Keyboard**|**Key information**
6393 |A|D3
6394 |B|D3+1
6395 |C|D3+2
6396 |D|D3+3
6397 |E|D3+4
6398 |F|D3+5
6399
6400 **Extensions**
6401
6402 After SM167 is ON and the extended function becomes valid, the data of the hexadecimal keys from 0 to F is saved in BIN mode.
6403
6404 Except for the following, it is the same as the above-mentioned [Function and Operation Description].
6405
6406 The hexadecimal data input using the 0 to F keys is written into D2 as it is.
6407
6408 1. Regarding the numerical input using the 0 to F keys D2
6409
6410 When it is FFFF or more, overflow from the upper digits.
6411
6412 For example, when inputting 1→2→3→B→F, “23BF" is saved in D2 in BIN mode. When F is input, 1 overflows.
6413
6414 [[image:1758596503399-441.png]]
6415
6416 **✎Note**
6417
6418 * Restrictions on the number of uses of instructions
6419
6420 HKY instructions, only one of them can be used in the program.
6421
6422 * When the keyboard is pressed simultaneously
6423
6424 When multiple keys are pressed at the same time, the key pressed first is effective.
6425
6426 * When the instruction contact is OFF
6427
6428 Even if it is OFF, the content of D2 does not change, but D3 to D3 +7 all become OFF.
6429
6430 * Number of occupied points of the device
6431
6432 When 16 keys are connected, 4 points from the start device S of input (X) are occupied.
6433
6434 When 16 keys are connected, 4 points from the start device D1 of output (Y) are occupied.
6435
6436 It occupies 8 points from the start device D3 for key information output.
6437
6438 Please do not to overlap with the devices used in other controls of the machine.
6439
6440 D3 to D3+5: A to F key key information
6441
6442 D3+6: Keyboard detection output of A to F keys
6443
6444 D3+7: 0-9 key keyboard detection output
6445
6446 * About the read timing of keyboard input
6447
6448 HKY instruction is executed synchronously with the operation cycle of the programmable controller.
6449
6450 It takes 8 operation cycles to complete a series of keyboard scans.
6451
6452 In order to prevent reading omissions caused by the filter delay of keyboard input, please use the [Constant Scan Mode] and [Timer Interrupt] functions flexibly.
6453
6454 * 6. Output form
6455
6456 Please use a transistor output type programmable controller.
6457
6458 **Related device**
6459
6460 |**Devices**|**Name**|**Content**
6461 |SM229|End of instruction execution|(((
6462 OFF: (d1) to (d1)+3 is being scanned, or the instruction is not executed
6463
6464 ON: (d1) to (d1)+3 cyclic output operation (1 to 4 digit scan) and then turn ON
6465 )))
6466
6467 **Error code**
6468
6469 |**Error code**|**Content**
6470 |4085H|The output result of the read application instruction (s) and (d2) exceeds the device range
6471 |4086H|The output result of the write application instruction (d1), (d2) and (d3) exceeds the device range
6472
6473 **Example**
6474
6475 Program
6476
6477
6478 [[image:1758596600319-502.png]]
6479
6480 Wiring diagram
6481
6482 [[image:1758596665356-785.png]]
6483
6484
6485 When inputting [1]→[2]→[3]→[B]→[F], save "23BF" in D0 in BIN mode.
6486
6487 When [F] is input, [1] overflows.
6488
6489 = **DHKY/32 System Numeric Key Input** =
6490
6491 **DHKY**
6492
6493 Use the keyboard (16 keys) of 0 to F to input, set numerical value (0 to 9) and operating conditions (A to F function keys) and other instructions for data input.
6494
6495 When the extended function is ON, the hexadecimal number of 0 to F key can be used for keyboard input.
6496
6497 -[DHKY  (s)  (d1)  (d2)  (d3)]
6498
6499 **Content, range and data type**
6500
6501 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6502 |(s)|The start bit device (X) number that input 16-key (occupies 4 points)|-|Bit|ANY_BOOL
6503 |(d1)|The start device (Y) number that outputs (occupies 4 points)|-|Bit|ANY_BOOL
6504 |(d2)|The device number that stores the value input from the 16 keys|0 to 99999999|BIN32 bit|ANY32_S
6505 |(d3)|The start bit device number whose key is ON (occupies 8 points)|-|BIN16 bit|ANY16_S
6506
6507 **Device used**
6508
6509 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6510 **Index**
6511
6512 **modification**
6513 )))|(((
6514 **Pulse**
6515
6516 **extension**
6517 )))
6518 |**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**
6519 |(% rowspan="4" %)DHKY|Parameter 1|●| | | | | | | | | | | | | | | | | | | | | | | |●|
6520 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6521 |Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
6522 |Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
6523
6524 **Features**
6525
6526 32-bit operation (DHKY)
6527
6528 Scan the input [S to S+3] and column output [D1 to D1+3] signals connected with 16 keys (0 to F), press the 0 to 9 keys, and the value will be saved in [D2+1, D2] , The keyboard detection is output to D3+7.
6529
6530 In addition, after pressing the A to F keys, the key information corresponding to the keyboard [D3 to D3+5] is ON, and the keyboard detection is output to D3+6.
6531
6532 1. Regarding the use of keys from 0 to 9 to input values [D2+1, D2], D3+7
6533
6534 If it is 99,999,999 or more, overflow from the high digit.
6535
6536 The entered value is stored in [D2+1, D2] as BIN (binary number).
6537
6538 When any key from 0 to 9 is pressed, the keyboard detection output D3+7 is ON.
6539
6540 1. Button information about A to F keys D3 to D3+6
6541
6542 For keyboard press information, please refer to 16-bit operation (HKY) on the previous page
6543
6544 **extensions**
6545
6546 After SM167 is ON and the extended function becomes valid, the data of the hexadecimal keys from 0 to F is saved in BIN mode.
6547
6548 Except for the following, it is the same as the above-mentioned “Function and Operation Description”.
6549
6550 The hexadecimal data input using the 0 to F keys are written in [D2+1, D2] as they are.
6551
6552 1. Regarding the numerical input using 0 to F keys [D2+1, D2]
6553
6554 -When it is FFFFFFFF or more, overflow from the upper digits.
6555
6556 For example, when inputting [9]→[2]→[3]→[B]→[F]→[A]→[F], save "923BFAF" in [D2+1, D2] in BIN mode.
6557
6558 **✎Note**
6559
6560 * Restrictions on the number of uses of instructions
6561
6562 Only one of the DHKY instructions can be used in the program.
6563
6564 * When the keyboard is pressed simultaneously
6565
6566 When multiple keys are pressed at the same time, the key pressed first is effective.
6567
6568 * When the instruction contact is OFF
6569
6570 Even if it is OFF, the content of D2 does not change, but D3 to D3 +7 all become OFF.
6571
6572 * Number of occupied points of the device
6573
6574 When 16 keys are connected, 4 points from the start device S of input (X) are occupied.
6575
6576 When 16 keys are connected, 4 points from the start device D1 of output (Y) are occupied.
6577
6578 It occupies 8 points from the start device D3 for key information output.
6579
6580 Please be careful not to overlap with the devices used in other controls of the machine.
6581
6582 D3 to D3+5: A to F key key information
6583
6584 D3+6: Keyboard detection output of A to F keys
6585
6586 D3+7: 0-9 key keyboard detection output
6587
6588 * About the read timing of keyboard input
6589
6590 The DHKY instruction is executed synchronously with the operation cycle of the programmable controller.
6591
6592 It takes 8 operation cycles to complete a series of keyboard scans.
6593
6594 In order to prevent reading omissions caused by the filter delay of keyboard input, please use the “Constant Scan Mode” and “Timer Interrupt” functions flexibly.
6595
6596 * Output form
6597
6598 Please use a transistor output type programmable controller.
6599
6600 **Related device**
6601
6602 |**Devices**|**Name**|**Content**
6603 |SM229|End of instruction execution|(((
6604 OFF: (d1) to (d1)+3 is being scanned, or the instruction is not executed
6605
6606 ON: (d1) to (d1)+3 cyclic output operation (1 to 4 digit scan) and then turn ON
6607 )))
6608
6609 **Error code**
6610
6611 |**Error code**|**Content**
6612 |4085H|The output result of the read application instruction (s) and (d2) exceeds the device range
6613 |4086H|The output result of the write application instruction (d1), (d2) and (d3) exceeds the device range
6614
6615 **Example**
6616
6617 Program
6618
6619 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps9.jpg]]
6620
6621 .Wiring diagram
6622
6623 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps10.jpg]]
6624
6625 When inputting 1→2→3→B→F→5→7→6, save "123BF576" in BIN to [D1,D0].
6626
6627
6628 === [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps11.png]]**6.7.5 PR/ASCII Code Printing** ===
6629
6630 **PR**
6631
6632 This instruction is to output ASCII data in parallel to the output (Y).
6633
6634 -[PR  (s)  (d)]
6635
6636 **Content, range and data type**
6637
6638 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6639 |(s)|Start number of the device storing ASCII code data| |String (ASCII code only)|ANY_ASC
6640 |(d)|The start number Y of output ASCII code data|-|Bit|ANY_BOOL
6641
6642 **Device used**
6643
6644 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6645 **Index**
6646
6647 **modification**
6648 )))|(((
6649 **Pulse**
6650
6651 **extension**
6652 )))
6653 |**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**
6654 |(% rowspan="2" %)PR|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6655 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6656
6657 **Features**
6658
6659 The ASCII code stored in the lower 8 bits (1 byte) of (S) to (S)+7 is output to (D) to (D)+7 character by character in a time division manner.
6660
6661 The ASCII code saved in is shown below, and the following timing diagram is based on this example.
6662
6663 The sequence of sending starts from (S) = "A", and ends with (S) + 7 = "H" for this purpose, sending eight bytes.
6664
6665 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps12.jpg]]
6666
6667 Timing diagram
6668
6669 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps13.png]]
6670
6671 **Related device**
6672
6673 |**Devices**|**Name**|**Content**
6674 |SM227|PR mode|(((
6675 OFF: 8 bytes serial output (fixed to 8 characters)
6676
6677 ON: 16 bytes serial output (1 to 16 characters)
6678 )))
6679
6680 **✎Note**
6681
6682 * instruction input and instruction action
6683
6684 instruction input=ON: Even if the instruction is continuously ON or the pulse instruction is executed, as long as the output of one cycle ends, the execution ends.
6685
6686 SM229 only works when SM227=ON.
6687
6688 instruction input=OFF: all outputs are OFF.
6689
6690 * Relationship with scan time (operation time)
6691
6692 The instruction is executed synchronously with the scan time.
6693
6694 When the scan time is short, you can use the constant scan mode to drive; when the scan time is longer, you can use the timer interrupt drive.
6695
6696 * About the output of the programmable controller
6697
6698 Please use a transistor output type programmable controller.
6699
6700 * When 00H (NUL) exists in the data (when SM227=ON)
6701
6702 After the instruction is executed, the remaining data is not output.
6703
6704 In addition, SM229 maintains an operation cycle ON.
6705
6706 * Restrictions on the number of uses of instructions
6707
6708 Only one PR instruction can be used in the program.
6709
6710 **Error code**
6711
6712 |**Error code**|**Content**
6713 |4085H|The output result of the read application instruction (s) exceeds the device range
6714 |4086H|The output result of the write application instruction (d) exceeds the device range
6715
6716 **Example**
6717
6718 Program
6719
6720 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps14.jpg]]
6721
6722 If the ASCII code in D200 to D203 is "Stopped", the corresponding output port signal and its timing are as follows:
6723
6724 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps15.png]]
6725
6726
6727
6728 === [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps16.png]]**6.7.6 SEGD/Numeric Key Input** ===
6729
6730 **SEGD(P)**
6731
6732 instruction to light up the 7-segment digital tube (1 digit).
6733
6734 -[SEGD  (s)  (d)]
6735
6736 **Content, range and data type**
6737
6738 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6739 |(s)|Decoded start word device|-32767 to 32767|Bit|ANY_BOOL
6740 |(d)|Word device number for storing 7-segment display data|-32767 to 32767|Bit|ANY_BOOL
6741
6742 **Device used**
6743
6744 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6745 **Index**
6746
6747 **modification**
6748 )))|(((
6749 **Pulse**
6750
6751 **extension**
6752 )))
6753 |**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**
6754 |(% rowspan="2" %)SEGD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
6755 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
6756
6757 **Features**
6758
6759 Decode the low 4-digit (1 digit) of 0 to F (hexadecimal number) of (S) into 7-segment display data and save it in the low 8-digit of (d).
6760
6761 1.7-segment code decode table
6762
6763 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps17.jpg]]
6764
6765 **✎Note**
6766
6767 Number of occupied points of the device: The low 8 bits of the output of the device (S) are occupied, and the high 8 bits do not change.
6768
6769 **Error code**
6770
6771 |**Error code**|**Content**
6772 |4085H|The output result of the read application instruction (s) and (d) exceeds the device range
6773 |4086H|The output result of the write application instruction (d) exceeds the device range
6774
6775 **Example**
6776
6777 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps18.jpg]]
6778
6779 When M0 is set, the lower 4 bits of the data in D0 are decoded and output to the Y10 to Y17 ports. The corresponding table for translation is shown in the above table (7-segment code decoding table). The table does not need to be prepared by the user, and the comparison table is already available in the PLC system.
6780
6781
6782 === [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps19.png]]**6.7.7 SEGL/7SEG Vode Hour and Minute Display** ===
6783
6784 **SEGL**
6785
6786 Control 1 or 2 groups of 4-digit 7-segment digital tube display instructions with latch.
6787
6788 -[SEGL  (s)  (d)  (n)]
6789
6790 **Content, range and data type**
6791
6792 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6793 |(s)|Start word device for BCD conversion|0 to 9999|BIN16 bit|ANY16
6794 |(d)|The starting Y number to be output|-|Bit|ANY_BOOL
6795 |(n)|Parameter number [Setting range: K0(H0) to K7(H7)]|0 to 7|BIN16/32 bit|ANY16_U
6796
6797 **Device used**
6798
6799 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6800 **Index**
6801
6802 **modification**
6803 )))|(((
6804 **Pulse**
6805
6806 **extension**
6807 )))
6808 |**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**
6809 |(% rowspan="3" %)SEGL|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
6810 |Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6811 |Parameter 3| | | | | | | | | | | | | | | | | | | | | |●|●| | |
6812
6813 **Features**
6814
6815 Convert the 4-bit value of (s) into BCD data, and use the time-division method to sequentially output each 1 digit to a 7-segment digital tube with BCD decoding. (s) is valid when BIN data in the range of 0 to 9999.
6816
6817 The parameter (n) should be set as follows based on the positive and negative logic on the programmable controller side and the positive and negative logic on the 7-segment side.
6818
6819 |(% rowspan="2" %)**Programmable controller output logic**|(% rowspan="2" %)**Data input**|(% rowspan="2" %)**Strobe signal**|(% colspan="2" %)**Parameter n**
6820 |(((
6821 **4 digits**
6822
6823 **in 1 group**
6824 )))|(((
6825 **4 digits**
6826
6827 **in 2 groups**
6828 )))
6829 |(% rowspan="4" %)Negative logic|(% rowspan="2" %)Negative logic (consistent)|Negative logic (consistent)|0|4
6830 |Positive logic (inconsistent)|1|5
6831 |(% rowspan="2" %)Positive logic (inconsistent)|Negative logic (consistent)|2|6
6832 |Positive logic (inconsistent)|3|7
6833 |(% rowspan="4" %)Positive logic|(% rowspan="2" %)Positive logic (consistent)|Negative logic (consistent)|0|4
6834 |Positive logic (inconsistent)|1|5
6835 |(% rowspan="2" %)Negative logic (inconsistent)|Negative logic (consistent)|2|6
6836 |Positive logic (inconsistent)|3|7
6837
6838 1. When using 4 digits in 1 group (n=K0 to 3)
6839
6840 After converting the 4-digit value of (s) from BIN→BCD, use the time division method to output each digit in turn from (d) to (d)+3. In addition, the strobe signal output (d)+4 to (d)+7 is also output in a time-division manner, locked to the 7-terminal display of the first group of 4 digits
6841
6842 1. When using 4 digits in 2 groups (n=K4 to 7)
6843
6844 1. 4-digit group 1
6845
6846 After converting the 4-digit value of (s) from BIN→BCD, use the time division method to output each digit in turn from (d) to (d)+3. The strobe signal output (d)+4 to (d)+7 is output in time-division manner in turn, locked to the 7-segment display of the first group of 4 digits.
6847
6848 1. 4-digit group 2
6849
6850 After converting the 4-digit value of (s)+1 from BIN+BCD, use the time division method to output each digit in turn from (d)+10 to (d)+13. The strobe signal output (d)+4 to (d)+7 is output in a time-division manner in turn, locked to the 7-segment display of the second group of digits.
6851
6852 **✎Note**
6853
6854 * About the time required to update the 7-segment 4-digit display
6855
6856 The time required to update the 4-digit display (1 group or 2 groups) is 12 times the scan time (operation time).
6857
6858 * Action when instruction input is OFF
6859
6860 When the instruction input is ON, the action is repeated. However, if the instruction contact turns off during an action, the action will be interrupted. When it is ON again, it will start from the original action.
6861
6862 * Occupied points of the device
6863
6864 When using 4 digits in 1 group: 1 point from the start device specified in S is occupied.
6865
6866 Occupy 8 points from the start device specified in D. Even when the number of bits is small, the occupied points cannot be used for other purposes.
6867
6868 When using 4 digits 2 groups: 2 points from the start device specified in S are occupied.
6869
6870 Occupy 12 points from the start device specified in D. Even when the number of bits is small, the occupied points cannot be used for other purposes.
6871
6872 * About scan time (operation cycle) and display timing
6873
6874 The SEGL instruction is executed synchronously with the scan time (operation cycle) of the programmable controller.
6875
6876 In order to perform a series of displays, the scan time of the programmable controller needs to exceed 10ms.
6877
6878 When it is less than 10ms, please use the constant scan mode and run with a scan time longer than 10ms.
6879
6880 * Regarding the output format of the programmable controller
6881
6882 Please use a transistor output type programmable controller.
6883
6884 * Limit number of instructions
6885
6886 At most 2 instructions can be used at the same time.
6887
6888 Related device
6889
6890 |**Devices**|**Name**|**Content**
6891 |SM229|End of instruction execution|After the processing is completed, SM229 is ON for one scan cycle
6892
6893 Error code
6894
6895 |**Error code**|**Content**
6896 |4084H|The data input in the application instruction (n) exceeds the specified range
6897 |4085H|The output result of the read application instruction (s) exceeds the device range
6898 |4086H|The output result of the write application instruction (d) exceeds the device range
6899 |4089H|The number of application instructions exceeds the limit
6900
6901 **Example**
6902
6903 Program
6904
6905 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps20.jpg]]
6906
6907 The corresponding hardware wiring is shown in the following figure. The content of D0 is displayed on the first group of digital tubes, and the content of D1 is displayed on the second group of digital tubes. If the reading of D0 or D1 exceeds 9999, the program will run into an error:
6908
6909 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps21.png]]
6910
6911 The digital tube used in the wiring diagram has its own display data latch, 7-segment decoding and driving, and 7-segment digital of negative logic type (when the input port is low, it means that the input data is 1, or is strobed) Show tube. During display processing, PLC's Y4 to Y7 ports will scan automatically, and only one port is ON each time as a bit strobe signal. At this time, the data on Y0 to Y3 ports is the BCD code data sent to the corresponding bit. When the bit strobe signal turns from ON→OFF, it is latched into the latch in the digital tube. After internal decoding and driving, the digital tube displays the number. The PLC system cyclically processes Y4 to Y7 in turn, until all 4 bits are processed. In the same way, Y10 to Y13 are the data output ports of the second group of 4-digit digital tubes, which share the bit strobe lines of Y4 to Y7. The processing methods are the same, and the display processing of the two groups is performed at the same time. In the example, if D0=K2468 and D1=K9753, the first group will display 2 4 6 8 and the second group will display 9 7 5 3.
6912
6913 It takes 12 scan cycles to complete a display refresh. After the processing is completed: According to the positive and negative logic of the programmable controller, the positive and negative logic of the seven-segment code, etc., select according to the following principles:
6914
6915 For a group of 4 digits, n=0 to 3. When two groups of 4 digits, n= 4 to 7.
6916
6917 |**Display group number**|(% colspan="4" %)**Group 1**|(% colspan="4" %)**Group 2**
6918 |Y data output polarity|(% colspan="2" %)PNP|(% colspan="2" %)NPN|(% colspan="2" %)PNP|(% colspan="2" %)NPN
6919 |Strobe and data polarity|Identical|Opposite|Identical|Opposite|Identical|Opposite|Identical|Opposite
6920 |the value of n|0|1|2|3|4|5|6|7
6921
6922 ===
6923 **6.7.8 TKY/Numeric Key Input** ===
6924
6925 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps22.png]]**TKY**
6926
6927 Use the keyboard (number keys) of 0 to 9 to input instructions for setting data such as timers and counters.
6928
6929 -[TKY  (s) (d1) (d2)]
6930
6931 **Content, range and data type**
6932
6933 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6934 |(s)|The start bit device that input the numeric key (occupies 10 points)|-|Bit|ANY_BOOL
6935 |(d1)|Word device number for storing data|0 to 9999|Signed BIN16|ANY16_S
6936 |(d2)|The start bit device number whose key start bit device is ON (occupies 11 points)|-|Bit|ANY_BOOL
6937
6938 **Device used**
6939
6940 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6941 **Index**
6942
6943 **modification**
6944 )))|(((
6945 **Pulse**
6946
6947 **extension**
6948 )))
6949 |**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**
6950 |(% rowspan="3" %)TKY|Parameter 1|●|●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
6951 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|
6952 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
6953
6954 **Features**
6955
6956 Input [(s) to +9] to the connected number keys and press the keyboard, save the input value in (d1), and output in (d2) to +10
6957
6958 Keyboard input information and detected keyboard output.
6959
6960 1. About the input value (d1)
6961
6962 If it is more than 9,999, overflow from the high digit.
6963
6964 The entered value is saved in BIN (binary number).
6965
6966 After pressing the number keys in the order of ①, ②, ③, ④, it is stored as 2130 in (d1).
6967
6968 1. About (d2) to 10 of key information
6969
6970 (d2) to 9 key information, according to the pressed key ON/OFF.
6971
6972 When any key from 0 to 9 is pressed, the keyboard detection output of (d2) +10 is ON. 
6973
6974 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps23.png]]
6975
6976 **✎Note**
6977
6978 * When the keyboard is pressed simultaneously
6979
6980 When multiple keys are pressed at the same time, only the key pressed first is effective.
6981
6982 * When the instruction contact is OFF
6983
6984 Even if it is OFF, the content of (d2) will not change, but (d2) to (d2)+10 will be OFF.
6985
6986 * Occupied points of the device
6987
6988 **✎ **Connect the input of the number keys, occupying 10 points from (s).
6989
6990 Even when the number key is not connected (not used), since (d2) is already occupied, it cannot be used for other purposes.
6991
6992 **✎ **It occupies 11 points from the start device (d2) for key information output.
6993
6994 Please be careful not to overlap with the devices used in other controls of the machine.
6995
6996 (D2) to (d2)+9: Turn ON according to the input of number keys 0 to 9.
6997
6998 (D2)+10: It is ON when any key between 0 to 9 is pressed. (Keyboard detection output)
6999
7000 * Restrictions on the number of uses of instructions
7001
7002 Only one of the TKY instruction or DTKY instruction can be used in the program.
7003
7004 **Error code**
7005
7006 |**Error code**|**Content**
7007 |4085H|The output result of the read application instruction (s) exceeds the device range
7008 |4086H|The output result of the write application instruction (d) exceeds the device range
7009
7010 **Example**
7011
7012 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps24.jpg]]
7013
7014 To input the number "2013", press the keys 2, 0, 1, 3 (X2, X0, X1, X3) in order. The operation of the PLC internal variables is shown in the figure below.
7015
7016 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps25.png]][[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps26.jpg]]
7017
7018
7019
7020 === **6.7.9 DTKY/Numeric Key Input** ===
7021
7022 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps27.png]]**DTKY**
7023
7024 Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
7025
7026 -[STMR (s1)  (s2)  (d)]
7027
7028 **Content, range and data type**
7029
7030 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
7031 |(s)|The start bit device that input the numeric key (occupies 10 points)|-|Bit|ANY_BOOL
7032 |(d1)|Word device number for storing data|0 to 99999999|Signed BIN32|ANY32_S
7033 |(d2)|The start bit device number whose key start bit device is ON [occupies 11 points]|-|Bit|ANY_BOOL
7034
7035 **Device used**
7036
7037 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
7038 **Pulse**
7039
7040 **extension**
7041 )))
7042 |**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**
7043 |(% rowspan="3" %)DTKY|Parameter 1|●|●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
7044 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|
7045 |Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
7046
7047 **Features**
7048
7049 Input [(s) to +9] to the connected number keys and press the keyboard, save the input value in (d1), and output in (d2) to +10
7050
7051 Keyboard input information and detected keyboard output.
7052
7053 1. About the input value (d1)
7054
7055 If it is more than 9,999, overflow from the high digit.
7056
7057 The entered value is saved in BIN (binary number).
7058
7059 1. (d2) to 10 of key information
7060
7061 (d2) to +9 key information, according to the pressed key ON/OFF.
7062
7063 When any key from 0 to 9 is pressed, the keyboard detection output of (d2) +10 is ON.
7064
7065 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps28.png]]
7066
7067 **✎Note**
7068
7069 * When the keyboard is pressed simultaneously
7070 * When multiple keys are pressed at the same time, only the key pressed first is effective.
7071 * When the instruction contact is OFF
7072
7073 Even if it is OFF, the content of (d2) will not change, but (d2) to (d2)+10 will be OFF.
7074
7075 * Occupied points of the device
7076
7077 **✎** Connect the input of the number keys, occupying 10 points from (s).
7078
7079 Even when the number key is not connected (not used), since (d2) is already occupied, it cannot be used for other purposes.
7080
7081 **✎** It occupies 11 points from the start device (d2) for key information output.
7082
7083 Please be careful not to overlap with the devices used in other controls of the machine.
7084
7085 (D2) to (d2)+9: Turn ON according to the input of number keys 0 to 9.
7086
7087 (D2)+10: It is ON when any key between 0 to 9 is pressed. (Keyboard detection output)
7088
7089 * Restrictions on the number of uses of instructions
7090
7091 Only one of the TKY instruction or DTKY instruction can be used in the program.
7092
7093 **Error code**
7094
7095 |**Error code**|**Content**
7096 |4085H|The output result of the read application instruction (s) and (d1) exceeds the device range
7097 |4086H|The output result of the write application instruction (d1) and (d2) exceeds the device range
7098
7099 **Example**
7100
7101 [[image:file:///C:\Users\z\AppData\Local\Temp\ksohtml6496\wps29.jpg]]
7102
7103 When X20 is on, if you want to input the number "20205689", press 2, 0, 2, 0, 5, 6, 8, 9 (X2, X0, X2, X0, X5, X6, X10, X11) in sequence , Then (the value in (D1,D0) is 20205689)
7104
7105