欢迎图片

Changes for page 06 Basic instructions

Last modified by Iris on 2025/10/20 11:22

From version 7.1
edited by Iris
on 2025/10/20 11:22
Change comment: There is no comment for this version
To version 2.4
edited by Iris
on 2025/09/22 16:38
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1,3 +1,6209 @@
1 -= =
1 += **Transfer Comparison instruction** =
2 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 +
3 3  
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 +**Error code**
4091 +
4092 +|=**Error code**|=**Content**
4093 +|=(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4094 +|=When the value specified in (n2) exceeds the range of 1 to 6
4095 +|=When the value specified in (n3) exceeds the range of 1 to n2
4096 +|=4085H|When the device specified in read application instruction (s), (n1), (n2 )and (n3) exceeds the corresponding device range
4097 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4098 +|=4087H|When the (d) parameter in the application instruction uses an unsupported device
4099 +|=4089H|The number of application instructions exceeds the limit.
4100 +
4101 +**Example**
4102 +
4103 +Refer to the function description example.
4104 +
4105 +(% style="text-align:center" %)
4106 +[[image:图片9.png]]
4107 +
4108 +== SORT2/16-bit Data Sorting ==
4109 +
4110 +**SORT2(P)**
4111 +
4112 +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.
4113 +
4114 +-[SORT2 (s)  (n1)  (n2)  (d) (n3)]
4115 +
4116 +**Content, range and data type**
4117 +
4118 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4119 +|=(s)|The start device number storing the data table|-|Signed BIN 16 bit|ANY16
4120 +|=(n1)|Number of data (rows)|1 to 32|Signed BIN 16 bit|ANY16
4121 +|=(n2)|Number of group data (columns)|1 to 6|Signed BIN 16 bit|ANY16
4122 +|=(d)|The start device number storing the operation result|-|Signed BIN 16 bit|ANY16
4123 +|=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 16 bit|ANY16
4124 +
4125 +**Device used**
4126 +
4127 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4128 +**Index**
4129 +
4130 +**modification**
4131 +)))|=(((
4132 +**Pulse**
4133 +
4134 +**extension**
4135 +)))
4136 +|=**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4137 +|=(% rowspan="5" %)SORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4138 +|=Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4139 +|=Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4140 +|=Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
4141 +|=Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
4142 +
4143 +**Features**
4144 +
4145 +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).
4146 +
4147 +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).
4148 +
4149 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4150 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4151 +|**Management number**|**Height**|**Weight**|**Age**
4152 +|(% rowspan="3" %)When the number of data (n1)=3|Line NO.1|(s)|(s)+1|(s) +2|(s) +3
4153 +|Line NO.2|(s) +4|(s) +5|(s) +6|(s) +7
4154 +|Line NO.3|(s) +8|(s) +9|(s) +10|(s) +100
4155 +
4156 +Sequence is set by the ON/OFF status of SM165
4157 +
4158 +|= |=**Sort order setting instruction**
4159 +|SM165=ON|Descending
4160 +|SM165=OFF|Ascending
4161 +
4162 +Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4163 +
4164 +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.
4165 +
4166 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4167 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4168 +|**Management number**|**Height**|**Weight**|**Age**
4169 +|(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(s)|(s)+1|(s) +2|(s) +3
4170 +|1|150|45|20
4171 +|(% rowspan="2" %)Line NO.2|(s) +4|(s) +5|(s) +6|(s) +7
4172 +|2|180|50|40
4173 +|(% rowspan="2" %)Line NO.3|(s) +8|(s) +9|(s) +10|(s) +100
4174 +|3|160|70|30
4175 +|(% rowspan="2" %)Line NO.4|(s) +12|(s) +13|(s) +14|(s) +15
4176 +|4|100|20|8
4177 +|(% rowspan="2" %)Line NO.5|(s) +16|(s) +17|(s) +18|(s) +19
4178 +|5|150|50|45
4179 +
4180 +Press (n3)=K2 (column number 2) to execute the sorting result (SM165=OFF in the case of ascending order)
4181 +
4182 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4183 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4184 +|**Management number**|**Height**|**Weight**|**Age**
4185 +|(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +1|(d) +2|(d) +3
4186 +|4|100|20|8
4187 +|(% rowspan="2" %)Line NO.2|(d) +4|(d) +5|(d) +6|(d) +7
4188 +|1|150|45|20
4189 +|(% rowspan="2" %)Line NO.3|(d) +8|(d) +9|(d) +10|(d) +100
4190 +|5|150|50|45
4191 +|(% rowspan="2" %)Line NO.4|(d) +12|(d) +13|(d) +14|(d) +15
4192 +|3|160|70|30
4193 +|(% rowspan="2" %)Line NO.5|(d) +16|(d) +17|(d) +18|(d) +19
4194 +|2|180|50|40
4195 +
4196 +Press (n3)=K3 (column number 3) to execute the sorting result (SM165=ON in the case of ascending order)
4197 +
4198 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4199 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4200 +|**Management number**|**Height**|**Weight**|**Age**
4201 +|(% rowspan="10" %)When the number of data (n1) = 5|(% rowspan="2" %)Line NO.1|(d)|(d) +1|(d) +2|(d) +3
4202 +|3|160|70|30
4203 +|(% rowspan="2" %)Line NO.2|(d) +4|(d) +5|(d) +6|(d) +7
4204 +|2|180|50|40
4205 +|(% rowspan="2" %)Line NO.3|(d) +8|(d) +9|(d) +10|(d) +100
4206 +|5|150|50|45
4207 +|(% rowspan="2" %)Line NO.4|(d) +12|(d) +13|(d) +14|(d) +15
4208 +|1|150|45|20
4209 +|(% rowspan="2" %)Line NO.5|(d) +16|(d) +17|(d) +18|(d) +19
4210 +|4|100|20|8
4211 +
4212 +(% class="box infomessage" %)
4213 +(((
4214 +**✎Note: **Do not change the operand and data content during operation.
4215 +
4216 +When executing again, the instruction input should be turned OFF once.
4217 +
4218 +The SORT2 instruction can only be written in the program to drive 2 at most.
4219 +
4220 +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.
4221 +
4222 +Do not overlap the source data and the sorted data.
4223 +)))
4224 +
4225 +(% style="text-align:center" %)
4226 +[[image:图片10.png]]
4227 +
4228 +**Error code**
4229 +
4230 +|=**Error code**|=**Content**
4231 +|(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4232 +|When the value specified in (n2) exceeds the range of 1 to 6
4233 +|When the value specified in (n3) exceeds the range of 1 to n2
4234 +|4085H|When the device specified in read application instruction (s), (d), (n1), (n2) and (n3) exceeds the corresponding device range
4235 +|4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4236 +|4089H|The number of application instructions exceeded the limit.
4237 +
4238 +**Example**
4239 +
4240 +Refer to the function description example.
4241 +
4242 +(% style="text-align:center" %)
4243 +[[image:图片11.png]]
4244 +
4245 +== DSORT2/32-bit Data Sorting ==
4246 +
4247 +**DSORT2(P)**
4248 +
4249 +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).
4250 +
4251 +-[DSORT2 (s) (n1)  (n2)  (d)  (n3)]
4252 +
4253 +**Content, range and data type**
4254 +
4255 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4256 +|=(s)|The start device number storing the data table|-|Signed BIN 32 bit|ANY32
4257 +|=(n1)|Number of data (rows)|1 to 32|Signed BIN 32 bit|ANY32
4258 +|=(n2)|Number of group data (columns)|1 to 6|Signed BIN 32 bit|ANY32
4259 +|=(d)|The start device number storing the operation result|-|Signed BIN 32 bit|ANY32
4260 +|=(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 32 bit|ANY32
4261 +
4262 +**Device used**
4263 +
4264 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
4265 +**Pulse**
4266 +
4267 +**extension**
4268 +)))
4269 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4270 +|(% rowspan="5" %)DSORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4271 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4272 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4273 +|Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4274 +|Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4275 +
4276 +**Features**
4277 +
4278 +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).
4279 +
4280 +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).
4281 +
4282 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4283 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4284 +|**Management number**|**Height**|**Weight**|**Age**
4285 +|(% 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
4286 +|Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4287 +|Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4288 +
4289 +Sequence is set by the ON/OFF status of SM165
4290 +
4291 +|= |=**Sort order setting instructions**
4292 +|SM165=ON|Descending
4293 +|SM165=OFF|Ascending
4294 +
4295 +Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4296 +
4297 +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.
4298 +
4299 +
4300 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4301 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4302 +|**Management number**|**height**|**body weight**|**age**
4303 +|(% 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
4304 +|1|150|45|20
4305 +|(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4306 +|2|180|50|40
4307 +|(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4308 +|3|160|70|30
4309 +|(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4310 +|4|100|20|8
4311 +|(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4312 +|5|150|50|45
4313 +
4314 +Press (n3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)
4315 +
4316 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4317 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4318 +|**Management number**|**height**|**body weight**|**age**
4319 +|(% 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
4320 +|4|100|20|8
4321 +|(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4322 +|1|150|45|20
4323 +|(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4324 +|5|150|50|45
4325 +|(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4326 +|3|160|70|30
4327 +|(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4328 +|2|180|50|40
4329 +
4330 +Press (n3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)
4331 +
4332 +|=(% colspan="2" rowspan="3" %) |=(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4333 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4334 +|**Management number**|**height**|**body weight**|**age**
4335 +|(% 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
4336 +|3|160|70|30
4337 +|(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4338 +|2|180|50|40
4339 +|(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4340 +|5|150|50|45
4341 +|(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4342 +|1|150|45|20
4343 +|(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4344 +|4|100|20|8
4345 +
4346 +**✎Note: **
4347 +
4348 +Do not change the operand and data content during operation.
4349 +
4350 +When executing again, the instruction input should be turned OFF once.
4351 +
4352 +The SORT2 instruction can only be written twice in the program.
4353 +
4354 +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.
4355 +
4356 +Do not overlap the source data and the sorted data.
4357 +
4358 +
4359 +**DSORT2(P)**
4360 +
4361 +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).
4362 +
4363 +-[DSORT2 (s) (n1)  (n2)  (d)  (n3)]
4364 +
4365 +**Content, range and data type**
4366 +
4367 +|**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
4368 +|(s)|The start device number storing the data table|-|Signed BIN 32 bit|ANY32
4369 +|(n1)|Number of data (rows)|1 to 32|Signed BIN 32 bit|ANY32
4370 +|(n2)|Number of group data (columns)|1 to 6|Signed BIN 32 bit|ANY32
4371 +|(d)|The start device number storing the operation result|-|Signed BIN 32 bit|ANY32
4372 +|(n3)|The column number of the group data (column) as the sorting basis|-|Signed BIN 32 bit|ANY32
4373 +
4374 +**Device used**
4375 +
4376 +|(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
4377 +**Pulse**
4378 +
4379 +**extension**
4380 +)))
4381 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4382 +|(% rowspan="5" %)DSORT2|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4383 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4384 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4385 +|Parameter 4| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|
4386 +|Parameter 5| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
4387 +
4388 +**Features**
4389 +
4390 +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).
4391 +
4392 +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).
4393 +
4394 +|(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4395 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4396 +|**Management number**|**Height**|**Weight**|**Age**
4397 +|(% 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
4398 +|Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4399 +|Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4400 +
4401 +Sequence is set by the ON/OFF status of SM165
4402 +
4403 +| |**Sort order setting instructions**
4404 +|SM165=ON|Descending
4405 +|SM165=OFF|Ascending
4406 +
4407 +Data alignment starts when instruction input is ON, data alignment ends after (n1) scan, instruction execution end flag SM229 is set to ON.
4408 +
4409 +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.
4410 +
4411 +
4412 +|(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4413 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4414 +|**Management number**|**height**|**body weight**|**age**
4415 +|(% 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
4416 +|1|150|45|20
4417 +|(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4418 +|2|180|50|40
4419 +|(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4420 +|3|160|70|30
4421 +|(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4422 +|4|100|20|8
4423 +|(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4424 +|5|150|50|45
4425 +
4426 +Press (n3)=K2 (column NO.2) to execute the sorting result (SM165=OFF in the case of ascending order)
4427 +
4428 +|(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4429 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4430 +|**Management number**|**height**|**body weight**|**age**
4431 +|(% 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
4432 +|4|100|20|8
4433 +|(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4434 +|1|150|45|20
4435 +|(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4436 +|5|150|50|45
4437 +|(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4438 +|3|160|70|30
4439 +|(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4440 +|2|180|50|40
4441 +
4442 +Press (n3)=K3 (column NO.3) to execute the sorting result (SM165=ON in the case of ascending order)
4443 +
4444 +|(% colspan="2" rowspan="3" %) |(% colspan="4" %)**When the number of groups (n2) (n2) = K4**
4445 +|**Column NO.1**|**Column NO.2**|**Column NO.3**|**Column NO.4**
4446 +|**Management number**|**height**|**body weight**|**age**
4447 +|(% 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
4448 +|3|160|70|30
4449 +|(% rowspan="2" %)Line NO.2|(s) +9, (s) +8|(s)+11, (s)+10|(s) +13, (s) +12|(s) +15, (s) +14
4450 +|2|180|50|40
4451 +|(% rowspan="2" %)Line NO.3|(s) +17, (s) +16|(s) +19, (s) +18|(s) +21, (s) +20|(s) +23, (s) +22
4452 +|5|150|50|45
4453 +|(% rowspan="2" %)Line NO.4|(s) +25, (s) +24|(s) +27, (s) +26|(s) +29, (s) +28|(s) +31, (s) +30
4454 +|1|150|45|20
4455 +|(% rowspan="2" %)Line NO.5|(s) +33, (s) +32|(s) +35, (s) +34|(s) +37, (s) +36|(s) +39, (s) +38
4456 +|4|100|20|8
4457 +
4458 +(% class="box infomessage" %)
4459 +(((
4460 +**✎Note:**Do not change the operand and data content during operation.
4461 +
4462 +When executing again, the instruction input should be turned OFF once.
4463 +
4464 +The SORT2 instruction can only be written twice in the program.
4465 +
4466 +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.
4467 +
4468 +Do not overlap the source data and the sorted data.
4469 +)))
4470 +
4471 +(% style="text-align:center" %)
4472 +[[image:图片12.png]]
4473 +
4474 +**Error code**
4475 +
4476 +|=**Error code**|=**Content**
4477 +|=(% rowspan="3" %)4084H|When the value specified in (n1) exceeds the range of 1 to 32
4478 +|=When the value specified in (n2) exceeds the range of 1 to 6
4479 +|=When the value specified in (n3) exceeds the range of 1 to n2
4480 +|=4085H|When the device specified in read application instruction (s), (d), (n1), (n2 )and (n3) exceeds the corresponding device range
4481 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4482 +|=4089H|The number of application instructions exceeded the limit.
4483 +
4484 +**Example**
4485 +
4486 +Refer to the function description example.
4487 +
4488 +(% style="text-align:center" %)
4489 +[[image:图片13.png]]
4490 +
4491 +== SWAP/16-bit Data High and Low Byte Swap ==
4492 +
4493 +**SWAP(P) **
4494 +
4495 +Swap the high and low 8-bit value of the device specified in (d).
4496 +
4497 +-[SWAP (d)]
4498 +
4499 +**Content, range and data type**
4500 +
4501 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4502 +|(d)|Word device with high and low byte swap|-|Signed BIN 16 bit|ANY16
4503 +
4504 +**Device used**
4505 +
4506 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4507 +**Index**
4508 +
4509 +**modification**
4510 +)))|=(((
4511 +**Pulse**
4512 +
4513 +**extension**
4514 +)))
4515 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4516 +|SWAP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
4517 +
4518 +**Features**
4519 +
4520 +Convert the high and low 8-bit value of the device specified in (d).
4521 +
4522 +(% style="text-align:center" %)
4523 +[[image:图片14.png]]
4524 +
4525 +**Error code**
4526 +
4527 +|=**Error code**|=**Content**
4528 +|=4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
4529 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4530 +
4531 +**Example**
4532 +
4533 +(% style="text-align:center" %)
4534 +[[image:图片15.png]]
4535 +
4536 +When the rising edge of M0 is triggered, swap the low 8 bits and high 8 bits of D0 to get H8F2A.
4537 +
4538 +== DSWAP/32-bit Data High and Low Byte Swap ==
4539 +
4540 +**DSWAP(P)**
4541 +
4542 +The devices specified in (d) and (d)+1 will be converted to the high and low 8-bit values respectively.
4543 +
4544 +-[DSWAP (d)]
4545 +
4546 +**Content, range and data type**
4547 +
4548 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4549 +|=(d)|Word device with high and low byte swap|-|Signed BIN 32 bit|ANY32
4550 +
4551 +**Device used**
4552 +
4553 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4554 +**Index**
4555 +
4556 +**modification**
4557 +)))|=(((
4558 +**Pulse**
4559 +
4560 +**extension**
4561 +)))
4562 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4563 +|DSWAP|Parameter 1| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
4564 +
4565 +**Features**
4566 +
4567 +The devices specified in (d) and (d)+1 will be converted to the upper and lower 8-bit values respectively.
4568 +
4569 +(% style="text-align:center" %)
4570 +[[image:图片16.png]]
4571 +
4572 +(% class="box infomessage" %)
4573 +(((
4574 +**✎Note: **
4575 +If continuous execution instructions are used, conversion will be performed every scan cycle.
4576 +)))
4577 +
4578 +**Error code**
4579 +
4580 +|=**Error code**|=**Content**
4581 +|4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
4582 +|4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4583 +
4584 +**Example**
4585 +
4586 +(% style="text-align:center" %)
4587 +[[image:图片17.png]]
4588 +
4589 +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.
4590 +
4591 +(% style="text-align:center" %)
4592 +[[image:图片18.png]]
4593 +
4594 +== BTOW/Byte Unit Data Merge ==
4595 +
4596 +**BTOW(P)**
4597 +
4598 +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).
4599 +
4600 +-[BTOW (s)  (d) (n)]
4601 +
4602 +**Content, range and data type**
4603 +
4604 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4605 +|(s)|The start device that stores the data merging in byte units|-|Signed BIN 16 bit|ANY16
4606 +|(d)|The start device that stores the result of merging in byte units|-|Signed BIN 16 bit|ANY16
4607 +|(n)|Number of byte data merged|0-32767|Signed BIN 16 bit|ANY16
4608 +
4609 +**Device used**
4610 +
4611 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4612 +**Index**
4613 +
4614 +**modification**
4615 +)))|=(((
4616 +**Pulse**
4617 +
4618 +**extension**
4619 +)))
4620 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4621 +|(% rowspan="3" %)BTOW|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4622 +|Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4623 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4624 +
4625 +**Features**
4626 +
4627 +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.
4628 +
4629 +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.
4630 +
4631 +(% style="text-align:center" %)
4632 +[[image:图片19.png]]
4633 +
4634 +£: the £th byte data;
4635 +
4636 +(1): Ignore the high byte
4637 +
4638 +*1: Carry below the decimal point.
4639 +
4640 +**Example**
4641 +
4642 +When (n)=5, the data up to the lower 8 bits of (s)+(s)+4 is stored in (d)+(d)+2.
4643 +
4644 +(% style="text-align:center" %)
4645 +[[image:图片20.png]]
4646 +
4647 +(1): When (n)=5
4648 +
4649 +(2): Change to 00H
4650 +
4651 +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.
4652 +
4653 +When the number of bytes specified in (n) is 0, no processing is performed.
4654 +
4655 +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.
4656 +
4657 +**Example**
4658 +
4659 +When the low 8 bits of D11 to D16 is stored in D12 to D14.
4660 +
4661 +(% style="text-align:center" %)
4662 +[[image:图片21.png]]
4663 +
4664 +Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
4665 +
4666 +|**Device range storing the data before merging**|**Device range for storing merged data**
4667 +|(S)+0 to (s)+(n)-1|(D) to (d) + (n/2-1)
4668 +
4669 +**Error code**
4670 +
4671 +|=**Error code**|=**Content**
4672 +|=4084H|The value specified in (n) exceed range of 0 to 32767
4673 +|=4085H|When the device specified in the write application instruction (s),(d) and (n) exceeds the corresponding device range
4674 +
4675 +**Example**
4676 +
4677 +(% style="text-align:center" %)
4678 +[[image:图片22.png]]
4679 +
4680 +When M0 is ON, the data of D20 to D25 is separated according to byte units, and then stored in D10 to D12.
4681 +
4682 +(% style="text-align:center" %)
4683 +[[image:图片23.png]]
4684 +
4685 +== WTOB/Byte Unit Data Separation ==
4686 +
4687 +**WTOB(P)**
4688 +
4689 +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).
4690 +
4691 +-[WTOB (s) (d)  (n)]
4692 +
4693 +**Content, range and data type**
4694 +
4695 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4696 +|=(s)|The start device that stores the data separation in byte unit|-|Signed BIN 16 bit|ANY16
4697 +|=(d)|The start device that stores the result of separation in byte unit|-|Signed BIN 16 bit|ANY16
4698 +|=(n)|Number of byte data separated|0-32767|Signed BIN 16 bit|ANY16
4699 +
4700 +**Device used**
4701 +
4702 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
4703 +**Pulse**
4704 +
4705 +**extension**
4706 +)))
4707 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4708 +|(% rowspan="3" %)WTOB|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4709 +|Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4710 +|Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | |●|●| |●|●
4711 +
4712 +**Features**
4713 +
4714 +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).
4715 +
4716 +(% style="text-align:center" %)
4717 +[[image:图片24.png]]
4718 +
4719 +1. High byte;
4720 +1. Low byte;
4721 +1. High byte data;
4722 +1. Low byte data;
4723 +1. *1: Carry below the decimal point.
4724 +
4725 +**Example**
4726 +
4727 +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:
4728 +
4729 +(% style="text-align:center" %)
4730 +[[image:图片25.png]]
4731 +
4732 +1. (N)=5 is ignored.
4733 +1. (N)=5.
4734 +
4735 +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.
4736 +
4737 +When the number of bytes specified in (n) is 0, no processing is performed.
4738 +
4739 +00H is automatically stored in the upper 8 bits of the byte data storage device specified in (d).
4740 +
4741 +**Example**
4742 +
4743 +When D12 to D14 is stored in the low 8 bits of D11 to D16
4744 +
4745 +(% style="text-align:center" %)
4746 +[[image:图片26.png]]
4747 +
4748 +Even if the device range storing the data before merging overlaps the device rangestoring merged data, it will be handled as normal.
4749 +
4750 +|=**Device range storing the data before merging**|=**Device range storing separated data**
4751 +|(s) to (s) + (n/2-1)|(d)+0 to (d)+(n)-1
4752 +
4753 +**Error code**
4754 +
4755 +|=**Error code**|=**Content**
4756 +|=4084H|The value specified by (n) exceed the range of 0 to 32767
4757 +|=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4758 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4759 +
4760 +**Example**
4761 +
4762 +(% style="text-align:center" %)
4763 +[[image:图片27.png]]
4764 +
4765 +When M0 is ON, the data of D10 to D12 are separated according to byte units, and then stored in D20 to D25.
4766 +
4767 +(% style="text-align:center" %)
4768 +[[image:图片28.png]]
4769 +
4770 +== DIS/4-bit Separation of 16-bit Data ==
4771 +
4772 +**DIS(P)**
4773 +
4774 +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).
4775 +
4776 +-[DIS (s) (d) (n)]
4777 +
4778 +**Content, range and data type**
4779 +
4780 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4781 +|=(s)|The start device storing the data before separation|-|Signed BIN 16 bit|ANY16
4782 +|=(d)|The start device storing separated data|-|Signed BIN 16 bit|ANY16
4783 +|=(n)|Separation number (0 means no processing)|0-4|Signed BIN 16 bit|ANY16
4784 +
4785 +**Device used**
4786 +
4787 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4788 +**Index**
4789 +
4790 +**modification**
4791 +)))|=(((
4792 +**Pulse**
4793 +
4794 +**extension**
4795 +)))
4796 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4797 +|(% rowspan="3" %)DIS|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4798 +|Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4799 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4800 +
4801 +**Features**
4802 +
4803 +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).
4804 +
4805 +(% style="text-align:center" %)
4806 +[[image:图片29.png]]
4807 +
4808 +The hig-12 bit of the point (n) starting from the device specified in (s) will become 0.
4809 +
4810 +When (n)=0, it will become no processing, and the content of point (n) starting from the device of (d) will not change.
4811 +
4812 +**Error code**
4813 +
4814 +|=**Error code**|=**Content**
4815 +|=4084H|The data in (n) exceed the range of 0 to 4
4816 +|=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4817 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4818 +
4819 +**Example**
4820 +
4821 +(% style="text-align:center" %)
4822 +[[image:图片30.png]]
4823 +
4824 +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.
4825 +
4826 +== UNI/4-bit Combination of 16-bit Data ==
4827 +
4828 +**UNI(P)**
4829 +
4830 +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).
4831 +
4832 +-[UNI (s) (d) (n)]
4833 +
4834 +**Content, range and data type**
4835 +
4836 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4837 +|=(s)|The start device storing the data before merging|-|Signed BIN 16 bit|ANY16
4838 +|=(d)|The start device storing the merged data|-|Signed BIN 16 bit|ANY16
4839 +|=(n)|Number of merger|0-4|Signed BIN 16 bit|ANY16
4840 +
4841 +**Device used**
4842 +
4843 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4844 +**Index**
4845 +
4846 +**modification**
4847 +)))|=(((
4848 +**Pulse**
4849 +
4850 +**extension**
4851 +)))
4852 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4853 +|(% rowspan="3" %)UNI|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
4854 +|Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
4855 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
4856 +
4857 +**Features**
4858 +
4859 +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).
4860 +
4861 +(% style="text-align:center" %)
4862 +[[image:图片31.png]]
4863 +
4864 +The high (4-n) bits of the device specified in (d) will become 0.
4865 +
4866 +When (n)=0, it will become no processing, and the content of the device in (d) will not change.
4867 +
4868 +**Error code**
4869 +
4870 +|=**Code**|=**Content**
4871 +|=4084H|The data in (n) exceed the range of 0 to 4
4872 +|=4085H|When the device specified in read application instruction (s) and (n) exceeds the corresponding device range
4873 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
4874 +
4875 +**Example**
4876 +
4877 +(% style="text-align:center" %)
4878 +[[image:图片32.png]]
4879 +
4880 +When M0 is ON, the low 4 bits of D0 to D3 are combined and stored in D10, the value is H236F.
4881 +
4882 +== ZRST/Data Batch Reset ==
4883 +
4884 +[[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml3496\wps2.png]]**ZRST(P)**
4885 +
4886 +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.
4887 +
4888 +-[ZRST ( d1)  (d2)]
4889 +
4890 +**Content, range and data type**
4891 +
4892 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
4893 +|=(d1)|The start bit or word device number of batch reset|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
4894 +|=(d2)|The final bit or word device number of batch reset|-|Bit/Signed BIN 16 bit|ANY_ELEMENTARY
4895 +
4896 +**Device used**
4897 +
4898 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
4899 +**Index**
4900 +
4901 +**modification**
4902 +)))|=(((
4903 +**Pulse**
4904 +
4905 +**extension**
4906 +)))
4907 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
4908 +|(% rowspan="2" %)ZRST|Parameter 1| |●|●|●|●| | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
4909 +|Parameter 2| |●|●|●|●| | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
4910 +
4911 +**Features**
4912 +
4913 +Perform batch reset between the devices specified in (d1) and (d2) of the same type.
4914 +
4915 +(% style="text-align:center" %)
4916 +[[image:图片33.png]]
4917 +
4918 +When (d1) and (d2) are bit devices, write OFF (reset) in the entire device range of (d1) to (d2).
4919 +
4920 +(% style="text-align:center" %)
4921 +[[image:图片34.png]]
4922 +
4923 +When (d1) and (d2) are word devices, write K0 in the entire device range of (d1) to (d2).
4924 +
4925 +
4926 +As a separate reset instruction for the device, the RST instruction can be used for bit devices or word devices.
4927 +
4928 +(% style="text-align:center" %)
4929 +[[image:图片35.png]]
4930 +
4931 +Reset M0
4932 +
4933 +Reset the current value of T0
4934 +
4935 +Reset D0
4936 +
4937 +
4938 +The batch write instruction of constant (for example: K0) has FMOV (P) instruction, which can write 0 to word devices (including bit device specification).
4939 +
4940 +(% style="text-align:center" %)
4941 +[[image:图片36.png]]
4942 +
4943 +Write K0 in D0 to D99.
4944 +
4945 +(% class="box infomessage" %)
4946 +(((
4947 +**✎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).
4948 +
4949 +ZRST(P) instruction is a 16-bit instruction, which can specify (LC) and (HSC) devices for (d1) and (d2).
4950 +)))
4951 +
4952 +**Error code**
4953 +
4954 +|=**Error code**|=**Content**
4955 +|=4084H|When the device type specified in (d1) is different from the device type specified in (d2).
4956 +|=4085H|When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
4957 +|=4086H|When the device specified in the write application instruction (d1) exceeds the corresponding device range
4958 +
4959 +**Example**
4960 +
4961 +(% style="text-align:center" %)
4962 +[[image:图片37.png]]
4963 +
4964 +The function of this ladder diagram instruction is to set the value of the D0 to D100 device to 0.
4965 +
4966 +== ZSET/Data Batch Set ==
4967 +
4968 +**ZSET(P)**
4969 +
4970 +Perform a batch set between the devices specified in (d1) and (d2) of the same type.
4971 +
4972 +(% style="text-align:center" %)
4973 +[[image:图片38.png]]
4974 +
4975 +**Content, range and data type**
4976 +
4977 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type(label)**
4978 +|=(d1)|The start bit device number of batch set|-|Bit|ANY_BOOL
4979 +|=(d2)|The final bit device number of batch set|-|Bit|ANY_BOOL
4980 +
4981 +**Device used**
4982 +
4983 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**
4984 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**
4985 +|(% rowspan="2" %)ZSET|Parameter 1| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●
4986 +|Parameter 2| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●
4987 +
4988 +**Features**
4989 +
4990 +·Perform a batch set between the devices specified in (d1) and (d2) of the same type.
4991 +
4992 +·Write ON (set) in the entire device range of (d1) to (d2)
4993 +
4994 +(% style="text-align:center" %)
4995 +[[image:图片1.png]]
4996 +
4997 +·As a separate set instruction for the device, the SET instruction can be used for bit devices.
4998 +
4999 +(% style="text-align:center" %)
5000 +[[image:图片2.png]]
5001 +
5002 +(% class="box infomessage" %)
5003 +(((
5004 +**✎Note: **
5005 +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).
5006 +)))
5007 +
5008 +**Error code**
5009 +
5010 +|=**Error code**|=**Content**
5011 +|=4084H|When the device type specified in (d1) is different from the device type specified in (d2).
5012 +|=4085H|When the device specified in the read application instruction (d1) and (d2) exceeds the corresponding device range
5013 +|=4086H|When the device specified in the write application instruction (d1) exceeds the corresponding device range
5014 +|=4087H|When the device type specified in (d1) and (d2) are not bit device.
5015 +
5016 +**Example**
5017 +
5018 +(% style="text-align:center" %)
5019 +[[image:图片3.png]]
5020 +
5021 +The function of this LAD instruction is to set the value of the M1 to M4 device to ON.
5022 +
5023 +
5024 +== CRC/Cyclic Redundancy Check instruction ==
5025 +
5026 +**CRC(P)**
5027 +
5028 +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
5029 +
5030 +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)
5031 +
5032 +"X 16 +X 15 +X 2 +1".
5033 +
5034 +-[CRC(P) (s) (d)  (n)]
5035 +
5036 +**Content, range and data type**
5037 +
5038 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5039 +|=(s)|The device start number storing the data of CRC value generated objects |-|Signed BIN16|ANY16
5040 +|=(d)|The destination device number of the generated CRC value|-|Signed BIN16|ANY16
5041 +|=(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
5042 +
5043 +**Device used**
5044 +
5045 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5046 +**Index**
5047 +
5048 +**modification**
5049 +)))|=(((
5050 +**Pulse**
5051 +
5052 +**extension**
5053 +)))
5054 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5055 +|(% rowspan="3" %)CRC|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
5056 +|Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
5057 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| | |●
5058 +
5059 +**Features**
5060 +
5061 +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).
5062 +
5063 +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.
5064 +
5065 +1. 16-bit conversion mode (when SM161=OFF)
5066 +
5067 +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.
5068 +
5069 +(% style="text-align:center" %)
5070 +[[image:图片4.png]]
5071 +
5072 +|(% colspan="3" rowspan="3" %) |(% colspan="3" %)**Example (s)=D100, (d)=D0, (n)=6**
5073 +|(% rowspan="2" %)**Devices**|(% colspan="2" %)**Content of object data**
5074 +|**8-bit**|**16-bit**
5075 +|(% rowspan="9" %)CRC value generation target data storage destination|(% rowspan="2" %)(s)|Low byte|D100 low|01H|0301H
5076 +|High byte|D100 high|03H|
5077 +|(% rowspan="2" %)(s)+1|Low byte|D101 low|03H|0203H
5078 +|High byte|D101 high|02H|
5079 +|(% rowspan="2" %)(s)+2|Low byte|D102 low|00H|1400H
5080 +|High byte|D102 high|14H|
5081 +|...| |(% colspan="3" %)
5082 +|(% rowspan="2" %)(s)+(n)/2-1|Low byte|(% colspan="3" rowspan="2" %)
5083 +|High byte
5084 +|(% rowspan="2" %)CRC value storage target|(% rowspan="2" %)(d)|Low byte|D0 low|E4H|41E4H
5085 +|High byte|D0 high|41H|
5086 +
5087 +2. 8-bit conversion mode (when SM8161=ON)
5088 +
5089 +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.
5090 +
5091 +In the case of the following program, perform the conversion as shown below.
5092 +
5093 +|(% colspan="3" rowspan="2" %) |(% colspan="2" %)**Example) (s)=D100, (d)=D0, (n)=6**
5094 +|**Devices**|**Content of object data**
5095 +|(% rowspan="8" %)CRC value generation target data storage destination|(s)|Low byte|D100 low|01H
5096 +|(s)+1|Low byte|D101 low|03H
5097 +|(s)+2|Low byte|D102 low|03H
5098 +|(s)+3|Low byte|D103 low|02H
5099 +|(s)+4|Low byte|D104 low|00H
5100 +|(s)+5|Low byte|D105 low|14H
5101 +|(% colspan="2" %)...|(% colspan="2" %)
5102 +|(s)+(n)-1|Low byte|(% colspan="2" %)
5103 +|(% rowspan="2" %)CRC value storage target|(d)|Low byte|D0|E4H
5104 +|(d)+1|Low byte|D1|41H
5105 +
5106 +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.
5107 +
5108 +|=**Name**|=**Generator polynomial**
5109 +|=CRC-12|X^^12^^+X^^11^^+X^^3^^+X^^2^^+X+1
5110 +|=CRC-16|X^^16^^+X^^15^^+X^^2^^+1
5111 +|=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
5112 +|=CRC-CCITT|X^^16^^+X^^12^^+X^^5^^+1
5113 +
5114 +(% class="box infomessage" %)
5115 +(((
5116 +**✎Note:
5117 + **When (s1) use KnX, KnY, KnM, KnS, n must be specified as 4.
5118 +)))
5119 +
5120 +**Error code**
5121 +
5122 +|=**Error code**|=**Content**
5123 +|=4084H|The range of (n) exceeds 1 to 256
5124 +|=4085H|The data address of (s) to be converted exceeds the device range
5125 +|=4086H|The (d) write address exceeds the device range
5126 +|=4087H|Unsupported device type is used by (s) and (d)
5127 +
5128 +**Example**
5129 +
5130 +* 16-bit conversion mode
5131 +
5132 +(% style="text-align:center" %)
5133 +[[image:图片6.png]]
5134 +
5135 +* 8-bit conversion mode
5136 +
5137 +(% style="text-align:center" %)
5138 +[[image:图片7.png]]
5139 +
5140 += Matrix Input instructions =
5141 +
5142 +== MTR/Matrix Input ==
5143 +
5144 +[[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps1.png]]**MTR**
5145 +
5146 +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).
5147 +
5148 +-[MTR (s) (d1) (d2) (n)]
5149 +
5150 +**Content, range and data type**
5151 +
5152 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5153 +|(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|(((
5154 +Bit
5155 +
5156 +
5157 +)))|ANY_BOOL
5158 +|(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
5159 +|(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
5160 +|(n)|Set the number of columns in the matrix input.|2 to 8|Unsigned BIN 16 bit|ANY16_U
5161 +
5162 +**Device used**
5163 +
5164 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5165 +**Index**
5166 +
5167 +**modification**
5168 +)))|=(((
5169 +**Pulse**
5170 +
5171 +**extension**
5172 +)))
5173 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5174 +|(% rowspan="4" %)MTR|Parameter 1|●| | | | | | | | | | | | | | | | | | | | | | | | |
5175 +|Parameter 2| |●| | | | | | | | | | | | | | | | | | | | | | | |
5176 +|Parameter 3| |●|●|●|●| | | | | | | | | | | | | | | | | | | | |
5177 +|Parameter 4| | | | | | | | | | | | | | | | | | | | | |●|●| | |
5178 +
5179 +**Features**
5180 +
5181 +(% style="text-align:center" %)
5182 +[[image:图片8.png]]
5183 +
5184 +This instruction generally uses the normally ON contact SM100.
5185 +
5186 +(% style="text-align:center" %)
5187 +[[image:图片9.png]]
5188 +
5189 +According to the example in the figure:
5190 +
5191 +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
5192 +
5193 +(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.
5194 +
5195 +**Special device used**
5196 +
5197 +|**Devices**|**Content**
5198 +|SM229|SM229 will turn ON after one cycle of execution is completed
5199 +
5200 +(% class="box infomessage" %)
5201 +(((
5202 +**✎Note: **
5203 +The MTR instruction can only run one instruction at the same time.
5204 +)))
5205 +
5206 +**Error code**
5207 +
5208 +|=**Error code**|=**Content**
5209 +|(% rowspan="2" %)4085H|The read address of (s) and (n) exceeds the device range
5210 +|(s) use the numbered device whose low bit is not 0
5211 +|(% rowspan="2" %)4086HA|The write address of (d1) and (d2) exceeds the device range
5212 +|(d2) use the numbered device whose low bit is not 0
5213 +|4084H|(n) is not in the range of 2 to 8
5214 +|4089H|Multiple MTR instructions are executed at the same time
5215 +
5216 += Convenient instructions =
5217 +
5218 +== ABSD/BIN 16-bit Data Absolute Method ==
5219 +
5220 +[[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps2.png]]**ABSD**
5221 +
5222 +Create multiple output modes corresponding to the current counter (BIN 16-bit value).
5223 +
5224 +-[ABSD (s1) (s2)  (d) (n)]
5225 +
5226 +**Content, range and data type**
5227 +
5228 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5229 +|=(s1)|(((
5230 +The start device number storing the data table
5231 +
5232 +(rising edge point and falling edge point)
5233 +)))|-|Signed BIN 16 bit|ANY16
5234 +|=(s2)|The counter number used for monitoring of the current value compared to the data table|-|Signed BIN 16 bit|ANY16
5235 +|=(d)|The number of points of the output start device|-|Bit|ANY16_BOOL
5236 +|=(n)|Number of table rows and output bit device points|1 to 64|Signed BIN 16 bit|ANY16
5237 +
5238 +**Device used**
5239 +
5240 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5241 +**Index**
5242 +
5243 +**modification**
5244 +)))|=(((
5245 +**Pulse**
5246 +
5247 +**extension**
5248 +)))
5249 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5250 +|(% rowspan="4" %)ABSD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5251 +|Parameter 2| | | | | | | | | | | | | | | |●| | | | | | | | |●|
5252 +|Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5253 +|Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5254 +
5255 +**Features**
5256 +
5257 +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)
5258 +
5259 +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.
5260 +
5261 +(% style="text-align:center" %)
5262 +[[image:图片10.png]]
5263 +
5264 +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.
5265 +
5266 +|=(% colspan="2" %)**Rising edge point**|=(% colspan="2" %)**Falling edge point**|=(% rowspan="2" %)**Object output**
5267 +|**-**|**Data value (example)**|**-**|**Data value (example)**
5268 +|(S1)|40|(S1)+1|140|(D)
5269 +|(S1)+2|100|(S1) +3|200|(D) +1
5270 +|(S1) +4|160|(S1) +5|60|(D) +2
5271 +|(S1) +6|240|(S1) +7|280|(D) +3
5272 +|...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
5273 +|(S1)+2(n)-2|(S1)+2(n)-1|(D) +n-1
5274 +
5275 +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.
5276 +
5277 +(% style="text-align:center" %)
5278 +[[image:图片11.png]]
5279 +
5280 +(% class="box infomessage" %)
5281 +(((
5282 +**✎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.
5283 +
5284 +The number of target output points is determined by the value of (n). (1≤(n)≤64)
5285 +
5286 +Even if the instruction input is turned off, the output does not change.
5287 +)))
5288 +
5289 +**Error code**
5290 +
5291 +|=**Error code**|=**Content**
5292 +|=4084H|When the value specified in (n) exceeds the range of 1 to 64
5293 +|=4085H|When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
5294 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5295 +
5296 +**Example**
5297 +
5298 +Refer to the example in the function description.
5299 +
5300 +== DABSD/BIN 32-bit Data Absolute Method ==
5301 +
5302 +**DABSD**
5303 +
5304 +Create multiple output modes corresponding to the current counter (BIN 32-bit value).
5305 +
5306 +-[DABSD  (s1)  (s2) (d) (n)]
5307 +
5308 +**Content, range and data type**
5309 +
5310 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5311 +|=(s1)|(((
5312 +The start device number storing the data table
5313 +
5314 +(rising edge point and falling edge point)
5315 +)))|-|Signed BIN 32 bit|ANY32
5316 +|=(s2)|The counter number used for monitoring of the current value compared to the data table|-|Signed BIN 32 bit|ANY32
5317 +|=(d)|The number of points of the output start device|-|Bit|ANY16_BOOL
5318 +|=(n)|Number of table rows and output bit device points|1 to 64|Signed BIN 32 bit|ANY32
5319 +
5320 +**Device used**
5321 +
5322 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=**Index modification**|=(((
5323 +**Pulse**
5324 +
5325 +**extension**
5326 +)))
5327 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5328 +|(% rowspan="4" %)DABSD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|
5329 +|Parameter 2| | | | | | | | | | | | | | | |●| | | |●|●| | | |●|
5330 +|Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5331 +|Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|
5332 +
5333 +**Features**
5334 +
5335 +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)
5336 +
5337 +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.
5338 +
5339 +(% style="text-align:center" %)
5340 +[[image:图片12.png]]
5341 +
5342 +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.
5343 +
5344 +|=(% colspan="2" %)**Rising edge point**|=(% colspan="2" %)**Falling edge point**|=(% rowspan="2" %)**Object output**
5345 +|**-**|**Data value (example)**|**-**|**Data value (example)**
5346 +|(S1)+1, (S1)|40|(S1)+3, (S1)+2|140|(D)
5347 +|(S1)+5, (S1)+4|100|(S1) +7, (S1) +6|200|(D) +1
5348 +|(S1) +9, (S1) +8|160|(S1)+11, (S1)+10|60|(D) +2
5349 +|(S1) +13, (S1) +12|240|(S1) +15, (S1) +14|280|(D) +3
5350 +|...|(% rowspan="2" %)-|...|(% rowspan="2" %)-|...
5351 +|(((
5352 +(S1)+4(n)-3,
5353 +
5354 +(S1)+4(n)-4
5355 +)))|(((
5356 +(S1)+4(n)-1,
5357 +
5358 +(S1)+4(n)-2
5359 +)))|(D) +n-1
5360 +
5361 +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.
5362 +
5363 +(% style="text-align:center" %)
5364 +[[image:图片13.png]]
5365 +
5366 +(% class="box infomessage" %)
5367 +(((
5368 +**✎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.
5369 +
5370 +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.
5371 +
5372 +The number of target output points is determined by the value of (n). (1≤(n)≤64)
5373 +
5374 +Even if the instruction input is turned off, the output does not change.
5375 +)))
5376 +
5377 +**Error code**
5378 +
5379 +|=**Error code**|=**Content**
5380 +|=4084H|When the value specified in (n) exceeds the range of 1 to 64
5381 +|=4085H|When the device specified in the read application instruction (s1), (s2 )and (n) exceeds the corresponding device range
5382 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5383 +
5384 +**Example**
5385 +
5386 +Refer to the example in the function description.
5387 +
5388 +== SER/16-bit Data Search ==
5389 +
5390 +**SER(P)**
5391 +
5392 +Search the same data and the maximum and minimum values from the data table.
5393 +
5394 +-[SER (s1) (s2)  (d) (n)]
5395 +
5396 +**Content, range and data type**
5397 +
5398 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5399 +|=(s1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 16 bit|ANY16
5400 +|=(s2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 16 bit|ANY16
5401 +|=(d)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 16 bit|ANY16
5402 +|=(n)|Search the number of same data, maximum and minimum|1 to 256|Signed BIN 16 bit|ANY16
5403 +
5404 +**Device used**
5405 +
5406 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5407 +**Index**
5408 +
5409 +**modification**
5410 +)))|=(((
5411 +**Pulse**
5412 +
5413 +**extension**
5414 +)))
5415 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5416 +|(% rowspan="3" %)SER|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
5417 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |● |● | |●|●
5418 +|Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
5419 +| |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
5420 +
5421 +**Features**
5422 +
5423 +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.
5424 +
5425 +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).
5426 +
5427 +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.
5428 +
5429 +• The structure and data examples of the search result table are as follows. (N=10)
5430 +
5431 +|=(% rowspan="2" %)**The searched device (s1)**|=(% rowspan="2" %)(((
5432 +**The value of the**
5433 +
5434 +**searched data (s1)**
5435 +)))|=(% rowspan="2" %)(((
5436 +**Comparison data**
5437 +
5438 +**(S2) value**
5439 +)))|=(% rowspan="2" %)**Data location**|=(% colspan="3" %)**search results**
5440 +|**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
5441 +|(s1)|K100|(% rowspan="10" %)K100|0| |○(First time)|
5442 +|(s1)+1|K111|1| | |
5443 +|(s1)+2|K100|2| |○|
5444 +|(s1) +3|K98|3| | |
5445 +|(s1) +4|K123|4| | |
5446 +|(s1) +5|K66|5| | |○
5447 +|(s1) +6|K100|6| |○ (final)|
5448 +|(s1) +7|K95|7| | |
5449 +|(s1) +8|210|8|○| |
5450 +|(s1) +9|K88|9| | |
5451 +
5452 +• The search result table based on the above example is shown below.
5453 +
5454 +|=**Device number**|=**Content**|=**Search result items**
5455 +|(d)|3|Number of identical data
5456 +|(d) +1|0|The position of the same data (first time)
5457 +|(d) +2|6|The position of the same data (last time)
5458 +|(d) +3|5|The final position of the minimum
5459 +|(d) +4|8|The final position of maximum
5460 +
5461 +(% class="box infomessage" %)
5462 +(((
5463 +**✎Note: **Perform algebraic size comparison. (-10<2)
5464 +
5465 +When there are multiple minimum and maximum values in the data, the positions behind each are stored.
5466 +
5467 +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.
5468 +)))
5469 +
5470 +**Error code**
5471 +
5472 +|=**Error code**|=**Content**
5473 +|=4084H|When the value specified in (n) exceeds the range of 0 to 256
5474 +|=4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5475 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5476 +
5477 +**Example**
5478 +
5479 +Refer to the example in the function description.
5480 +
5481 +== DSER/32-bit Data Search ==
5482 +
5483 +[[image:file:///C:\Users\ANNAXU~~1\AppData\Local\Temp\ksohtml11864\wps3.png]]**DSER(P)**
5484 +
5485 +Search the same data and the maximum and minimum values from the data table.
5486 +
5487 +-[DSER (s1)  (s2) (d) (n)]
5488 +
5489 +**Content, range and data type**
5490 +
5491 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5492 +|=(s1)|Search for the start device number of the same data, maximum value, and minimum value|-|Signed BIN 32 bit|ANY32
5493 +|=(s2)|Search for the value of the same data or its storage destination device number|-|Signed BIN 32 bit|ANY32
5494 +|=(d)|Search for the same data, maximum value, minimum value and store the start device number|-|Signed BIN 32 bit|ANY32
5495 +|=(n)|Search the number of same data, maximum and minimum|1 to 128|Signed BIN 32 bit|ANY32
5496 +
5497 +**Device used**
5498 +
5499 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5500 +**Index**
5501 +
5502 +**modification**
5503 +)))|=(((
5504 +**Pulse**
5505 +
5506 +**extension**
5507 +)))
5508 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5509 +|(% rowspan="3" %)DSER|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●| | | |●|●
5510 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
5511 +|Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
5512 +| |Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
5513 +
5514 +**Features**
5515 +
5516 +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.
5517 +
5518 +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.
5519 +
5520 +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.
5521 +
5522 +• The structure and data examples of the search result table are as follows. (N=10)
5523 +
5524 +|=(% 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**
5525 +|**Maximum value (d) +4**|**Consistent (d)**|**Minimum value (d+3)**
5526 +|(S1)+1, (S1)|K100|(% rowspan="10" %)K100|0| |○ (First time)|
5527 +|(S1)+3, (S1)+2|K111|1| | |
5528 +|(S1)+5, (S1)+4|K100|2| |○|
5529 +|(S1) +7, (S1) +6|K98|3| | |
5530 +|(S1) +9, (S1) +8|K123|4| | |
5531 +|(S1)+11, (S1)+10|K66|5| | |○
5532 +|(S1) +13, (S1) +12|K100|6| |○ (final)|
5533 +|(S1) +15, (S1) +14|K95|7| | |
5534 +|(S1) +17, (S1) +16|210|8|○| |
5535 +|(S1) +19, (S1) +18|K88|9| | |
5536 +
5537 +• The search result table based on the above example is shown below.
5538 +
5539 +|=**Device number**|=**Content**|=**Search result items**
5540 +|(d)+1, (d)|3|Number of identical data
5541 +|(d)+3, (d)+2|0|The position of the same data (first time)
5542 +|(d) +5, (d) +4|6|The position of the same data (last time)
5543 +|(d) +7, (d) +6|5|The final position of the minimum
5544 +|(d) +9, (d) +8|8|The final position of maximum
5545 +
5546 +(% class="box infomessage" %)
5547 +(((
5548 +**✎Note: **Perform algebraic size comparison. (-10<2)
5549 +
5550 +When there are multiple minimum and maximum values in the data, the positions behind each are stored.
5551 +
5552 +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.
5553 +)))
5554 +
5555 +**Error code**
5556 +
5557 +|=**Error code**|=**Content**
5558 +|4084H|When the value specified in (n) exceeds the range of 0 to 128
5559 +|4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5560 +|4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5561 +
5562 +**Example**
5563 +
5564 +Refer to the example in the function description.
5565 +
5566 +== ALT/Bit Device Output Inversion ==
5567 +
5568 +**ALT(P)**
5569 +
5570 +If the input turns ON, the bit device is inverted (ON→OFF).
5571 +
5572 +-[ALT (d)]
5573 +
5574 +**Content, range and data type**
5575 +
5576 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5577 +|(d)|Alternate output device number|-|Bit|ANY16_BOOL
5578 +
5579 +**Device used**
5580 +
5581 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5582 +**Index**
5583 +
5584 +**modification**
5585 +)))|=(((
5586 +**Pulse**
5587 +
5588 +**extension**
5589 +)))
5590 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5591 +|ALT|Parameter 1| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|●
5592 +
5593 +**Features**
5594 +
5595 +Alternating output (level 1)
5596 +
5597 +Each time the instruction input changes from OFF→ON, the bit device specified in (d) is turned OFF→ON inverted.
5598 +
5599 +(% style="text-align:center" %)
5600 +[[image:图片14.png]]
5601 +
5602 +(% style="text-align:center" %)
5603 +[[image:图片15.png]]
5604 +
5605 +Divided frequency output (through alternate output (2 levels))
5606 +
5607 +Combine multiple ALTP instructions to perform frequency division output.
5608 +
5609 +(% style="text-align:center" %)
5610 +[[image:图片16.png]]
5611 +
5612 +(% style="text-align:center" %)
5613 +[[image:图片17.png]]
5614 +
5615 +(% class="box infomessage" %)
5616 +(((
5617 +**✎Note:**
5618 +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).
5619 +)))
5620 +
5621 +**Error code**
5622 +
5623 +|=**Error code**|=**Content**
5624 +|=4085H|When the device specified in the read application instruction (d) exceeds the corresponding device range
5625 +|=4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5626 +
5627 +**Example**
5628 +
5629 +(1)Start/stop via an input.
5630 +
5631 +1. After pressing the button X4, start the action of output Y1 and stop the action of Y0.
5632 +1. After pressing the button X4 again, stop the action of output Y1 and start the action of Y0.
5633 +
5634 +(% style="text-align:center" %)
5635 +[[image:图片18.png]]
5636 +
5637 +(2)Flashing action
5638 +
5639 +1. When input X6 is ON, the contact of timer T2 will act instantaneously every 5 seconds.
5640 +1. The contact of T2 makes the output Y7 alternately ON/OFF every time it is ON.
5641 +
5642 +(% style="text-align:center" %)
5643 +[[image:图片19.png]]
5644 +
5645 +(% style="text-align:center" %)
5646 +[[image:图片20.png]]
5647 +
5648 +== INCD/BIN 16-bit Data Relative Method ==
5649 +
5650 +**INCD**
5651 +
5652 +Use a pair of counters to create multiple output modes.
5653 +
5654 +-[INCD (s1) (s2) (d) (n)]
5655 +
5656 +**Content, range and data type**
5657 +
5658 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5659 +|(s1)|The start device number storing the set value|-|Signed BIN 16 bit|ANY16
5660 +|(s2)|The start number of counter for current value monitoring|-|Signed BIN 16 bit|ANY16
5661 +|(d)|The start bit device number of output|-|Bit|ANY16_BOOL
5662 +|(n)|Number of output bit device points|1 to 64|Signed BIN 16 bit|ANY16
5663 +
5664 +**Device used**
5665 +
5666 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5667 +**Index**
5668 +
5669 +**modification**
5670 +)))|=(((
5671 +**Pulse**
5672 +
5673 +**extension**
5674 +)))
5675 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5676 +|(% rowspan="4" %)INCD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5677 +|Parameter 2| | | | | | | | | | | | | | | |●| | | | | | | | |●|
5678 +|Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5679 +|Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5680 +
5681 +**Features**
5682 +
5683 +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.
5684 +
5685 +**Example**
5686 +
5687 +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.
5688 +
5689 +(% style="text-align:center" %)
5690 +[[image:图片21.png]]
5691 +
5692 +It is assumed that the following data is written using the transfer instruction in advance.
5693 +
5694 +|(% colspan="2" %)**Storage device**|(% colspan="2" %)**Output**
5695 +|**-**|**Data value (example)**|**-**|**Example**
5696 +|(S1)|D300=20|(D)|M0
5697 +|(S1)+1|D301=30|(D) +1|M1
5698 +|(S1)+2|D302=10|(D) +2|M2
5699 +|(S1) +3|D303=40|(D) +3|M3
5700 +|...|....|...|...
5701 +|(S1)+(n)-1|-|(D) +n-1|-
5702 +
5703 +Timing diagram
5704 +
5705 +(% style="text-align:center" %)
5706 +[[image:图片22.png]]
5707 +
5708 +If the instruction contact turns on, the M0 output turns on.
5709 +
5710 +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.
5711 +
5712 +The next output M1 turns ON.
5713 +
5714 +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.
5715 +
5716 +Compare the same to the point (K4) specified in (n). (1≤(n)≤64)
5717 +
5718 +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.
5719 +
5720 +Return to the beginning and repeat output.
5721 +
5722 +(% class="box infomessage" %)
5723 +(((
5724 +**✎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...).
5725 +
5726 +Up to 4 INCD instructions can be driven simultaneously in the program.
5727 +)))
5728 +
5729 +**Error code**
5730 +
5731 +|=**Error code**|=**Content**
5732 +|4084H|When the value specified in (n) exceeds the range of 1 to 64
5733 +|4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5734 +|4086H|When the device specified in the write application instruction (s2) and (d) exceeds the corresponding device range
5735 +|4089H|The number of instruction drives exceeds the limit.
5736 +
5737 +**Example**
5738 +
5739 +Refer to the example in the function description.
5740 +
5741 +== RAMP/Control Ramp Signal ==
5742 +
5743 +**RAM(P)**
5744 +
5745 +Obtain data that changes between the start (initial value) and end (target value) two values specified (n) times.
5746 +
5747 +-[RAMP  (s1)  (s2)  (d)  (n)]
5748 +
5749 +**Content, range and data type**
5750 +
5751 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5752 +|(s1)|The device number that stores the initial value of the set ramp|-|Signed BIN 16 bit|ANY16
5753 +|(s2)|The device number that stores the set ramp target value|-|Signed BIN 16 bit|ANY16
5754 +|(d)|The device number that stores the current value data of ramp|-|Signed BIN 16 bit|ANY16
5755 +|(n)|Ramp transition time (scan period)|1-32767|Signed BIN 16 bit|ANY16
5756 +
5757 +**Device used**
5758 +
5759 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5760 +**Index**
5761 +
5762 +**modification**
5763 +)))|=(((
5764 +**Pulse**
5765 +
5766 +**extension**
5767 +)))
5768 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5769 +|(% rowspan="4" %)RAMP|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5770 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|
5771 +|Parameter 3| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
5772 +|Parameter 4| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5773 +
5774 +**Features**
5775 +
5776 +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.
5777 +
5778 +(% style="text-align:center" %)
5779 +[[image:图片23.png]]
5780 +
5781 +(d)+1 stores the number of scans (0→n times).
5782 +
5783 +The time from the start to the end value requires operation cycle×(n) scan.
5784 +
5785 +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.
5786 +
5787 +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).
5788 +
5789 +(% style="text-align:center" %)
5790 +[[image:图片24.png]]
5791 +
5792 +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.
5793 +
5794 +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).
5795 +
5796 +According to the ON/OFF action of the mode flag SM226, the content of (d) is changed as shown below.
5797 +
5798 +(% style="text-align:center" %)
5799 +[[image:图片25.png]]
5800 +
5801 +(% class="box infomessage" %)
5802 +(((
5803 +**✎Note: **
5804 +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.
5805 +)))
5806 +
5807 +**Error code**
5808 +
5809 +|=**Error code**|=**Content**
5810 +|4084H|When the value specified in (n) exceeds the specified range of 1 to 32767
5811 +|4085H|When the device specified in read application instruction (s1), (s2), (d) and (n) exceeds the corresponding device range
5812 +|4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
5813 +
5814 +**Example**
5815 +
5816 +(% style="text-align:center" %)
5817 +[[image:图片26.png]]
5818 +
5819 +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.
5820 +
5821 +== ROTC/Rotary Table Proximity Control ==
5822 +
5823 +**ROTC**
5824 +
5825 +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.
5826 +
5827 +-[ROTC (s)  (n1)  (n2)  (d)]
5828 +
5829 +**Content, range and data type**
5830 +
5831 +|=**Parameter**|=(% colspan="2" %)**Content**|=**Range**|=**Data type**|=**Data type (label)**
5832 +|(% 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
5833 +|(s)+1: Call the window number setting
5834 +|(s)+2: Call the item number setting
5835 +|(n1)|(% colspan="2" %)Number of divisions|2 to 32767|Signed BIN 16 bit|ANY16
5836 +|(n2)|(% colspan="2" %)Singular in low speed zone|0 to 32767|Signed BIN 16 bit|ANY16
5837 +|(% rowspan="8" %)(((
5838 +
5839 +
5840 +(d)
5841 +)))|(% 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
5842 +|(d)+1: phase B signal
5843 +|(d)+2: zero point detection signal
5844 +|(d)+3: high-speed forward rotation
5845 +|(d)+4: low speed forward rotation
5846 +|(d)+5: stop
5847 +|(d)+6: low speed reverse rotation
5848 +|(d)+7: high-speed reverse rotation
5849 +
5850 +**Device used**
5851 +
5852 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5853 +**Index**
5854 +
5855 +**modification**
5856 +)))|=(((
5857 +**Pulse**
5858 +
5859 +**extension**
5860 +)))
5861 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5862 +|(% rowspan="4" %)ROTC|Parameter 1| | | | | | | | | | | | | | | | |●|●|●| | | | | |●|
5863 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5864 +|Parameter 3| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5865 +|Parameter 4| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5866 +
5867 +**Features**
5868 +
5869 +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.
5870 +
5871 +(% style="text-align:center" %)
5872 +[[image:图片27.png]]
5873 +
5874 +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.
5875 +
5876 +(% style="text-align:center" %)
5877 +[[image:图片28.png]]
5878 +
5879 +(s) is a counter, which counts how many items come to window 0.
5880 +
5881 +(s)+1 set the number of the window to be called.
5882 +
5883 +(s)+2 sets the number of the recalled item.
5884 +
5885 +Specify the number of divisions (n1) and low-speed operation section (n2) of the rotary table.
5886 +
5887 +(% class="box infomessage" %)
5888 +(((
5889 +**✎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.
5890 +
5891 +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.
5892 +
5893 +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.
5894 +
5895 +At most 4 ROTC instructions can be executed at the same time.
5896 +)))
5897 +
5898 +**Error code**
5899 +
5900 +|=**Error code**|=**Content**
5901 +|(% rowspan="5" %)4084H|When the value specified in (n1) exceeds the range of 2 to 32767
5902 +|When the value specified in (n2) exceeds the range of 0 to 32767
5903 +|When the values specified in (n1) and (n2) meet the condition of (n1)<(n2)
5904 +|When one of (s), (s)+1 and (s)+2 is negative.
5905 +|When one of (s), (s)+1 and (s)+2 is (n1) or more.
5906 +|4085H|When the device specified in read application instruction (s1), (n1), (n2) and (d) exceeds the corresponding device range
5907 +|4086H|When the device specified in the write application instruction (s2) and (d) exceeds the corresponding device range
5908 +|4089H|The number of instructions to be executed exceeds the limit.
5909 +
5910 +**Example**
5911 +
5912 +(% style="text-align:center" %)
5913 +[[image:图片29.png]]
5914 +
5915 +
5916 +|=**Variable**|=**Features**|=**Instructions**|=**Variable**|=**Function**|=**Instructions**
5917 +|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" %)(((
5918 +When X0 is ON, the result of M3 to M7 could be automatically obtained.
5919 +
5920 +
5921 +
5922 +)))
5923 +|D201|Call window number setting|M4|Run at forward direction at low velocity
5924 +|D202|Call work piece number setting|M5|Stop
5925 +
5926 +|M0|Phase A signal|(% rowspan="3" %)(((
5927 +The user program executes before each scan of this statement:
5928 +
5929 +[[image:1709803261707-909.png]]
5930 +
5931 +
5932 +)))|M6|Run at reverse direction at low velocity|(% rowspan="3" %)When X0 is OFF, M3 to M7 are all OFF.
5933 +|M1|Phase B signal|M7|Run at reverse direction at high velocity
5934 +|M2|Zero point detection signal| |
5935 +
5936 +== STMR/Special Function Timer ==
5937 +
5938 +**STMR**
5939 +
5940 +Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
5941 +
5942 +-[STMR (s1)  (s2)  (d)]
5943 +
5944 +**Content, range and data type**
5945 +
5946 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
5947 +|(s1)|Timer number used: T0 to T511 (100ms timer)|-|Device Name|ANY16
5948 +|(s2)|Timer setting value|1-32767|Signed BIN 16 bit|ANY16
5949 +|(d)|The start bit number of the output (occupies 4 points)|-|Bit|ANYBIT_ARRAY
5950 +
5951 +**Device used**
5952 +
5953 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
5954 +**Index**
5955 +
5956 +**modification**
5957 +)))|=(((
5958 +**Pulse**
5959 +
5960 +**extension**
5961 +)))
5962 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
5963 +|(% rowspan="3" %)STMR|Parameter 1| | | | | | | | | | | | | | |●| | | | | | | | | |●|
5964 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
5965 +|Parameter 3| |●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
5966 +
5967 +**Features**
5968 +
5969 +Use the 4 points starting from the device specified in (d) to perform 4 types of timer output.
5970 +
5971 +(% style="text-align:center" %)
5972 +[[image:图片30.png]]
5973 +
5974 +1. The instruction of STMR instruction
5975 +1. The setting value specified in (S2)
5976 +
5977 +(% style="text-align:center" %)
5978 +[[image:图片31.png]]
5979 +
5980 +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.
5981 +
5982 +(% style="text-align:center" %)
5983 +[[image:图片33.png]]
5984 +
5985 +The setting value of (S2) can be specified in the range of 1 to 32767 (1 to 3276.7 seconds).
5986 +
5987 +(% class="box infomessage" %)
5988 +(((
5989 +**✎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.
5990 +
5991 +The timer specified in (s1) is regarded as a 100ms timer, starting from the rising edge of the instruction contact.
5992 +
5993 +Occupy the device specified in 4 points (d) at the beginning. Be careful not to overlap with the device used for machine control.
5994 +
5995 +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.
5996 +)))
5997 +
5998 +**Error code**
5999 +
6000 +|=**Error code**|=**Content**
6001 +|4084H|When the value specified in (s2) is less or equal to 0
6002 +|4085H|When the device specified in the read application instruction (s2) and (d) exceeds the corresponding device range
6003 +
6004 +**Example**
6005 +
6006 +(% style="text-align:center" %)
6007 +[[image:图片34.png]]
6008 +
6009 +(% style="text-align:center" %)
6010 +[[image:图片35.png]]
6011 +
6012 +Y0: When X10 changes from Off→On, Y0=On, when X10 changes from On→Off, Y0=Off after a delay of 10 seconds.
6013 +
6014 +Y1: When X10 changes from On→Off, make Y1=On output once for 10 seconds.
6015 +
6016 +Y2: When X10 changes from Off to On, output Y2=On once for 10
6017 +
6018 +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
6019 +
6020 +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:
6021 +
6022 +(% style="text-align:center" %)
6023 +[[image:图片36.png]]
6024 +
6025 +(% style="text-align:center" %)
6026 +[[image:图片37.png]]
6027 +
6028 +== TTMR/Demonstration Timer ==
6029 +
6030 +**TTMR**
6031 +
6032 +Test the time when the TTMR instruction is ON. It is used when adjusting the timer setting time with buttons.
6033 +
6034 +-[TTMR (d)  (s)]
6035 +
6036 +**Content, range and data type**
6037 +
6038 +|=**Parameter**|=**Content**|=**Range**|=**Data type**|=**Data type (label)**
6039 +|(d)|Device for storing teaching data|-|Signed BIN 16 bit|ANY16
6040 +|(s)|Multiplying ratio of teaching data|0-2|Signed BIN 16 bit|ANY16
6041 +
6042 +**Device used**
6043 +
6044 +|=(% rowspan="2" %)**instruction**|=(% rowspan="2" %)**Parameter**|=(% colspan="24" %)**Devices**|=(((
6045 +**Index**
6046 +
6047 +**modification**
6048 +)))|=(((
6049 +**Pulse**
6050 +
6051 +**extension**
6052 +)))
6053 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
6054 +|(% rowspan="2" %)TTMR|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6055 +|Parameter 2| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|
6056 +
6057 +**Features**
6058 +
6059 +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).
6060 +
6061 +[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml7464\wps2.jpg]]
6062 +
6063 +(% style="text-align:center" %)
6064 +[[image:企业微信截图_17580029957928.png||height="259" width="538"]]
6065 +
6066 +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).
6067 +
6068 +|**(s)**|**Magnification**|**(D)**
6069 +|K0|(((
6070 +(% style="text-align:center" %)
6071 +[[image:图片2.png]]
6072 +)))|(D) ×1
6073 +|K1|(((
6074 +(% style="text-align:center" %)
6075 +[[image:图片3.png]]
6076 +)))|(D)×10
6077 +|K2|(((
6078 +(% style="text-align:center" %)
6079 +[[image:图片4.png]]
6080 +)))|(D) ×100
6081 +
6082 +|**(s)**|**(d)**|**(d)+1 (unit: 100 milliseconds)**
6083 +|K0 (unit: second)| |(d)+1 =(d)×10
6084 +|K1 (unit: 100 milliseconds)| |(d)+1 =(d)
6085 +|K2 (unit: 10 milliseconds)| |(d)+1 =(d)/10
6086 +
6087 +**✎Note: **
6088 +
6089 +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.
6090 +
6091 +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.
6092 +
6093 +**Error code**
6094 +
6095 +|**Error code**|**Content**
6096 +|4084H|When the value specified in (n) exceeds the range of 0 to 2
6097 +|4085H|When the device specified in read application instruction (d) and (s) exceeds the corresponding device range
6098 +|4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
6099 +
6100 +**Example**
6101 +
6102 +Example 1
6103 +
6104 += **External IO instructions** =
6105 +
6106 +=== **ARWS/Arrow Switch** ===
6107 +
6108 +**ARWS**
6109 +
6110 +Use the arrow switches for digit movement and increase or decrease of digit values to input data instructions.
6111 +
6112 +-[ARWS  (s)  (d1)  (d2) (n)]
6113 +
6114 +**Content, range and data type**
6115 +
6116 +|**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
6117 +|(s)|The start device number that input|-|BIN16 bit|ANY_BOOL
6118 +|(d1)|The word device number storing BCD conversion data|-|BIN16 bit|ANY_BOOL
6119 +|(d2)|The start bit device (Y) that connect the display of the 7-segment digital tube|0 to 9999|BIN16 bit|ANY16_S
6120 +|(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
6121 +
6122 +**Device used**
6123 +
6124 +|(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
6125 +**Index**
6126 +
6127 +**modification**
6128 +)))|(((
6129 +**Pulse**
6130 +
6131 +**extension**
6132 +)))
6133 +|**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
6134 +|(% rowspan="4" %)ARWS|Parameter 1|●|●|●|●|●| | | | |●| | | | | | | | | | | | | | |●|
6135 +|Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|
6136 +|Parameter 3| |●| | | | | | | | | | | | | | | | | | | | | | |●|
6137 +|Parameter 4| | | | | | | | | | | | | | | | | | | | | |●|●| | |
6138 +
6139 +**Features**
6140 +
6141 +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.
6142 +
6143 +When the instruction input is ON, the ARWS instruction will operate as shown below
6144 +
6145 +[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml3320\wps3.png]][[image:1758526599000-920.png]]
6146 +
6147 +Display and operation part of the content
6148 +
6149 +[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml3320\wps4.png]][[image:1758526656501-227.png]]
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 +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 +1. 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^^.
6159 +
6160 +1. 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.
6161 +1. 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.
6162 +
6163 +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.
6164 +1. 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.
6165 +
6166 +These contents can be displayed in the 7-segment digital tube display.
6167 +
6168 +As shown above, through a series of operations, you can write the target value into D1 while viewing the 7-segment display.
6169 +
6170 +**✎Note:**
6171 +
6172 +* The setting of parameter n
6173 +
6174 +Please refer to the parameter setting of SEGL (FNC 74) instruction. The setting range is 0 to 3. 
6175 +
6176 +* The output format of the programmable controller, please use a transistor output type programmable controller.
6177 +* About scan time (operation cycle) and display timing
6178 +* The ARWS instruction is executed synchronously with the scan time (operation cycle) of the programmable controller.
6179 +* In order to perform a series of displays, the scan time of the programmable controller needs to exceed 10ms.
6180 +* When it is less than 10ms, please use the constant scan mode and run with a scan time longer than 10ms.
6181 +* Number of occupied points of the device
6182 +
6183 +1. The input of the device s occupies 4 points.
6184 +1. The output of the device d2 occupies 8 points.
6185 +
6186 +* Restrictions on the times of the uses of instructions
6187 +
6188 +Only one ARWS instruction can be used in the program.
6189 +
6190 +**Error code**
6191 +
6192 +|**Error code**|**Content**
6193 +|4084H|The data input in the application instruction (d1) and (d2) exceeds the specified range
6194 +|4085H|The output result of the read application instruction (s), (d1) and (d2) exceeds the device range
6195 +|4086H|The output result of the write application instruction (d1) and (d2) exceeds the device range
6196 +
6197 +**Example**
6198 +
6199 +[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml3320\wps5.jpg]]
6200 +
6201 +The corresponding hardware wiring is shown in the figure below, and the PLC should be transistor output type:
6202 +
6203 +[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml3320\wps6.jpg]]
6204 +
6205 +(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.
6206 +
6207 +(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.
6208 +
6209 +(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.
1758552469974-996.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -141.8 KB
Content
1758552725118-406.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -10.6 KB
Content
1758552774857-894.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -61.4 KB
Content
1758553361414-300.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -30.0 KB
Content
1758553386520-904.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -83.6 KB
Content
1758596503399-441.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -23.0 KB
Content
1758596600319-502.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -8.3 KB
Content
1758596629775-570.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -51.0 KB
Content
1758596665356-785.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.Iris
Size
... ... @@ -1,1 +1,0 @@
1 -51.0 KB
Content