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