Wiki source code of 12 String

Last modified by Stone Wu on 2023/08/24 14:37

Hide last authors
Leo Wei 1.1 1 == **LEN/string length detection** ==
2
3 **LEN(P)**
4
5 (% class="wikigeneratedid" %)
6 After detecting the length of the character string specified in (s), store it after the device number specified in (d).
7
8 The data from the device number designated in (s) to the device number of 00H is treated as a character string.
9
10 -[LEN (s) (d)]
11
12 **Content, range and data type**
13
14 (% class="table-bordered" %)
15 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
16 |(s)|String or start number of the device storing the string|-|String|ANYSTRING_SINGLE
17 |(d)|Store the device number of the detected character string length|-|Signed BIN 16 bit|ANY16
18
19 **Device used**
20
21 (% class="table-bordered" %)
22 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Devices**|(((
23 **Offset**
24
25 **modification**
26 )))|(((
27 **Pulse**
28
29 **extension**
30 )))
31 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
32 |(% rowspan="2" %)LEN|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
33 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
34
35 **Features**
36
37 After detecting the length of the character string specified in (s), store it after the device number specified in (d).
38
39 The data from the device number specified in (s) to the stored device number of 00H is treated as a character string.
40
41 (% style="text-align:center" %)
42 [[image:12_html_ed8cc486d8b12803.png||class="img-thumbnail"]]
43
44 **Error code**
45
46 (% class="table-bordered" %)
47 |**Error code**|**Content**
48 |4085H|(s) The read address exceeds the device range
49 |408AH|(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
50 |408BH|(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
51 |4086H|(d) When using offset, the offset address exceeds the device range
52
53 **Example**
54
55 (% style="text-align:center" %)
56 [[image:12_html_bcef3cb437d484ef.png||class="img-thumbnail"]]
57
58 For example, the above Circuit program
59
60 Use the asc instruction to write the string abcdef to the address starting from R0.
61
62 Then use the LEN instruction to determine the length. At this time, D0 will display 6.
63
64 == **{{id name="_Toc31109"/}}{{id name="_Toc32289"/}}{{id name="_Toc24287"/}}LEFT/Extract from the left side of the string** ==
65
66 **LEFT(P)**
67
68 For the character string data stored after the device number specified in (s), the data of (N) characters starting from the left side of the character string (the beginning of the character string) is stored in the device specified in (d) After numbering.
69
70 -[LEFT (s) (d) (N)]
71
72 **Content, range and data type**
73
74 (% class="table-bordered" %)
75 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
76 |(s)|String or start number of the device storing the string|-|String|ANYSTRING_SINGLE
77 |(d)|The start number of the device that stores the (N) character string from the left of (s)|-|String|ANYSTRING_SINGLE
78 |(N)|Number of characters extracted|1 to 400|Signed BIN 16 bit|ANY16
79
80 **Device used**
81
82 (% class="table-bordered" %)
83 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="11" %)**Devices**|(((
84 **Offset**
85
86 **modification**
87 )))|(((
88 **Pulse**
89
90 **extension**
91 )))
92 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
93 |(% rowspan="3" %)LEFT|Parameter 1|●|●|●|●|●|●|●|●|●| | |●|●
94 |Parameter 2| |●|●|●|●|●|●|●|●| | |●|●
95 |Parameter 3| |●|●|●|●|●|●|●|●|●|●|●|●
96
97 **Features**
98
99 For the character string data stored after the device number specified in (s), the data of (N) characters starting from the left side of the character string (the beginning of the character string) is stored in the device specified in (d) After numbering.
100
101 (% style="text-align:center" %)
102 [[image:12_html_dff27d9f4aac5f04.png||class="img-thumbnail"]]
103
104 The character string specified in (s) is the data from the specified device to the position where "00H" is first detected in byte units.
105
106 (N)=7:
107
108 (% style="text-align:center" %)
109 [[image:12_html_3ce6e66cbc96474a.png||class="img-thumbnail"]]
110
111 The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.
112
113 If the number of extracted characters is an odd number, "00H" is stored in the upper byte of the device storing the final character. If the number of extracted characters is an even number, "0000H" is stored in the device after the device storing the final character.
114
115 When the number of characters specified in (N) is 0, the NULL code (00H) is stored in (d).
116
117 ✎**Note:**
118
119 When handling character codes other than ASCII codes, pay attention to the following points.
120
121 ✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".
122
123 ✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.
124
125 **Error code**
126
127 (% class="table-bordered" %)
128 |**Error code**|**Content**
129 |4085H|(s) The read address exceeds the device range
130 |408AH|(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
131 |408BH|(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
132 |4084H|(N)<1 or (N)> string length
133 |4086H|(d) The write address exceeds the device range
134
135 **Example**
136
137 (% style="text-align:center" %)
138 [[image:12_html_962780efc149e8d7.png||class="img-thumbnail"]]
139
140 From the "a b c d e f" starting from D0, take out 5 characters from the left to the R0 type. The character string of R0 is "a b c d e".
141
142 (% style="text-align:center" %)
143 [[image:12_html_fdba3f85ad8d63a.png||class="img-thumbnail"]]
144
145 == **{{id name="_Toc17856"/}}{{id name="_Toc6548"/}}{{id name="_Toc31641"/}}RIGHT/Extract from the right side of the string** ==
146
147 **RIGHT(P)**
148
149 For the string data stored after the device number specified in (s), the data of (N) characters starting from the right side of the string (the end of the string) is stored in the device number specified in (d) after.
150
151 -[RIGHT (s) (d) (N)]
152
153 **Content, range and data type**
154
155 (% class="table-bordered" %)
156 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
157 |(s)|String or start number of the device storing the string|-|String|ANYSTRING_SINGLE
158 |(d)|The start number of the device that stores the (N) character string from the right of (s)|-|String|ANYSTRING_SINGLE
159 |(N)|Number of characters extracted|1 to 400|Signed BIN 16 bit|ANY16
160
161 **Device used**
162
163 (% class="table-bordered" %)
164 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="11" %)**Device**|(((
165 **Offset**
166
167 **modification**
168 )))|(((
169 **Pulse**
170
171 **expansion**
172 )))
173 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|(% style="width:62px" %)**K**|(% style="width:31px" %)**H**|**[D]**|**XXP**
174 |(% rowspan="3" %)RIGHT|Parameter 1|●|●|●|●|●|●|●|●|●|(% style="width:62px" %) |(% style="width:31px" %) | |
175 |Parameter 2| |●|●|●|●|●|●|●|●|(% style="width:62px" %) |(% style="width:31px" %) | |
176 |Parameter 3| |●|●|●|●|●|●|●|●|(% style="width:62px" %)●|(% style="width:31px" %)●| |
177
178 **Features**
179
180 For the string data stored after the device number specified in (s), the data of (N) characters starting from the right side of the string (the end of the string) is stored in the device number specified in (d) after.
181
182 (% style="text-align:center" %)
183 [[image:12_html_9d5972269e607737.png||class="img-thumbnail"]]
184
185 The character string specified in (s) is the data from the specified device to the position where "00H" is first detected in byte units.
186
187 (N)=5:
188
189 (% style="text-align:center" %)
190 [[image:12_html_f4911228f8c2dbe9.png||class="img-thumbnail"]]
191
192 The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.
193
194 If the number of extracted characters is an odd number, "00H" is stored in the upper byte of the device storing the final character. If the number of extracted characters is an even number, "0000H" is stored in the device after the device storing the final character.
195
196 When the number of characters specified in (N) is 0, the NULL code (00H) is stored in (d).
197
198 ✎**Note:**
199
200 When handling character codes other than ASCII codes, pay attention to the following points.
201
202 ✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".
203
204 ✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.
205
206 **Error code**
207
208 (% class="table-bordered" %)
209 |**Error code**|**Content**
210 |4085H|(s), (N) The read address exceeds the device range
211 |408AH|(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
212 |408BH|(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
213 |4084H|(N)<1 or (N)> string length
214 |4086H|(d) The write address exceeds the device range
215
216 **Example**
217
218 (% style="text-align:center" %)
219 [[image:12_html_ac9143331fbe5c33.png||class="img-thumbnail"]]
220
221 Get 3 characters “890” from the right in the string "1234567890" and store them in R0
222
223 (% style="text-align:center" %)
224 [[image:12_html_41ec2f74c80685b8.png||class="img-thumbnail"]]
225
226 == **{{id name="_Toc4373"/}}{{id name="_Toc1633"/}}{{id name="_Toc18152"/}}Any extraction from MIDR/string** ==
227
228 **MIDR(P)**
229
230 Store the data at any position in the character string data after the device number specified in (d).
231
232 -[MIDR (s1) (d) (s2)]
233
234 **Content, range and data type**
235
236 (% class="table-bordered" %)
237 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
238 |(s1)|String or start number of the device storing the string|-|String|ANYSTRING_SINGLE
239 |(d)|Start number of the device storing the character string data of the operation result|-|String|ANYSTRING_SINGLE
240 |(s2)|(((
241 The start number of the device that stores the start character position and the number of characters
242
243 (s2)+0: the position of the starting character, (s2)+1: the number of characters is signed
244 )))|-|Signed BIN 16 bit|ANY16_ARRAY
245
246 **Device used**
247
248 (% class="table-bordered" %)
249 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Devices**|(((
250 **Offset**
251
252 **modification**
253 )))|(((
254 **Pulse**
255
256 **extension**
257 )))
258 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
259 |(% rowspan="3" %)MIDR|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
260 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
261 |Parameter 3|●|●|●|●|●|●|●|●|●|●|●
262
263 **Features**
264
265 For the character string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 starting from the specified position in (s2) is stored to the device number specified in (d) and later .
266
267 (% style="text-align:center" %)
268 [[image:12_html_f20321bfd116b1a8.png||class="img-thumbnail"]]
269
270 1. : The position of the 5th character (S2).
271 1. : ASCII code (S2)+1 of the 5th character.
272
273 The character string specified in (s1) is the data from the specified device to the position where "00H" is first detected in byte units.
274
275 The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.
276
277 If the number of extracted characters "(s2)+1" is an odd number, "00H" is stored in the upper byte of the device storing the final character. If the number of extracted characters "(s2)+1" is an even number, "0000H" is stored in the device after the device storing the final character.
278
279 (s2) If the number of characters specified in +1 is 0, no processing is performed.
280
281 When the number of characters specified in (s2)+1 is -1, the data up to the final character data specified in (s1) is stored in the device specified in (d) and later.
282
283 (% style="text-align:center" %)
284 [[image:12_html_d1975a12aac01998.png||class="img-thumbnail"]]
285
286 (1): The position of the 5th character (S2).
287
288 **✎Note:**
289
290 When handling character codes other than ASCII codes, pay attention to the following points.
291
292 ✎The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".
293
294 ✎When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.
295
296 **Error code**
297
298 (% class="table-bordered" %)
299 |**Error code**|**Content**
300 |4085H|(s1), (s2) The read address exceeds the device range
301 |408AH|(s1) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
302 |408BH|(s1) When reading a character string, the maximum range of the device is read, but 00H is not found.
303 |4084H|(((
304 (s2) When the value of +1 is -2 (including -2) or less.
305
306 When the value of (s2) exceeds the number of characters in (s1).
307
308 When the value of (s2) is negative.
309
310 When the value of (s2)+1 exceeds the number of characters of (s1).
311
312 When the value of (s2) and (s2) + 1 after the addition operation exceeds the number of characters of (s1).
313 )))
314 |4086H|(d) The write address exceeds the device range
315
316 **Example**
317
318 (% style="text-align:center" %)
319 [[image:12_html_f08fb20d06bbf205.png||class="img-thumbnail"]]
320
321 Get three characters "234" from the second character of the string "123456" into R0.
322
323 (% style="text-align:center" %)
324 [[image:12_html_9c0e1c89a16023f8.png||class="img-thumbnail"]]
325
326 == **{{id name="_Toc26645"/}}{{id name="_Toc21166"/}}{{id name="_Toc28635"/}}$MOV/ string transfer** ==
327
328 **$MOV(P)**
329
330 Transfer the character string data specified in (s) to the device number specified in (d) and later.
331
332 -[$MOV (s) (d)]
333
334 **Content, range and data type**
335
336 (% class="table-bordered" %)
337 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
338 |(s)|Transmission string (maximum 255 characters) or the start number of the device storing the string|-|String|ANYSTRING_SINGLE
339 |(d)|The start number of the device storing the transferred character string|-|String|ANYSTRING_SINGLE
340
341 **Device used**
342
343 (% class="table-bordered" %)
344 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameter**|(% colspan="9" %)**Device**|(((
345 **Offset**
346
347 **modification**
348 )))|(((
349 **Pulse**
350
351 **expansion**
352 )))
353 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
354 |(% rowspan="2" %)$MOV|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
355 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
356
357 **Features**
358
359 Transfer the character string data specified in (s) to the device number specified in (d) and later. In the transmission of a character string, the character string enclosed by the "" (double quotation marks) specified in (s) or the character string starting from the device number to the device number storing 00H is transmitted once.
360
361 (% style="text-align:center" %)
362 [[image:12_html_a7032fc187916cbb.png||class="img-thumbnail"]]
363
364 Even if the device range (s) to (s)+n storing the transferred character string data overlaps with the device range (d) to (d)+n storing the transferred character string data, it will be normal To process. For example, when the character string stored in D10 to D13 is transferred to D11 to D14, the situation is as follows.
365
366 (% style="text-align:center" %)
367 [[image:12_html_1e6ba98418b9bddd.png||class="img-thumbnail"]]
368
369 (1): It directly becomes the character string before transmission.
370
371 When 00H is stored in the low byte of (s)+n, both the high byte and low byte of (d)+n will store 00H.
372
373 (% style="text-align:center" %)
374 [[image:12_html_16e7ec8cd76e305d.png||class="img-thumbnail"]]
375
376 (1): The upper byte cannot be transmitted.
377
378 (2): It directly becomes the character string before transmission.
379
380 (3): The upper byte automatically stores 00H.
381
382 **Error code**
383
384 (% class="table-bordered" %)
385 |**Error code**|**Content**
386 |4085H|(s) The read address exceeds the device range
387 |408AH|(s) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
388 |408BH|(s) When reading a character string, the maximum range of the device is read, but 00H is not found and the end
389 |4086H|(d) The write address exceeds the device range
390
391 **Example**
392
393 (% style="text-align:center" %)
394 [[image:12_html_e5c7ac173fafd437.png||class="img-thumbnail"]]
395
396 Copy the string "a b c d e" in D0 to R0.
397
398 (% style="text-align:center" %)
399 [[image:12_html_d4f5be5a8a3b4c6c.png||class="img-thumbnail"]]
400
401 == **{{id name="_Toc3878"/}}{{id name="_Toc20605"/}}{{id name="_Toc2252"/}}Arbitrary replacement in MIDW/string** ==
402
403 **MIDW(P)**
404
405 For the string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 is stored in the string data stored after the device number specified in (d) After the position specified in (s2).
406
407 -[MIDW (s1) (d) (s2)]
408
409 **Content, range and data type**
410
411 (% class="table-bordered" %)
412 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
413 |(s1)|String or start number of the device storing the string|-|String|ANYSTRING_SINGLE
414 |(d)|Start number of the device storing the character string data of the operation result|-|String|ANYSTRING_SINGLE
415 |(s2)|(((
416 The start number of the device that stores the start character position and the number of characters
417
418 (s2)+0: the position of the starting character, (s2)+1: the number of characters is signed
419 )))|-|Signed BIN 16 bit|ANY16_ARRAY
420
421 **Device used**
422
423 (% class="table-bordered" %)
424 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameters**|(% colspan="9" %)**Device**|(((
425 **Offset**
426
427 **modification**
428 )))|(((
429 **Pulse**
430
431 **extension**
432 )))
433 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
434 |(% rowspan="3" %)MIDW|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
435 |Parameter 2| |●|●|●|●|●|●|●|●|●|●
436 |Parameter 3|●|●|●|●|●|●|●|●|●|●|●
437
438 **Features**
439
440 For the string data stored after the device number specified in (s1), the data of the character specified in (s2)+1 is stored in the string data stored after the device number specified in (d) After the position specified in (s2).
441
442 (% style="text-align:center" %)
443 [[image:12_html_eaf06779c7008d8d.png||class="img-thumbnail"]]
444
445 * The character string specified in (s1) or (d) is the data from the specified device to the position where "00H" is first detected in byte units.
446 * The final NULL code (00H) representing the character string will be automatically appended to the end of the character string data.
447 * If the number of characters specified in (s2)+1 is 0, no processing is performed.
448 * If the number of characters specified in (s2)+1 exceeds the last character of the character string data specified in (d), the data up to the last character of (d) is stored.
449
450 (% style="text-align:center" %)
451 [[image:12_html_22b26f8331ae8bf1.png||class="img-thumbnail"]]
452
453 When the number of characters specified in (s2)+1 is -1, the data up to the final character data specified in (s1) is stored in the device specified in (d) and later.
454
455 (% style="text-align:center" %)
456 [[image:12_html_93e0c05274baf0f8.png||class="img-thumbnail"]]
457
458 **✎Note:**
459
460 * When handling character codes other than ASCII codes, pay attention to the following points.
461 * The number of characters is handled in byte units (8 bits). Therefore, like the shifted JIS code, the character code of 1 character is represented by 2 bytes, and the number of characters of 1 character is "2".
462 * When extracting a character string from a character string containing a character code representing one character in 2 bytes, such as the shift JIS code, the number of characters to be extracted should be considered in the unit of the character code of one character. If only 1 byte of the 2-byte character code is extracted, it will not be the expected character code, so be careful.
463
464 **Error code**
465
466 (% class="table-bordered" %)
467 |**Error code**|**Content**
468 |4085H|(s1) (s2) (d) The read address exceeds the device range
469 |408AH|(s1) (d) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
470 |408BH|(s1) (d) When reading a character string, the maximum range of the device is read, but 00H is not found.
471 |4084H|(((
472 (s2) When the value of +1 is -2 (including -2) or less.
473
474 When the value of (s2) exceeds the number of characters in (d).
475
476 When the value of (s2) is negative.
477
478 When the value of (s2)+1 exceeds the number of characters of (s1).
479 )))
480 |4086H|(d) The write address exceeds the device range
481
482 **Example**
483
484 (% style="text-align:center" %)
485 [[image:12_html_3ddcabdcaf657946.png||class="img-thumbnail"]]
486
487 Replace the three-character-length characters starting with the second character in the character string "q w e r y" stored in R0 with the first three characters in D20.
488
489 The result of R0 is "q123y".
490
491 (% style="text-align:center" %)
492 [[image:12_html_336d7baf1ba02b9e.png||class="img-thumbnail"]]
493
494 == **{{id name="_Toc17570"/}}{{id name="_Toc12944"/}}{{id name="_Toc7466"/}}STR/BIN 16-bit data → character string conversion** ==
495
496 **STR(P)**
497
498 The BIN 16-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later.
499
500 -[STR (s1) (s2) (d)]
501
502 **Content, range and data type**
503
504 (% class="table-bordered" %)
505 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
506 |(s1)|The start number of the device that stores the number of digits of the converted value|-|Signed BIN 16 bit|ANY16_S_ARRAY
507 |(s2)|Converted BIN data|-32768 to +32767|Signed BIN 16 bit|ANY16_S
508 |(d)|Start number of the device storing the converted character string|-|String|ANYSTRING_SINGLE
509
510 **Device used**
511
512 (% class="table-bordered" %)
513 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameters**|(% colspan="11" %)**Device**|(((
514 **Offset**
515
516 **modification**
517 )))|(((
518 **Pulse**
519
520 **extension**
521 )))
522 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
523 |(% rowspan="3" %)STR|Parameter 1|●|●|●|●|●|●|●|●|●| | |●|●
524 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●|●
525 |Parameter 3| | | | |●|●|●|●|●| | |●|●
526
527 **Features**
528
529 The BIN 16-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later.
530
531 (% style="text-align:center" %)
532 [[image:12_html_ab97c25bb7ec51e8.png||class="img-thumbnail"]]
533
534 All digits that can be specified in (s1) are 2 to 8 digits.
535
536 The number of decimal places that can be specified in (s1)+1 is 0 to 5 digits. However, the setting should satisfy the condition that the number of decimal places ≤ (all digits-3).
537
538 The converted character string data will be stored in the device numbers after (d) as follows.
539
540 • In the sign, BIN 16-bit data will store 20H (blank) when it is positive, and 2DH (—) when it is negative.
541
542 • When the number of decimal places is set to other than 0, 2EH(.) is automatically stored in the specified digit + 1 digit. When the decimal place is 0, 2EH(.) is not stored.
543
544 (% style="text-align:center" %)
545 [[image:12_html_ac029ec797f87912.png||class="img-thumbnail"]]
546
547 (1): Number of decimal places
548
549 (2): Automatically attach
550
551 If the value of the decimal place is greater than the number of digits of the BIN 16-bit data, 0 is automatically appended and converted to "0.~*~**" right-aligned.
552
553 (% style="text-align:center" %)
554 [[image:12_html_ab5fdaf7985c6b0f.png||class="img-thumbnail"]]
555
556 (1): Automatically attach
557
558 In the value of all digits, excluding the sign, and if the number of digits after the decimal point is greater than the number of BIN 16-bit data, 20H (blank) is stored between the sign and the value. If the digit of BIN 16-bit data is larger, it will be in error status.
559
560 (% style="text-align:center" %)
561 [[image:12_html_11ebc511ddf34975.png||class="img-thumbnail"]]
562
563 (1): Change to 20H (SP).
564
565 00H is automatically stored at the end of the converted character string.
566
567 • When the total digits are even digits, "0000H" is stored in the device after the device storing the final character. In the case of an odd number of digits, "00H" is stored in the upper byte (8 bits) of the device storing the final character.
568
569 **Error code**
570
571 (% class="table-bordered" %)
572 |**Error code**|**Content**
573 |4085H|(s1), (s2) The read address exceeds the device range
574 |4084H|(((
575 (s1) or (s1+1) parameter setting value is out of range. E.g:
576
577 ~1. The value of (s1) is not in the range of 2-8
578
579 2. The value of (s1+1) is not in the range of 0-5
580
581 3. The value of (s1+1) is greater than the value of (s1) minus 3
582
583 4. When (s1+1) is 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2)+1.
584
585 When (s1+1) is not 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2) + 2.
586
587 (The number of digits of (s1) <the number of BIN 16-bit data that does not contain a sign of (s2) + the number of signs (+ or -) + the number of decimal points (.))
588 )))
589 |4086H|(d) When using offset, the offset address exceeds the device range
590
591 **Example**
592
593 (% style="text-align:center" %)
594 [[image:12_html_247596356e588e50.png||class="img-thumbnail"]]
595
596 After M8 is turned ON, according to the setting of all digits, 6 decimal places and 0 digits, it is converted into a character string "12345" (with a space before 1)
597
598 .
599
600 (% style="text-align:center" %)
601 [[image:12_html_d9023eb3c8ddb67d.png||class="img-thumbnail"]]
602
603 == **{{id name="_Toc10344"/}}{{id name="_Toc22406"/}}{{id name="_Toc14678"/}}{{id name="OLE_LINK606"/}}DSTR/BIN 32-bit data → string conversion** ==
604
605 **DSTR(P)**
606
607 The BIN 32-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later.
608
609 -[DSTR (s1) (s2) (d)]
610
611 **Content, range and data type**
612
613 (% class="table-bordered" %)
614 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
615 |(s1)|The start number of the device that stores the number of digits of the converted value|-|Signed BIN 16 bit|ANY16_S_ARRAY
616 |(s2)|Converted BIN data|-2147483648 to 2147483647|Signed BIN 32 bit|ANY32_S
617 |(d)|Start number of the device storing the converted character string|-|String|ANYSTRING_SINGLE
618
619 **Device used**
620
621 (% class="table-bordered" %)
622 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameters**|(% colspan="13" %)**Device**|(((
623 **Offset**
624
625 **modification**
626 )))|(((
627 **Pulse**
628
629 **extension**
630 )))
631 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**LC**|**HSC**|**K**|**H**|**[D]**|**XXP**
632 |(% rowspan="3" %)DSTR|Parameter 1|●|●|●|●|●|●|●|●|●| | | | |●|●
633 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●|●|●|●|●
634 |Parameter 3| | | | |●|●|●|●|●| | | | |●|●
635
636 **Features**
637
638 The BIN 32-bit data specified in (s2) is converted into a character string after a decimal point is added to the position specified in (s1), and stored in the device number specified in (d) or later. -654.321 is specified in S2.
639
640 (% style="text-align:center" %)
641 [[image:12_html_3cca0f6ef2d0c3d9.png||class="img-thumbnail"]]
642
643 All digits that can be specified in (s1) are 2 to 13 digits.
644
645 The number of decimal places that can be specified in (s1)+1 is 0 to 10 digits. However, the setting should satisfy the condition that the number of decimal places ≤ (all digits-3).
646
647 The converted character string data will be stored in the device numbers after (d) as follows.
648
649 • In the sign, when the BIN 32-bit data is positive, 20H (blank) is stored, and when it is negative, 2DH (—) is stored.
650
651 • When the number of decimal places is set to other than 0, 2EH(.) is automatically stored in the specified digit + 1 digit. When the decimal place is 0, 2EH(.) is not stored.
652
653 (% style="text-align:center" %)
654 [[image:12_html_3f7d9df483d77cb7.png||class="img-thumbnail"]]
655
656 1. : Number of decimal places
657 1. : Automatically attach
658
659 • If the value of the decimal place is greater than the number of digits in the BIN 32-bit data, 0 is automatically added and converted to "0.~*~**" right-justified.
660
661 (% style="text-align:center" %)
662 [[image:12_html_cd46d5b63b1ebedd.png||class="img-thumbnail"]]
663
664 (1): Automatically attach
665
666 • If the sign is excluded from the value of all digits, and the number of digits after the decimal point is greater than the number of BIN 32-bit data, 20H (blank) is stored between the sign and the value. If the digit of BIN 16-bit data is larger, it will be in error status.
667
668 (% style="text-align:center" %)
669 [[image:12_html_a998daadb6fd7e64.png||class="img-thumbnail"]]
670
671 (1): Change to 20H (SP)
672
673 • 00H is automatically stored at the end of the converted character string.
674
675 • When the total digits are even digits, "0000H" is stored in the device after the device storing the final character. In the case of an odd number of digits, "00H" is stored in the upper byte (8 bits) of the device storing the final character.
676
677 **Error code**
678
679 (% class="table-bordered" %)
680 |**Error code**|**Content**
681 |4085H|(s1), (s2) The read address exceeds the device range
682 |4084H|(((
683 (s1) or (s1+1) parameter setting value is out of range. E.g:
684
685 ~1. The value of (s1) is not in the range of 2 to 13.
686
687 2. The value of (s1+1) is not in the range of 0 to 10.
688
689 3. The value of (s1+1) is greater than the value of (S1) minus 3.
690
691 4. When (s1+1) is 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2)+1.
692
693 When (s1+1) is not 0, the number of digits specified in (s1) is less than the number of BIN 16-bit data specified in (s2) + 2.
694
695 (The number of digits of (s1) <the number of BIN 16-bit data that does not contain a sign of (s2) + the number of signs (+ or -) + the number of decimal points (.))
696 )))
697 |4086H|(d) When using offset, the offset address exceeds the device range.
698
699 **xample**
700
701 (% style="text-align:center" %)
702 [[image:12_html_5b0a20751a964e17.png||class="img-thumbnail"]]
703
704 As shown in the example
705
706 We need to convert 123456 into a floating point string with 9 lengths after the decimal point and 3 lengths,
707
708 The result of the conversion should be 123.456. The previous value will have two spaces to supplement the insufficient number.
709
710 (% style="text-align:center" %)
711 [[image:12_html_430d3795add9e0b4.png||class="img-thumbnail"]]
712
713 == **{{id name="_Toc31869"/}}{{id name="_Toc27153"/}}{{id name="_Toc8064"/}}$+/ Combination of strings** ==
714
715 **$+(P)**
716
717 Connect the string data stored after the device number specified in (s2) to the string data stored after the device number specified in (s1), and store it after the device number specified in (d).
718
719 -[$+ (s1) (s2) (d)]
720
721 **Content, range and data type**
722
723 (% class="table-bordered" %)
724 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
725 |(s1)|Connection data or the start number of the device storing the data or a directly specified character string|-|String|ANYSTRING_SINGLE
726 |(s2)|The connected data or the start number of the device storing the connected data or the directly specified character string|-|String|ANYSTRING_SINGLE
727 |(d)|Start number of the device storing the connection result|-|String|ANYSTRING_SINGLE
728
729 **Device used**
730
731 (% class="table-bordered" %)
732 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameters**|(% colspan="9" %)**Device**|(((
733 **Offset**
734
735 **modification**
736 )))|(((
737 **Pulse**
738
739 **extension**
740 )))
741 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
742 |(% rowspan="3" %)$+|Parameter 1|●|●|●|●|●|●|●|●|●|●|●
743 |Parameter 2|●|●|●|●|●|●|●|●|●|●|●
744 |Parameter 3| |●|●|●|●|●|●|●|●|●|●
745
746 **Features**
747
748 Connect the string data stored after the device number specified in (s2) to the string data stored after the device number specified in (s1), and store it after the device number specified in (d).
749
750 The character strings of (s1) and (s2) start with the specified device number until the device number of 00H is stored.
751
752 (% style="text-align:center" %)
753 [[image:12_html_f7a3e0a5d0287093.png||class="img-thumbnail"]]
754
755 When merging character strings, 00H indicating the end of the character string specified in (s1) is ignored, and the character string specified in (s2) is connected at the final character of (s1).
756
757 If the character string is merged, 00H will be automatically appended at the end. If the number of characters after connection is an odd number, 00H is stored in the upper byte of the device that stores the final character, and if the number of characters after connection is an even number, the device after the device that stores the final character is stored 0000H will be stored.
758
759 **Error code**
760
761 (% class="table-bordered" %)
762 |**Error code**|**Content**
763 |4085H|(s1) or (s2) read address out of device range
764 |408AH|(s1) or (s2) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
765 |408BH|(s1) or (s2) When reading a character string, the maximum range of the device is read, but 00H is not found.
766 |4086H|(d) The write address exceeds the device range
767
768 **Example**
769
770 (% style="text-align:center" %)
771 [[image:12_html_ef811f595067af30.png||class="img-thumbnail"]]
772
773 The result of combining the string "12345" and the string "abcde" is "12345abcde"
774
775 (% style="text-align:center" %)
776 [[image:12_html_870490af1bec3c8c.png||class="img-thumbnail"]]
777
778 == **{{id name="_Toc5467"/}}{{id name="_Toc19876"/}}{{id name="_Toc10628"/}}INSTR/string search** ==
779
780 **INSTR(P)**
781
782 Starting from the left (s3) character of the string data stored after the device number specified in (s2), search for the string data stored after the device number specified in (s1), and store the search result in In the device specified in (d).
783
784 -[ INSTR (s1) (s2) (d) (s3)]
785
786 **Content, range and data type**
787
788 (% class="table-bordered" %)
789 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
790 |(s1)|Search string or the start number of the device storing the search string|-|String|ANYSTRING_SINGLE
791 |(s2)|The searched character string or the start number of the device storing the searched character string|-|String|ANYSTRING_SINGLE
792 |(d)|Start number of the device storing the search result|-|Signed BIN 16 bit|ANY16
793 |(s3)|Search start position|1 to 400|Signed BIN 16 bit|ANY16
794
795 **Device used**
796
797 (% class="table-bordered" %)
798 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameters**|(% colspan="11" %)**Device**|(((
799 **Offset**
800
801 **modification**
802 )))|(((
803 **Pulse**
804
805 **extension**
806 )))
807 |**KnX**|**KnY**|**KnM**|**KnS**|**T**|**C**|**D**|**R**|**SD**|**K**|**H**|**[D]**|**XXP**
808 |(% rowspan="4" %)INSTR|Parameter 1| | | | |●|●|●|●|●| | |●|●
809 |Parameter 2| | | | |●|●|●|●|●| | |●|●
810 |Parameter 3|●|●|●|●|●|●|●|●|●| | |●|●
811 |Parameter 4|●|●|●|●|●|●|●|●|●|●|●|●|●
812
813 **Features**
814
815 Starting from the left (s3) character of the string data stored after the device number specified in (s2), search for the string data stored after the device number specified in (s1), and store the search result in In the device specified in (d). The search result will store the first character from the start character of the string data specified in (s2).
816
817 (% style="text-align:center" %)
818 [[image:12_html_fb3930cfe47ce231.png||class="img-thumbnail"]]
819
820 (1): Search start position (S3): 3rd character
821
822 (2): The fifth character from the start character
823
824 * If there is no matching character string data, 0 is stored in (d).
825 * If the search start position (s3) is "0", no processing is performed.
826 * The searched character string (s1) can be directly specified.
827
828 (% style="text-align:center" %)
829 [[image:12_html_f423f049e854194f.png||class="img-thumbnail"]]
830
831 (1): Search start position (s3): 3rd character
832
833 (2): The fifth character from the start character
834
835 **Error code**
836
837 (% class="table-bordered" %)
838 |**Error code**|**Content**
839 |4085H|(s1), (s2), (s3) The read address exceeds the device range
840 |408AH|(s1), (s2) The length of the read string exceeds, and the continuous length of the string exceeds 400 characters
841 |408BH|(s1), (s2) When reading a character string, the maximum range of the device is read, but 00H is not found.
842 |4086H|(d) The write address exceeds the device range
843 |4084H|(s3) <0 or (s3)>=string length
844
845 **Example**
846
847 (% style="text-align:center" %)
848 [[image:12_html_bd3a37e71062cac5.png||class="img-thumbnail"]]
849
850 Search for the string "ef" in the continuous string "abcdefg" from the first to the fifth position.
851
852 == **{{id name="_Toc4643"/}}{{id name="_Toc20282"/}}{{id name="_Toc13150"/}}ASC/ASCII data input** ==
853
854 **ASC**
855
856 A command to convert a character string of half-width/English numbers into ASCII code.
857
858 Used to select and display multiple messages on the external display.
859
860 -[ASC (s) (d)]
861
862 **Content, range and data type**
863
864 (% class="table-bordered" %)
865 |**Parameter**|**Content**|**Range**|**Data type**|**Data type (label)**
866 |(s)|32-character half-width English numbers input from the computer|-|String (ASCI code only)|ANY_ASC
867 |(d)|Start word device number for storing ASCII data|-|BIN16 bit|ANY16_S
868
869 **Device used**
870
871 (% class="table-bordered" %)
872 |(% rowspan="2" %)**Instruction**|(% rowspan="2" %)**Parameters**|(% colspan="5" %)**Device**|(((
873 **Offset modification**
874 )))|(((
875 **Pulse extension**
876 )))
877 |**T**|**C**|**D**|**R**|**SD**|**[D]**|**XXP**
878 |(% rowspan="2" %)ASC|Parameter 1| | | | | | |
879 |Parameter 2|●|●|●|●|●|●|
880
881 **Features**
882
883 ~1. 16-bit arithmetic (ASC)
884
885 After converting the half-width, English, and numeric character strings specified in (S) into ASCII codes, they are transferred to (D) in sequence.
886
887 • Process A to Z, 0 to 9, and half-width characters of Signs in (S). (Full-width character strings are not processed.)When programming with a programming tool, enter a character string.
888
Stone Wu 4.5 889 • The converted ASCII code is stored in (D) every 2 characters/1 word in the order of low 8 bits and high 8 bits.
Leo Wei 1.1 890
891 **Extensions**
892
893 After SM161 is turned ON, the extended function becomes effective. At this time, the half-width/alphanumeric character string specified in S is converted into ASCII code, and then it is transmitted to the lower 8 bits (1 byte) of D in sequence.
894
895 ✎**Note:**
896
897 (1) Number of occupied points of the device
898
899 1) When the extended function is OFF
900
901 - D occupies the number of characters ÷ 2 points (if not evenly divisible, the decimal point is rounded up.)
902
903 2) When the extended function is ON
904
905 -The number of points occupied by D is the same as the number occupied by characters.
906
907 (2) When using etc.
908
909 The extended function flag SM161 is a flag bit common to other instructions.
910
911 When using the above instructions and ASC instructions, please note that the SM161 ON or OFF program is written before the ASC instruction so as not to affect it.
912
913 **Error code**
914
915 (% class="table-bordered" %)
916 |**Error code**|**Content**
917 |4085H|The output result of reading application instruction(s) exceeds the device range
918 |4086H|(D) The output result exceeds the device range in writing application instructions
919
920 **Example**
921
922 ~1. Procedure
923
924 (% style="text-align:center" %)
Stone Wu 4.5 925 [[image:12_html_e275c447761351e0.png||height="34" width="400" class="img-thumbnail"]]
Leo Wei 1.1 926
927 When X20 = ON, the assignment of D200 to D203:
928
929 (% style="text-align:center" %)
930 [[image:12_html_4d73a151fc88e54a.png||class="img-thumbnail"]]
931
932 If the special register SM161 is set to ON, each ASCII character occupies a 16-bit variable after conversion, as shown in the figure below, the high byte of each variable is filled with 0 (hexadecimal):
933
934 (% class="table-bordered" %)
935 |(% rowspan="2" %) |(% colspan="2" %)**D**•|**S**
936 |**High 8 bits**|**Low 8 bits**|**String**
937 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]]|00|41|A
938 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +1|00|42|B
939 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +2|00|43|C
940 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +3|00|44|D
941 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +4|00|45|E
942 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +5|00|46|F
943 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +6|00|47|G
944 |[[image:12_html_2ef48fa39ec10c22.png||class="img-thumbnail"]] +7|00|48|H