欢迎图片

Wiki source code of 06 Basic instructions

Version 3.1 by Iris on 2025/09/22 23:06

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