Version 1.1 by Iris on 2025/10/15 16:03

Show last authors
1 === [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps117.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps118.png]]**6.8.1 BCD/BIN → BCD** ===
2
3 **BCD(P)**
4
5 Convert the BIN data of the device specified in (s) to BCD, and store it in the device specified in (d).
6
7 The calculation of the CPU module uses BIN (binary number) data for processing, which is used to display values in a 7-segment display equipped with a BCD decoder.
8
9 -[BCD (s) (d)]
10
11 **Content, range and data type**
12
13 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
14 |(s)|BIN data or start device storing BIN data|0 to 9999|Signed BIN16|ANY16
15 |(d)|Start device for storing BCD data|-|BCD 4 digits|ANY16
16
17 **Device used**
18
19 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
20 **Index**
21
22 **modification**
23 )))|(((
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 |(% rowspan="2" %)BCD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
30 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | |●|●| |●|●
31
32 **Features**
33
34 The BIN 16-bit data (0 to 9999) of the device specified in (s) is converted to BCD 4-bit data and stored in the device specified in (d).
35
36 The data specified in (s) can be converted within the range of 0 to 9999 (BCD).
37
38 When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
39
40 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps119.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps120.jpg]]
41
42 The data specified in (s) can be converted in the range of K0 to K9999 by BCD (decimal number).
43
44 When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
45
46 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps121.jpg]]
47
48 |**(d)**|**Digits**|**Data range**
49 |K1Y0|1-bit|0 to 9
50 |K2Y0|2-bit|00 to 99
51 |K3Y0|3-bit|000 to 999
52 |K4Y0|4-bit|0000 to 9999
53
54
55
56
57
58
59
60
61
62 **✎Note**
63
64 The four arithmetic operations (+-×÷), increment, decrement instructions and other operations in the CPU module are all performed by BIN (binary number). Therefore, when sending BCD (decimal) digital switch information to the CPU module, please use the BIN(P) instruction (BCD→BIN conversion transfer instruction). In addition, when outputting to the 7-segment display of BCD (decimal number), please use the BCD(P) instruction (BIN→BCD conversion transmission).
65
66 **Error code**
67
68 |**Error code**|**Content**
69 |4084H|The data input in the application instruction (s) exceeds the specified range
70 |4085H|The output result of the read application instruction (s) exceeds the device range
71 |4086H|The output result of the write application instruction (d) exceeds the device range
72
73 **Example**
74
75 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps122.jpg]]
76
77 When M0 is set, the BIN value of D200 is converted into BCD and stored in K1Y0.
78
79
80 === [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps123.png]]**6.8.2 BIN/4-bit BCD → BIN** ===
81
82 **BIN(P)**
83
84 Convert the BCD data of the device specified in (s) to BIN and store it in the device specified in (d).
85
86 Similar to the digital switch, it converts the value set in BCD (decimal number) to BIN (binary number) that can be operated by the CPU module and is used for reading.
87
88 -[BIN  (s)  (d)]
89
90 **Content, range and data type**
91
92 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
93 |(s)|BCD data or start device storing BIN data|0 to 9999|BCD 4 digits|ANY16
94 |(d)|Start device for storing BIN data|-|Signed BIN16|ANY16
95
96 **Device used**
97
98 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
99 **Index**
100
101 **modification**
102 )))|(((
103 **Pulse**
104
105 **extension**
106 )))
107 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
108 |(% rowspan="2" %)BIN|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
109 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
110
111 **Features**
112
113 BCD 4-bit data (0 to 9999) of the device specified in (s) is converted into BIN 16-bit data and stored in the device specified in (d).
114
115 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps124.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps125.jpg]]
116
117 The data specified in (s) can be converted within the range of 0 to 9999 (BCD).
118
119 When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
120
121 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps126.jpg]]
122
123 |**(d)**|**Digits**|**Data range**
124 |K1X0|1-bit|0 to 9
125 |K2X0|2-bit|00 to 99
126 |K3X0|3-bit|000 to 999
127 |K4X0|4-bit|0000 to 9999
128
129
130
131
132
133
134
135
136 **✎Note**
137
138 The calculations in the CPU module such as the four arithmetic operations (+-×÷), increment and decrement instructions are all performed by BIN (binary number). Therefore, when sending BCD (decimal) digital switch information to the CPU module, please use the BIN(P) instruction (BCD→BIN conversion transfer instruction). In addition, when outputting to the 7-segment display of BCD (decimal number), please use the BCD(P) instruction (BIN→BCD conversion transmission).
139
140 **Error code**
141
142 |**Error code**|**Content**
143 |4084H|The data input in the application instruction (s) exceeds the specified range
144 |4085H|The output result of the read application instruction (s) exceeds the device range
145 |4086H|The output result of the write application instruction (d) exceeds the device range
146
147 **Example**
148
149 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps127.jpg]]
150
151 When M0 is set, the BCD value of K1Y0 is converted into BIN and stored in D200.
152
153
154
155
156
157
158
159 === [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps128.png]]**6.8.3 DBIN/8-bit BCD → BIN** ===
160
161 **DBIN(P)**
162
163 Convert the BCD data of the device specified in (s) to BIN and store it in the device specified in (d).
164
165 Similar to the digital switch, it converts the value set in BCD (decimal number) to BIN (binary number) that can be operated by the CPU module and is used for reading.
166
167 -[DBIN (s)  (d)]
168
169 **Content, range and data type**
170
171 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
172 |(s)|BCD data or start device storing BIN data|0 to 99999999|BCD 8 digits|ANY32
173 |(d)|Start device for storing BIN data|-|Signed BIN32|ANY32
174
175 **Device used**
176
177 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|(((
178 **Pulse**
179
180 **extension**
181 )))
182 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
183 |(% rowspan="2" %)DBIN|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
184 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
185
186 **Features**
187
188 BCD 8-bit data (0 to 99999999) of the device specified in (s) is converted to BIN 32-bit data and stored in the device specified in (d).
189
190 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps129.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps130.jpg]]
191
192 The data specified in (s) can be converted within the range of 0 to 99999999 (BCD).
193
194 When the data specified in (s) or (d) is digit specification, the conditions are as shown in the table below.
195
196 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps131.jpg]]
197
198 |**(d)**|**Bit**|**Data range**
199 |K1X0|1-bit|0 to 9
200 |K2X0|2-bit|00 to 99
201 |K3X0|3-bit|000 to 999
202 |K4X0|4-bit|0000 to 9999
203 |K5X0|5-bit|00000 to 99999
204 |K6X0|6-bit|000000 to 999999
205 |K7X0|7-bit|0000000 to 9999999
206 |K8X0|8-bit|00000000 to 99999999
207
208
209
210 **✎Note**
211
212 The calculations in the CPU module such as the four arithmetic operations (+-×÷), increment and decrement instructions are all performed by BIN (binary number). Therefore, when sending BCD (decimal) digital switch information to the CPU module, please use the BIN(P) instruction (BCD→BIN conversion transfer instruction). In addition, when outputting to the 7-segment display of BCD (decimal number), please use the BCD(P) instruction (BIN→BCD conversion transmission).
213
214 **Error code**
215
216 |**Error code**|**Content**
217 |4084H|The data input in the application instruction (s) exceeds the specified range
218 |4085H|The output result of the read application instruction (s) exceeds the device range
219 |4086H|The output result of the write application instruction (d) exceeds the device range
220
221
222
223 **Example**
224
225 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps132.jpg]]
226
227 When M0 is set, the BCD value of K8Y0 is converted into BIN and stored in D200.
228
229
230
231 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps133.png]]**4 FLT/BIN Integer → Binary Floating Point Number** ===
232
233 **FLT(P)**
234
235 An instruction to convert a BIN 16-bit integer value into a binary floating point number (real number).
236
237 -[FLT  (s) (d)]
238
239 **Content, range and data type**
240
241 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
242 |(s)|The data register number that saves the BIN integer value|-|Signed BIN 16 bit|ANY16
243 |(d)|The data register number that saves the binary floating-point number (real number)|-|Single precision real number|ANYREAL_32
244
245 **Device used**
246
247 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
248 **Index**
249
250 **modification**
251 )))|(((
252 **Pulse**
253
254 **extension**
255 )))
256 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
257 |(% rowspan="2" %)FLT|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
258 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|●
259
260 **Features**
261
262 The signed 16-bit data specified in (s) is converted into a binary floating point data and stored in (d)+1, (d).
263
264 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps134.jpg]]
265
266 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps135.jpg]]
267
268 **✎Note**
269
270 In each binary floating point number (real number) operation instruction, the specified K and H values will be automatically converted into a binary floating point number (real number), so there is no need to use the FLT instruction for conversion.
271
272 The inverse conversion instruction of this instruction is INT (convert a binary floating point value into a BIN integer).
273
274 **Error code**
275
276 |**Error code**|**Content**
277 |4085H|When the device specified in the read application instruction (s) exceeds the corresponding device range
278 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
279
280 **Example**
281
282 Four arithmetic using binary floating point operations
283
284 (1) Calculation example
285
286 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps136.png]]
287
288 (2) Sequence control program
289
290 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps137.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps138.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps139.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps140.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps141.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps142.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps143.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps144.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps145.jpg]]
291
292
293
294
295
296
297 ===
298 **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps146.png]]**5 DFLT/BIN Integer → Binary Floating Point Number** ===
299
300 **DFLT(P)**
301
302 An instruction to convert a BIN 32-bit integer value into a binary floating point number (real number).
303
304 -[DFLT  (s)  (d)]
305
306 **Content, range and data type**
307
308 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
309 |(s)|The data register number that saves the BIN32 integer value|-|Signed BIN 32 bit|ANY32
310 |(d)|The data register number that saves the binary floating-point number (real number)|-|Single precision real number|ANYREAL_32
311
312 **Device used**
313
314 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
315 **Index**
316
317 **modification**
318 )))|(((
319 **Pulse**
320
321 **extension**
322 )))
323 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
324 |(% rowspan="2" %)DFLT|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
325 |Parameter 2| | | | | | | | | | | | | | |●|●|●|●|●|●|●| | | |●|●
326
327 **Features**
328
329 Convert the signed BIN 32-bit data specified in (s) to binary floating point data and store them in (d)+1, (d).
330
331 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps147.jpg]]
332
333 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps148.jpg]]
334
335 **✎Note**
336
337 In each binary floating-point number (real number) operation instruction, the specified K and H values are automatically converted into a binary floating-point number (real number), so there is no need to use the DFLT instruction for conversion.
338
339 The inverse conversion instruction of this instruction is INT (convert a binary floating point value into a BIN integer).
340
341 **Error code**
342
343 |**Error code**|**Content**
344 |4085H|When the device specified in the read application instruction (s) exceeds the corresponding device range
345 |4086H|When the device specified in the write application instruction (d) exceeds the corresponding device range
346
347 **Example**
348
349 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps149.jpg]]
350
351 When M2=ON, convert the BIN 32-bit integer -7963590 in [D1, D0] into a single-precision floating point number -7963590.0 and store it in the [D101, D100] device.
352
353
354 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps150.png]]**6 VAL/ String → BIN 16-bit Data Conversion** ===
355
356 **VAL(P)**
357
358 After converting the character string stored in the device number specified in (s) and later into BIN 16-bit data, store the number of digits in (d1) and store the BIN data in (d2).
359
360 [VAL  (s) (d1) (d2)]
361
362 **Content, range and data type**
363
364 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
365 |(s)|The character string converted to BIN data or the start device that stores the character string|-|String|ANYSTRING_SINGLE
366 |(d1)|The start device that stores the number of digits of converted BIN data|-|Signed BIN 16 bit|ANY16_S_ARRAY
367 |(d2)|Start device for storing converted BIN data|-|Signed BIN 16 bit|ANY16_S
368
369 **Device used**
370
371 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
372 **Index**
373
374 **modification**
375 )))|(((
376 **Pulse**
377
378 **extension**
379 )))
380 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
381 |(% rowspan="3" %)VAL|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
382 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
383 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
384
385 **Features**
386
387 After converting the character string stored in the device number specified in (s) and later into BIN 16-bit data, store the number of digits in (d1) and store the BIN data in (d2). In the conversion from character string to BIN, the data from the device number specified in (s) to the device number storing 00H is treated as a character string.
388
389 The total number of digits stored in (d1) stores the number of all characters (including signs and decimal points) representing the value. The number of decimal places stored in (d1)+1 stores the number of characters representing the decimal part after 2EH(.). For the BIN 16-bit data stored in (d2), the character string ignoring the decimal point is converted into a BIN value and stored.
390
391 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps151.jpg]]
392
393 **Error code**
394
395 |**Error code**|**Content**
396 |4082H|(((
397 The character string specified by (s) could not be converted into a numeric value
398
399 For example:
400
401 The first character is not a negative sign or a space, space appears in the middle of the number, decimal point appears twice. Except for the first character that appears non-characters and decimal points, the number in the symbolic string with the decimal point is removed and the range between -32768 and 32767 is exceeded
402
403 Except for the first character, there are non-character and decimal Signs
404
405 For example, 3.4000 is 34000 after removing the decimal point, which is out of range.
406 )))
407 |4085H|(s) read address exceeds the device range
408 |408AH|When the character number of character string the specified in (s) is other than 2 to 8.
409 |408BH|The maximum range of the device is read when (s) taking character string, but 00H is not found as the end
410 |4086H|When using offset, the offset address of (d) exceeds the device range
411
412 **Example**
413
414 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps152.jpg]]
415
416 The result obtained above:
417
418 D0 corresponds to str length is 7.
419
420 D1 corresponds to a decimal point length of 3.
421
422 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps153.jpg]]
423
424 D10 corresponds to -12356 ignoring the decimal point.
425
426 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps154.jpg]]
427
428
429 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps155.png]]**7 DVAL/String → BIN32-bit Data Conversion** ===
430
431 **DVAL(P)**
432
433 After converting the character string stored in the device number specified in (s) into BIN 32-bit data, store the number of digits in (d1) and store the BIN data in (d2).
434
435 -[DVAL (s) (d1) (d2)]
436
437 **Content, range and data type**
438
439 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
440 |(s)|The character string converted to BIN data or the start device that stores the character string|-|String|ANYSTRING_SINGLE
441 |(d1)|The start device that stores the number of digits of converted BIN data|-|Signed BIN 16 bit|ANY16_S_ARRAY
442 |(d2)|Start device for storing converted BIN data|-|Signed BIN 32 bit|ANY32_S
443
444 **Device used**
445
446 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
447 **Index**
448
449 **modification**
450 )))|(((
451 **Pulse**
452
453 **extension**
454 )))
455 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
456 |(% rowspan="3" %)DVAL|Parameter 1| | | | | | | | | | | | | | |●|●|●|●|●| | | | | |●|●
457 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
458 |Parameter 3| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
459
460 **Features**
461
462 After converting the character string stored in the device number specified in (s) into BIN 32-bit data, store the number of digits in (d1) and store the BIN data in (d2). In the conversion from character string to BIN, the data from the device number specified in (s) to the device number storing 00H is treated as a character string.
463
464 The total number of digits stored in (d1) stores the number of all characters (including signs and decimal points) representing the value. The number of decimal places stored in (d1)+1 stores the number of characters representing the decimal part after 2EH(.). For the BIN 32-bit data stored in (d2), the character string ignoring the decimal point is converted into a BIN value and stored.
465
466 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps156.jpg]]
467
468 **Error code**
469
470 |**Error code**|**Content**
471 |4082H|(((
472 The character string specified by (s) could not be converted into a numeric value.
473
474 For example:The first character is not a negative sign or a space, space appears in the middle of the number, decimal point appears twice. Except for the first character that appears non-characters and decimal points, the number in the symbolic string with the decimal point is removed and the range between -2147483648 and 2147483647 is exceeded
475
476 Except for the first character, there are non-character and decimal Signs
477
478 For example, 3.000000000 is 3000000000 after removing the decimal point, which is out of range.
479 )))
480 |4085H|(s) read address exceeds the device range
481 |408AH|When the character number of character string the specified in (s) is other than 2 to 13.
482 |408BH|The maximum range of the device is read when (d1) and (d2) taking character string, but 00H is not found as the end
483 |4086H|When using offset, the offset address of (d) exceeds the device range
484
485 **Example**
486
487 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps157.jpg]]
488
489 The result obtained above
490
491 D0 corresponds to str length is 7.
492
493 D1 corresponds to a decimal point length of 3.
494
495 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps158.jpg]]
496
497 D10 corresponds to -12356 ignoring the decimal point
498
499 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps159.jpg]]
500
501
502 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps160.png]]**8 ASCI/HEX Code Data →ASCII Conversion** ===
503
504 **ASCI(P)**
505
506 After the n characters (bits) in the HEX code data specified in (s) are converted into ASCII codes, they are stored after the device number specified in (d).
507
508 -[ASCI (s) (d)  (n)]
509
510 **Content, range and data type**
511
512 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
513 |(s)|The start number of the device storing the HEX code to be converted|-|BIN16 bit|ANY16
514 |(d)|The start number of the device storing the converted ASCII code|-|String|ANYSTRING_SINGLE
515 |(n)|The number of characters (digits) of the HEX code to be converted|1to256|BIN16 bit|ANY16_U
516
517 **Device used**
518
519 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
520 **Index**
521
522 **modification**
523 )))|(((
524 **Pulse**
525
526 **extension**
527 )))
528 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
529 |(% rowspan="3" %)ASCI|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
530 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
531 |Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | |●|●| | |●
532
533 **Features**
534
535 The number of characters (bits) specified by (n) in the HEX code data specified in (s) is converted into ASCII code and stored in the device number specified in (d) or later.
536
537 ASCI(P) instruction uses 16-bit mode and 8-bit mode when converting. For the operation of each mode, please refer to the following content.
538
539 **(1) 16-bit conversion mode (when SM8161=OFF)**
540
541 Convert the digits of the HEX code after the device specified in (s) into ASCII, and transfer to the upper and lower 8 bits (bytes) of the device specified in (d). When using in 16-bit conversion mode, SM161 should always be turned OFF.
542
543 In the case of the following program, perform the conversion as shown below.
544
545 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps161.png]]
546
547 **Specify the number of bits (characters) and the conversion result**
548
549 |**(n)**|(% rowspan="2" %)**K1**|(% rowspan="2" %)**K2**|(% rowspan="2" %)**K3**|(% rowspan="2" %)**K4**|(% rowspan="2" %)**K5**|(% rowspan="2" %)**K6**|(% rowspan="2" %)**K7**|(% rowspan="2" %)**K8**|(% rowspan="2" %)**K9**
550 |**(d)**
551 |Under D200|C|B|C|0|4|3|2|1|8
552 |D200 on| |C|B|C|0|4|3|2|1
553 |Under D201| | |C|B|C|0|4|3|2
554 |D201 on| | | |C|B|C|0|4|3
555 |Under D202| | | | |C|B|C|0|4
556 |D202 on| |(% colspan="2" %)Unchanged| | |C|B|C|0
557 |Under D203| | | | | | |C|B|C
558 |D203 on| | | | | | | |C|B
559 |Under D204| | | | | | | | |C
560
561 **Bit structure in the case of (n)=K4¢**
562
563 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps162.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps163.jpg]]
564
565 **(2) 8-bit conversion mode (when SM161=ON)**
566
567 Convert the digits of the HEX code after the device specified in (s) into ASCII, and transfer to the lower 8 bits (bytes) of the device specified in (d). When using in 8-bit conversion mode, SM161 should always be set to ON for use.
568
569 In the case of the following program, perform the conversion as shown below.
570
571 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps164.png]]
572
573 If SM161 is set to ON, it will become 8-bit mode,
574
575 Perform conversion processing as shown below.
576
577 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps165.png]]
578
579 |**(n)**|(% rowspan="2" %)**K1**|(% rowspan="2" %)**K2**|(% rowspan="2" %)**K3**|(% rowspan="2" %)**K4**|(% rowspan="2" %)**K5**|(% rowspan="2" %)**K6**|(% rowspan="2" %)**K7**|(% rowspan="2" %)**K8**|(% rowspan="2" %)**K9**
580 |**(d)**
581 |D200|C|B|C|0|4|3|2|1|8
582 |D201| |C|B|C|0|4|3|2|1
583 |D202| | |C|B|C|0|4|3|2
584 |D203| | | |C|B|C|0|4|3
585 |D204| | | | |C|B|C|0|4
586 |D205| |(% colspan="2" %)Unchanged| | |C|B|C|0
587 |D206| | | | | | |C|B|C
588 |D207| | | | | | | |C|B
589 |D208| | | | | | | | |C
590
591 Bit structure in the case of (n)=K2¢
592
593 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps166.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps167.jpg]]
594
595 **Error code**
596
597 |**Error code**|**Content**
598 |4085H|When the specified device range is read to exceed the corresponding device range
599 |4086H|When the specified device range is written to exceed the corresponding device range
600 |4084H|When the value specified in (n) exceeds the range of 1 to 256
601
602
603
604 **Example**
605
606 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps168.jpg]]
607
608 • 16-bit conversion mode (when SM161=OFF)
609
610 Convert the digits of the HEX code after the device specified in d100 into ASCII, and transfer to the upper and lower 8 bits (bytes) of the device specified in d200. When using in 16-bit conversion mode, SM161 should always be turned OFF.
611
612
613 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps169.png]]**9 HEX/ASCII → HEX Code Data Conversion** ===
614
615 **HEX(P)**
616
617 After the device number specified in (s), the ASCII data stored in the number of characters specified in (n) is converted to HEX code, and then stored in the device number specified in (d) or later.
618
619 -[HEX  (s)  (d)  (n)]
620
621 **Content, range and data type**
622
623 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
624 |(s)|The start device that stores the ASCII data converted to HEX code|-|String|ANYSTRING_SINGLE
625 |(d)|The start device that stores converted HEX code|-|BIN16 bit|ANY16
626 |(n)|Number of characters (bytes) of converted ASCII data|1 to 256|BIN16 bit|ANY16_U
627
628 **Device used**
629
630 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
631 **Index**
632
633 **modification**
634 )))|(((
635 **Pulse**
636
637 **extension**
638 )))
639 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
640 |(% rowspan="3" %)HEX|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
641 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
642 |Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | |●|●| | |●
643
644 **Features**
645
646 • After the device number specified in (s), the ASCII data stored in the number of characters specified in (n) is converted to HEX code, and then stored in the device number specified in (d) or later. The HEX(P) instruction uses 16-bit conversion mode and 8-bit conversion mode when converting. For the operation of each mode, please refer to the following content.
647
648 **(1) 16-bit conversion mode (when SM161=OFF)**
649
650 After converting the ASCII data stored in the upper and lower 8 digits (bytes) of the device specified in (s) into HEX code, it transmits every 4 digits to the device specified in (d). The number of characters to be converted is specified in (n).
651
652 SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 16-bit conversion mode, please always set SM161 to OFF.
653
654 SM161 is cleared when RUN→STOP.
655
656 In addition, it is necessary to store the ASCII data in the 16-bit conversion mode in the upper 8 bits of the device specified in (s).
657
658 In the following program, the conversion will be performed in the following manner.
659
660 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps170.png]]
661
662 Transform the source data
663
664 |**(s)**|**ASCII data**|**HEX conversion**
665 |Under D200|30H|0
666 |D200 on|41H|A
667 |Under D201|42H|B
668 |D201 on|43H|C
669 |Under D202|31H|1
670 |D202 on|32H|2
671 |Under D203|33H|3
672 |D203 on|34H|4
673 |Under D204|35H|5
674
675 Bit structure in the case of (n)=K4
676
677 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps171.jpg]]
678
679 The number of characters specified and the conversion result becomes 0.
680
681 |(% colspan="2" %)**(n)**|1|2|3|4|5|6|7|8|9
682 |(% rowspan="3" %)**(d)**|**D102**|(% colspan="4" rowspan="2" %)Unchanged| | | | |...OH
683 |**D101**|...OH|..OAH|.OABH|OABCH|ABC1H
684 |**D100**|...OH|..OAH|.OABH|OABCH|ABC1H|BC12H|C123H|1234H|2345H
685
686 **(2) 8-bit conversion mode (when SM161=ON)**
687
688 After converting the ASCII data stored in the lower 8 digits of the device specified in (s) into HEX code, it will be transmitted to the device specified in (d) every 4 digits.
689
690 The number of characters to be converted is specified in (n).
691
692 SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 8-bit conversion mode, please always turn on SM161.
693
694 SM161 is cleared when RUN→STOP.
695
696 In the following program, the conversion will be performed in the following manner.
697
698 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps172.jpg]]
699
700 Transform the source data
701
702 |**(s)**|**ASCII data**|**HEX conversion**
703 |D200|30H|0
704 |D201|41H|A
705 |D202|42H|B
706 |D203|43H|C
707 |D204|31H|1
708 |D205|32H|2
709 |D206|33H|3
710 |D207|34H|4
711 |D208|35H|5
712
713 Bit structure in the case of (n)=K2
714
715 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps173.jpg]]
716
717 The number of characters specified and the conversion result becomes 0.
718
719 |(% colspan="2" %)**(n)**|1|2|3|4|5|6|7|8|9
720 |(% rowspan="3" %)**(d)**|**D102**|(% colspan="4" rowspan="2" %)Unchanged| | | | |...OH
721 |**D101**|...OH|..OAH|.OABH|OABCH|ABC1H
722 |**D100**|...OH|..OAH|.OABH|OABCH|ABC1H|BC12H|C123H|1234H|2345H
723
724 **Error code**
725
726 |**Error code**|**Content**
727 |(% rowspan="2" %)4084H|When the value specified in (n) exceeds the range.
728 |When ASCII codes other than 30H to 39H and 41H to 46H are set in (s).
729 |4085H|When the specified device range is read to exceed the corresponding device range
730 |4086H|When the specified device range is written to exceed the corresponding device range
731
732 **Example**
733
734 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps174.jpg]]
735
736 After converting the ASCII data stored in the upper and lower 8 digits (bytes) of the device specified in (s) into HEX code, it transmits every 4 digits to the device specified in (d). The number of characters to be converted is specified in (n).
737
738 SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 16-bit conversion mode, please always set SM161 to OFF.
739
740
741 === **6.8**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps175.png]]**.10 CCD/Check Code** ===
742
743 **CCD(P)**
744
745 Calculate the horizontal parity value and the sum check value of the error checking method used in communication and the like. In addition to these error checking methods, there are CRC (Cyclic
746
747 Redundancy Check). To calculate the CRC value, use the CRC(P) instruction.
748
749 -[CCD  (s)  (d)  (n)]
750
751 **Content, range and data type**
752
753 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
754 |(s)|The start number of object device|-|BIN16 bit|ANY16
755 |(d)|The start number of the storage destination device of the calculated data|-|BIN16 bit|ANY16_ARRAY (number of elements: 2)
756 |(n)|Number of data|1 to 256|BIN16 bit|ANY16_U
757
758 **Device used**
759
760 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
761 **Index**
762
763 **modification**
764 )))|(((
765 **Pulse**
766
767 **extension**
768 )))
769 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
770 |(% rowspan="3" %)CCD|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | | | | |●|●
771 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
772 |Parameter 3| | | | | | | | | | | | | | | | |●|●|●| | |●|●| | |●
773
774 **Features**
775
776 Calculate the addition data and horizontal parity data of the data stored in (s) to (s)+(n)-1, and store the addition data in (d), horizontal parity
777
778 The data is stored in (d)+1. The modes used by this instruction in calculation are 16-bit mode and 8-bit mode. For the operation of each mode, please refer to the following content.
779
780 **(1) 16-bit conversion mode (when SM161=OFF)**
781
782 Regarding the data at point (n) starting with (s), the addition data and horizontal parity data of the high and low 8-bit data are stored in the Devicess (d) and (d)+1.
783
784 SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 16 bits, always set to OFF for use.
785
786 SM161 is cleared when RUN→STOP.
787
788 In the case of the following program, perform the conversion as shown below.
789
790 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps176.png]] [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps177.jpg]]
791
792 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps178.jpg]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps179.png]]
793
794 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps180.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps181.jpg]]
795
796 **(2) 8-bit conversion mode (when SM161=ON)**
797
798 Regarding (s) as the starting point (n) data (lower 8 bits only), its addition data and horizontal parity data are stored in the devices (d) and (d)+1.
799
800 SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. If it is used in 8 bits, it should always be set to ON for use.
801
802 SM161 is cleared when RUN→STOP.
803
804 In the case of the following program, perform the conversion as shown below.
805
806 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps182.jpg]]
807
808 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps183.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps184.jpg]]
809
810 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps185.png]][[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps186.jpg]]
811
812 **Error code**
813
814 |**Error code**|**Content**
815 |4084H|When the value specified in (n) exceed the range of 1 to 256.
816 |4085H|When the specified device range is read to exceed the corresponding device range
817 |4086H|When the specified device range is written to exceed the corresponding device range
818
819 **Example**
820
821 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps187.jpg]]
822
823 Regarding D10 as the initial 10-point data, the addition data and horizontal parity data of the high and low 8-bit data are stored in the Devicess of D0 and D0+1.
824
825 SM161 is shared with ASC, ASCI, BCC, CCD and CRC instructions. When using in 16 bits, always set to OFF for use.
826
827
828 === **6.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps188.png]]**8.11 GBIN/Gray code → BIN 16-bit Data Conversion** ===
829
830 **GBIN(P)**
831
832 Convert the BIN 16-bit Gray code data stored in the device specified in (s) into BIN 16-bit data, and store it in the device specified in (d).
833
834 -[GBIN  (s)  (d)]
835
836 **Content, range and data type**
837
838 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
839 |(s)|Gray code data or the start device that stores Gray code|0 to 32767|BIN16 bit|ANY16_S
840 |(d)|The start device that stores the converted BIN data|-|BIN16 bit|ANY16_S
841
842 **Device used**
843
844 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
845 **Index**
846
847 **modification**
848 )))|(((
849 **Pulse**
850
851 **extension**
852 )))
853 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
854 |(% rowspan="2" %)GBIN|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
855 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
856
857 **Features**
858
859 Convert the BIN 16-bit Gray code data stored in the device specified in (s) into BIN 16-bit data, and store it in the device specified in (d).
860
861 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps189.jpg]]
862
863 GRY→BIN Mathematical Algorithm: Starting from the second bit from the left, XOR each bit with the decoded value of the left bit as the decoded value of the bit (the leftmost bit remains unchanged).
864
865 **Error code**
866
867 |**Error code**|**Content**
868 |4084H|When the value specified in (s) exceeds the range
869 |4085H|When the specified device range is read to exceed the range of the corresponding device
870 |4086H|When the specified device range is written to exceed the range of the corresponding device
871
872 **Example**
873
874 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps190.jpg]]
875
876 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps191.jpg]]
877
878 It could be used when the encoder of Gray code method is used to detect the absolute position.
879
880 For S, the numerical are valid in the range of 0 to 32767.
881
882
883 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps192.png]]**12 DGBIN/Gray Code → BIN32-bit Data Conversion** ===
884
885 **DGBIN(P)**
886
887 Convert the BIN32-bit Gray code data stored in the device specified in (s) to BIN 32-bit data and store it in the device specified in (d).
888
889 **Content, range and data type**
890
891 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
892 |(s)|Gray code data or the start device that stores Gray code|0 to 2147483647|BIN32 bit|ANY32_S
893 |(d)|The start device that stores converted BIN data|-|BIN32 bit|ANY32_S
894
895 **Device used**
896
897 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
898 **Index**
899
900 **modification**
901 )))|(((
902 **Pulse**
903
904 **extension**
905 )))
906 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
907 |(% rowspan="2" %)DGBIN|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
908 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
909
910 **Features**
911
912 Convert the BIN32-bit Gray code data stored in the device specified in (s) into BIN 32-bit data, and store it in the device specified in (d).
913
914 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps193.jpg]]
915
916 (s)+1: high 16 bits
917
918 (s): low 16 bits
919
920 GRY→BIN Mathematical Algorithm: Starting from the second bit from the left, XOR each bit with the decoded value of the left bit as the decoded value of the bit (the leftmost bit remains unchanged).
921
922 **Error code**
923
924 |**Error code**|**Content**
925 |4084H|When the value specified in (s) exceeds the range
926 |4085H|When the specified device range is read to exceed the corresponding device range
927 |4086H|When the specified device range is written to exceed the corresponding device range
928
929 **Example**
930
931 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps194.jpg]]
932
933 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps195.jpg]]
934
935
936 === **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps196.png]]**13 GRY/BIN 16-bit Data → Gray Code Conversion** ===
937
938 **GRY(P)**
939
940 After converting the BIN 16-bit data of the device specified in (s) to BIN 16-bit Gray code data, it is stored in the device specified in (d).
941
942 -[GRY  (s)  (d)]
943
944 **Content, range and data type**
945
946 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
947 |(s)|BIN data or the start device that stores BIN data|0 to 32767|BIN16 bit|ANY16_S
948 |(d)|The start device that stores the converted Gray code|-|BIN16 bit|ANY16_S
949
950 **Device used**
951
952 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
953 **Index**
954
955 **modification**
956 )))|(((
957 **Pulse**
958
959 **extension**
960 )))
961 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
962 |(% rowspan="2" %)GRY|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●| | |●|●| |●|●
963 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●| | | | | |●|●
964
965 **Features**
966
967 Convert the BIN 16-bit data specified in (s) into BIN 16-bit Gray code, and store it in the device specified in (d).
968
969 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps197.jpg]]
970
971 BIN→GRY Mathematical Algorithm: Starting from the rightmost bit, XOR each bit with the left bit as the value corresponding to the GRY bit, and the leftmost bit remains unchanged (equivalent to 0 on the left) .
972
973 **Error code**
974
975 |**Error code**|**Content**
976 |4084H|When the value specified in (s) exceeds the range
977 |4085H|When the specified device range is read to exceed the corresponding device range
978 |4086H|When the specified device range is written to exceed the corresponding device range
979
980 **Example**
981
982 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps198.jpg]]
983
984 As shown in the above ladder diagram:
985
986 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps199.jpg]]
987
988 For S, the range of 0 to 32767 is valid.
989
990
991 === **6.8.14 DGRY/BIN 32-bit Data → Gray Code Conversion** ===
992
993 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps200.png]]**DGRY(P)**
994
995 After converting the BIN 16-bit data of the device specified in (s) to BIN 16-bit Gray code data, it is stored in the device specified in (d).
996
997 -[GRY  (s)  (d)]
998
999 **Content, range and data type**
1000
1001 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
1002 |(s)|BIN data or the start device that stores BIN data|0 to 2147483647|BIN32 bit|ANY32_S
1003 |(d)|The start device that stores the converted Gray code|-|BIN32 bit|ANY32_S
1004
1005 **Device used**
1006
1007 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
1008 **Index**
1009
1010 **modification**
1011 )))|(((
1012 **Pulse**
1013
1014 **extension**
1015 )))
1016 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1017 |(% rowspan="2" %)DGRY|Parameter 1| | | | | | | | | | |●|●|●|●|●|●|●|●|●|●|●|●|●| |●|●
1018 |Parameter 2| | | | | | | | | | | |●|●|●|●|●|●|●|●|●|●| | | |●|●
1019
1020 **Features**
1021
1022 Convert the BIN32-bit data specified in (s) into BIN32-bit Gray code and store it in the device specified in (d)
1023
1024 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps201.jpg]]
1025
1026 (s)+1: high 16 bits
1027
1028 (s): low 16 bits
1029
1030 BIN→GRY Mathematical Algorithm: Starting from the rightmost bit, XOR each bit with the left bit as the value corresponding to the GRY bit, and the leftmost bit remains unchanged (equivalent to 0 on the left) .
1031
1032 **Error code**
1033
1034 |**Error code**|**Content**
1035 |4084H|When the value specified in (s) exceeds the range
1036 |4085H|When the specified device range is read to exceed the corresponding device range
1037 |4086H|When the specified device range is written to exceed the corresponding device range
1038
1039 **Example**
1040
1041 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps202.jpg]]
1042
1043 As shown in the above ladder diagram:
1044
1045 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps203.jpg]]
1046
1047
1048 === **6.8.15 PRUN/Octal digit transmission (16-bit data)** ===
1049
1050 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps204.png]]PRUN(P)
1051
1052 After processing the device numbers of (s) and (d) with specified digits as octal numbers, transfer the data.
1053
1054 -[PRUN (s) (d)]
1055
1056 **Content, range and data type**
1057
1058 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**|**Custom variable type**
1059 |(s)|Digit specification*1|-|BIN16 bit|ANY16|~-~-
1060 |(d)|Transfer target device number*1|-|BIN16 bit|ANY16|~-~-
1061
1062 **Device used**
1063
1064 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|**Index modification**|**Pulse expansion**
1065 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1066 |(% rowspan="2" %)PRUN|Parameter 1| | | | | | | | | | |●| |●| | | | | | | | | | | |●|●
1067 |Parameter 2| | | | | | | | | | | |●|●| | | | | | | | | | | |●|●
1068
1069 **Function**
1070
1071 • Octal digit device→ decimal digit device
1072
1073 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps205.jpg]]
1074
1075 • Decimal digit device → octal digit device
1076
1077 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps206.jpg]]
1078
1079 **Error code**
1080
1081 |**Error code**|**Content**
1082 |4085H|When the specified device range for reading exceeds the range of the corresponding device
1083 |4086H|When the specified device range for writing exceeds the range of the corresponding device
1084
1085 **Example**
1086
1087 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps207.jpg]]
1088
1089 As shown in the above ladder diagram: X0~~X17 takes the value of octal digits and pass it to the devices corresponding to M.
1090
1091 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps208.jpg]]
1092
1093 ===
1094 **6.8.**[[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps209.png]]**16 DPRUN/Otal Digit Transmission (32-bit data)** ===
1095
1096 **DPRUN(P)**
1097
1098 After processing the device numbers of (s) and (d) with specified digits as octal numbers, transfer the data.
1099
1100 -[PRUN  (s)  (d)]
1101
1102 **Content, range and data type**
1103
1104 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
1105 |(s)|Digit specification*1|-|BIN32 bit|ANY32
1106 |(d)|Transfer destination device number*1|-|BIN32 bit|ANY32
1107
1108 **Device used**
1109
1110 |(% rowspan="2" %)**instruction**|(% rowspan="2" %)**Parameter**|(% colspan="24" %)**Devices**|(((
1111 **Index**
1112
1113 **modification**
1114 )))|(((
1115 **Pulse**
1116
1117 **extension**
1118 )))
1119 |**X**|**Y**|**M**|**S**|**SM**|**T(bit)**|**C(bit)**|**LC(bit)**|**HSC(bit)**|**D.b**|**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**E**|**[D]**|**XXP**
1120 |(% rowspan="2" %)DPRUN|Parameter 1| | | | | | | | | | |●| |●| | | | | | | | | | | |●|●
1121 |Parameter 2| | | | | | | | | | | |●|●| | | | | | | | | | | |●|●
1122
1123 **Features**
1124
1125 • Octal digit device to decimal digit device
1126
1127 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps210.jpg]]
1128
1129 • Decimal digit device → octal digit device
1130
1131 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps211.jpg]]
1132
1133 **Error code**
1134
1135 |**Error code**|**Content**
1136 |4085H|When the specified device range is read to exceed the corresponding device range
1137 |4086H|When the specified device range is written to exceed the corresponding device range
1138
1139 **Example**
1140
1141 [[image:file:///C:\Users\Administrator\AppData\Local\Temp\ksohtml13456\wps212.jpg]]
1142
1143 As shown in the above ladder diagram:
1144
1145 X0 to X27 take the value of octal digits and pass them to the Devices corresponding to M.