Wiki source code of 15 Floating calculation

Last modified by Wecon on 2025/09/03 21:03

Hide last authors
Wecon 1.1 1 = **6.15.1 DECMP instruction** =
2
3 **Instruction description**
4
5 (% class="table-bordered" %)
6 |=(% style="width: 88px;" %)**Name**|=(% style="width: 456px;" %)**Function**|=(% style="width: 117px;" %)**Bits(bits)**|=(% style="width: 149px;" %)**Pulse type**|=(% style="width: 208px;" %)**Instruction format**|=**Step**
7 |(% style="width:88px" %)DECMP|(% rowspan="2" style="width:456px" %)Compares two floating point values - results of <, = and > are given|(% style="width:117px" %)32|(% style="width:149px" %)No|(% rowspan="2" style="width:208px" %)DECM S,,1,, S,,2,, D|13
8 |(% style="width:88px" %)DECMPP|(% style="width:117px" %)32|(% style="width:149px" %)Yes|13
9
10 The data of S,,1,, is compared to the data of S,,2,,. The result is indicated by 3 bit devices specified with the head address entered as D. The bit devices indicate:
11
12 * S,,2,, is less than < S,,1,, - bit device D is ON
13 * S,,2,, is equal to = S,,1,, - bit device D +1 is ON
14 * S,,2,, is greater than > S,,1,, - bit device D+2 is ON
15
16 (% class="table-bordered" %)
17 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
18 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
19 |S,,1,,| | | | |√|√|√| | | | | | |√| |
20 |S,,2,,| | | | |√|√|√| | | | | | |√| |
21 |D| |√|√|√| | | | | | | | | | | |
22
23 **Program example**
24
25 (% style="text-align:center" %)
26 [[image:7-14 Floating calculation_html_59dd4b117c854f2c.jpg||class="img-thumbnail" height="130" width="400"]]
27
28 * When X10 is ON, one of M10~~M12 will be on.
29 * When X10 turns from ON to OFF, DECP is not executed. M10~~M12 keep the initial value. User could use RST or ZRST to reset M10~~M12.
30 * If S1 and S2 are not floating number, they will be converted into floating number automatically.
31
32 = **6.15.2 DEZCP instruction** =
33
34 **Instruction description**
35
36 (% class="table-bordered" %)
37 |=(% style="width: 102px;" %)**Name**|=(% style="width: 435px;" %)**Function**|=**Bits(bits)**|=**Pulse type**|=(% style="width: 212px;" %)**Instruction format**|=(% style="width: 75px;" %)**Step**
38 |(% style="width:102px" %)DEZCP|(% rowspan="2" style="width:435px" %)Compares a float range with a float value.|32|No|(% rowspan="2" style="width:212px" %)DECM S,,1,, S,,2,, S D|(% style="width:75px" %)9
39 |(% style="width:102px" %)DEZCPP|32|Yes|(% style="width:75px" %)17
40
41 The instruction compares the inter-zoning variables of binary floating-points, and then exports the result to the three (3) initiative variables
42
43 * S,,1,,: the inter-zoning minimum of the binary floating-point variables.
44 * S,,2,,: the inter-zoning maximum of the binary floating-point variables.
45 * S: the binary floating-point variable that is to be compared.
46 * D: the storage unit for comparison results, occupying three variable units.
47
48 (% class="table-bordered" %)
49 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
50 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
51 |S,,1,,| | | | |√|√|√| | | | | | |√| |
52 |S,,2,,| | | | |√|√|√| | | | | | |√| |
53 |S| | | | |√|√|√| | | | | | | | |
54 |D| |√|√|√| | | | | | | | | | | |
55
56 **Program example**
57
58 (% style="text-align:center" %)
59 [[image:7-14 Floating calculation_html_64d9e6cb502f6cbb.jpg||class="img-thumbnail" height="141" width="500"]]
60
61 = **6.15.3 DEBCD instruction** =
62
63 **Instruction description**
64
65 (% class="table-bordered" %)
66 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
67 |DEBCD|(% rowspan="2" %)Converts binary floating point to decimal floating point|32|No|(% rowspan="2" %)DBCD S D|9
68 |DEBCDP|32|Yes|9
69
70 It converts a floating point value at S into separate mantissa and exponent parts at D and D+1(decimal floating).
71
72 * S: The binary floating variable;
73 * D: The storage unit for converted decimal floating result;
74
75 (% class="table-bordered" %)
76 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
77 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
78 |S| | | | | | |√| | | | | | |√| |
79 |D| | | | | | | | | | | | | |√| |
80
81 **Program example**
82
83 (% style="text-align:center" %)
84 [[image:7-14 Floating calculation_html_db6409b02ed2ea12.jpg||class="img-thumbnail" height="69" width="400"]]
85
86 The binary floating value in (D3, D2) is converted to decimal floating value and the saved to (D11, D10).
87
88 There are 23 bits real number, 8 bits exponent, and 1 bit signal in binary floating (D3, D2), which will be converted to decimal floating (D11, D10), and it could be expressed with science formula of D2*10^^D3^^.
89
90 The floating data calculation is PLC is all in binary format, and it is converted to decimal for ease of monitoring.
91
92 = **6.15.4 DEBIN instruction** =
93
94 **Instruction description**
95
96 (% class="table-bordered" %)
97 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
98 |DEBIN|(% rowspan="2" %)Converts decimal floating point to binary floating point|32|No|(% rowspan="2" %)DBIN S D|9
99 |DEBINP|32|Yes|9
100
101 This instruction converts decimal floating to binary floating
102
103 * S: The decimal floating variable.
104 * D: The storage unit for converted binary floating result.
105
106 (% class="table-bordered" %)
107 |(% rowspan="2" %)**Operands**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
108 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
109 |S| | | | | | |√| | | | | | |√| |
110 |D| | | | | | | | | | | | | |√| |
111
112 **Program example**
113
114 (% style="text-align:center" %)
115 [[image:7-14 Floating calculation_html_9811e03fe36c1d7f.jpg||class="img-thumbnail" height="162" width="400"]]
116
117 The decimal floating 3.142, which is saved in D11, D10, is converted to binary floating and then saved in (D3, D2).
118
119 = **6.15.5 DEADD instruction** =
120
121 **Instruction description**
122
123 (% class="table-bordered" %)
124 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
125 |DEADD|(% rowspan="2" %)Adds two floating point numbers together|32|No|(% rowspan="2" %)DEADD S,,1,, S,,2,, D|13
126 |DEADDP|32|Yes|13
127
128 The floating point values stored in the source devices S,,1,, and S,,2,, are algebraically added and the result is stored in the destination device D.
129
130 (% class="table-bordered" %)
131 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
132 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
133 |S,,1,,| | | | |√|√|√| | | | | | |√| |
134 |S,,2,,| | | | |√|√|√| | | | | | |√| |
135 |D| | | | | | | | | | | | | |√| |
136
137 The instruction must use the double word format; i.e., DEADD or DEADDP. All source data and destination data will be double word.
138
139 K or H will be regarded as being in floating point format and the result stored in the destination will also be in floating point format.
140
141 If the result of the calculation is larger than the largest floating point number then the carry flag, M8021 is set ON and the result is set to the largest value.
142
143 If the result of the calculation is smaller than the smallest floating point number then the borrow flag, M8022 is set ON and the result is set to the smallest value.
144
145 **Program example**
146
147 (% style="text-align:center" %)
148 [[image:7-14 Floating calculation_html_6e0a9f3042cd967d.jpg||class="img-thumbnail" height="96" width="400"]]
149
150 For DEADD, when X10 is ON, the add operation will be executed in every scouldning cycle. For DEADDP, when X11 is ON, the add operation will be executed only once.
151
152 = **6.15.6 DESUB instruction** =
153
154 **Instruction description**
155
156 (% class="table-bordered" %)
157 |**Name**|**Function**|**Bits**|**Pulse type**|**Instruction format**|**Step**
158 |DESUB|(% rowspan="2" %)Subtracts one floating point number from another|32|No|(% rowspan="2" %)DESUB S,,1,, S,,2,, D|13
159 |DESUBP|32|Yes|13
160
161 The floating point value of S,,2,, is subtracted from the floating point value of S,,1,,and the result stored in destination device D.
162
163 (% class="table-bordered" %)
164 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
165 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
166 |S,,1,,| | | | |√|√|√| | | | | | |√| |
167 |S,,2,,| | | | |√|√|√| | | | | | |√| |
168 |D| | | | | | | | | | | | | |√| |
169
170 K or H will be regarded as being in floating point format and the result stored in the destination will also be in floating point format.
171
172 If the result of the calculation is 0, M8020 will set ON.
173
174 If the result of the calculation is larger than the largest floating point number then the carry flag, M8022 is set ON and the result is set to the largest value.
175
176 If the result of the calculation is smaller than the smallest floating point number then the borrow flag, M8021 is set ON and the result is set to the smallest value.
177
178 **Program example**
179
180 (% style="text-align:center" %)
181 [[image:7-14 Floating calculation_html_ceb10b83f7b7dc78.jpg||class="img-thumbnail" height="106" width="400"]]
182
183 When X10 = ON, after the binary floating-point (D3, D2) subtracts the other binary floating-point (D5, D4), the difference result will be stored in (D11, D10).
184
185 When X11 turns from OFF to ON, the value of the binary floating-point requires to subtract 123.The constant K123 is automatically converted to binary floating value before calculation.
186
187 The storing unit for the subtraction difference could be seemed as same one unit with the subtrahend and minuend. Please use the pulse execution instruction DESUBP under this circumstance. Otherwise, if selected the progressive execution instruction, the subtraction operation will be carried out again every time when the program is scouldned.
188
189 = **6.15.7 DEMUL instruction** =
190
191 **Instruction description**
192
193 (% class="table-bordered" %)
194 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
195 |DEMUL|(% rowspan="2" %)Multiplies two floating point numbers together|32|No|(% rowspan="2" %)DEMUL S,,1,, S,,2,, D|13
196 |DEMULP|32|Yes|13
197
198 The floating point value of S1 is multiplied with the floating point value of S2. The result of the multiplication is stored at D as a floating point value.
199
200 (% class="table-bordered" %)
201 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
202 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
203 |S,,1,,| | | | |√|√|√| | | | | | |√| |
204 |S,,2,,| | | | |√|√|√| | | | | | |√| |
205 |D| | | | | | | | | | | | | |√| |
206
207 K or H will be regarded as being in floating point format and the result stored in the destination will also be in floating point format.
208
209 If the result of the calculation is 0, M8020 will set ON.
210
211 If the result of the calculation is larger than the largest floating point number then the carry flag, M8022 is set ON and the result is set to the largest value.
212
213 If the result of the calculation is smaller than the smallest floating point number then the borrow flag, M8021 is set ON and the result is set to the smallest value.
214
215 **Program example**
216
217 (% style="text-align:center" %)
218 [[image:7-14 Floating calculation_html_672d0ac63015ab0d.jpg||class="img-thumbnail" height="104" width="400"]]
219
220 When X12 = ON, after the binary floating-point (D3, D2) multiplies the other binary floating-point (D5, D4), the product will be stored in (D11, D10).
221
222 When X13 turns from OFF to ON, the binary floating-point (D21, D20) value will be multiplied by 3 (three) and saved back in (D21, D20) the constant K3 has already been automatically converted to a binary floating-point value prior to the calculation.
223
224 The storing unit for the multiplication product could be treated as one unit with the multiplicouldd and the multiplier. Please use the pulse execution instruction DEMULP under this circumstance. Otherwise, if selected the progressive execution instruction, the multiplication operation will be carried out again every time when the program is scouldned.
225
226 = **6.15.8 DEDIV instruction** =
227
228 **Instruction description**
229
230 (% class="table-bordered" %)
231 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
232 |DEDIV|(% rowspan="2" %)Divides one floating point number by another|32|No|(% rowspan="2" %)DEDIV S,,1,, S,,2,, D|13
233 |DEDIVP|32|Yes|13
234
235 The floating point value of S,,1,, is divided by the floating point value of S,,2,,. The result of the division is stored in D as a floating point value. No remainder is calculated.
236
237 (% class="table-bordered" %)
238 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
239 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
240 |S,,1,,| | | | |√|√|√| | | | | | |√| |
241 |S,,2,,| | | | |√|√|√| | | | | | |√| |
242 |D| | | | | | | | | | | | | |√| |
243
244 K or H will be regarded as being in floating point format and the result stored in the destination will also be in floating point format.
245
246 If the result of the calculation is 0, M8020 will set ON.
247
248 If the result of the calculation is larger than the largest floating point number then the carry flag, M8022 is set ON and the result is set to the largest value.
249
250 If the result of the calculation is smaller than the smallest floating point number then the borrow flag, M8021 is set ON and the result is set to the smallest value.
251
252 **Program example**
253
254 (% style="text-align:center" %)
255 [[image:7-14 Floating calculation_html_2df6bb9f838f7890.jpg||class="img-thumbnail" height="106" width="400"]]
256
257 When X14=ON and the binary floating variable (D3, D2) are divided by the binary floating variable (D5, D4), the result will be saved in (D11, D10).
258
259 When X15 is set from OFF to ON, the binary floating (D11, D10) is divided by 10 and then the result is saved back to (D11, D10).The constant K10 is automatically converted to a binary floating value before calculation.
260
261 The storage unit for the result could be the storage unit for the dividend or divisor, in which the pulse-type DEDIVP instruction is recommended, or the continued implementation instruction will be applied, in which the calculation will be implemented every time when the program is scouldned.
262
263 = **6.15.9 DESQR instruction** =
264
265 **Instruction description**
266
267 (% class="table-bordered" %)
268 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
269 |DESQR|(% rowspan="2" %)Calculates the square root of a floating point value.|32|No|(% rowspan="2" %)DESQR S D|9
270 |DESQRP|32|Yes|9
271
272 A square root is performed on the floating point value of S, the result is stored in D.
273
274 (% class="table-bordered" %)
275 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
276 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
277 |S| | | | |√|√|√| | | | | | |√| |
278 |D| | | | | | | | | | | | | |√| |
279
280 * If S is K or H, it will be regarded as being in floating point format.
281 * If the result of the calculation is 0, M8020 will set ON.
282 * S must be greater than 0, if not, M8067 and M8068 will be set ON.
283
284 **Program example**
285
286 (% style="text-align:center" %)
287 [[image:7-14 Floating calculation_html_b7ea1c9bea221dfa.jpg||class="img-thumbnail" height="105" width="400"]]
288
289 * Solution 1: The binary floating radiation result is saved to (D11, D10)
290 * Solution 2: The binary floating number K6789 is implemented with radiation calculation and then the result is saved to (D21, D20), where the constant K6789 is automatically converted to binary floating data before implementation;
291
292 = **6.15.10 DINT instruction** =
293
294 **Instruction description**
295
296 (% class="table-bordered" %)
297 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
298 |INT|(% rowspan="4" %)Converts a number from floating point format to decimal format|16|No|(% rowspan="4" %)INT S D|5
299 |INTP|16|Yes|5
300 |DINT|32|No|9
301 |DINTP|32|Yes|9
302
303 The floating point value of S is rounded down to the nearest integer value and stored in normal binary format in D.
304
305 (% class="table-bordered" %)
306 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
307 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
308 |S| | | | | | |√| | | | | | |√| |
309 |D| | | | | | | | | | | | | |√| |
310
311 * If the result is 0, M8020 will be set ON.
312 * If the source data is not a whole number, it must be rounded down. In this case the borrow flag M8021 is set ON to indicate a rounded value.
313 * If the resulting integer value is outside the valid range (16-bit: -32768~~32767, 32-bit: -2147483648~~2147483647); for the destination device then an overflow occurs. In this case the carry flag M8022 is set on to indicate overflow.
314
315 **Program example**
316
317 (% style="text-align:center" %)
318 [[image:7-14 Floating calculation_html_d853c52fad455e69.jpg||class="img-thumbnail" height="132" width="400"]]
319
320 When M10 is triggered, (D51, D50) are rounded down to the nearest integer value and stored in normal binary format in D100.
321
322 When M11 is triggered, (D11, D10) are rounded down to the nearest integer value and stored in normal binary format in (D21, D20).
323
324 = **6.15.11 DSIN instruction** =
325
326 **Instruction description**
327
328 (% class="table-bordered" %)
329 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
330 |DSIN|(% rowspan="2" %)Calculates the sine of a floating point value|32|No|(% rowspan="2" %)DSIN S D|9
331 |DSINP|32|Yes|9
332
333 This instruction performs the mathematical SIN operation on the floating point.
334
335 * S: The angle variable that needs to be calculated in order to obtain SIN value. The unit is in RAD, and the value is expressed in binary floating points. ValueRange0<=α<=2π;
336 * D: The storage unit for the SIN calculation results after its conversion. It is in binary floating point format.
337
338 (% class="table-bordered" %)
339 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
340 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
341 |S| | | | | | | | | | | | | |√| |
342 |D| | | | | | | | | | | | | |√| |
343
344 **Program example**
345
346 Example 1:
347
348 (% style="text-align:center" %)
349 [[image:7-14 Floating calculation_html_963ccbe774e748a4.jpg||class="img-thumbnail" height="92" width="400"]]
350
351 The unit of S is rad, the range is from 0 to 2π.
352
353 RAD=DEGREE*π/180°
354
355 Example 2:
356
357 (% style="text-align:center" %)
358 [[image:7-14 Floating calculation_html_d455c2ae27aa129.jpg||class="img-thumbnail" height="188" width="700"]]
359
360 = **6.15.12 DCOS instruction** =
361
362 **Instruction description**
363
364 (% class="table-bordered" %)
365 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
366 |DCOS|(% rowspan="2" %)DCOS Calculates the cosine of a floating point value|32|No|(% rowspan="2" %)DCOS S D|9
367 |DCOSP|32|Yes|9
368
369 This instruction performs the mathematical cos operation on the floating point value in S. The result is stored in D.
370
371 (% class="table-bordered" %)
372 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
373 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
374 |S| | | | | | | | | | | | | |√| |
375 |D| | | | | | | | | | | | | |√| |
376
377 **Program example**
378
379 (% style="text-align:center" %)
380 [[image:7-14 Floating calculation_html_295ef53bc0089ac6.jpg||class="img-thumbnail" height="75" width="400"]]
381
382 When M10 is triggered, radian (D21, D20) are implement with COS calculation and saved to (D31, D30).
383
384 The calculated source data and COS results are in binary floating format.
385
386 RAD (radian) value= angle×π/180°,for example, the radian correspondingtoangle360°=360°×π/180°=2π.
387
388 For the program instruction for the COS calculation of an angle, please refer to examples in the SIN instruction.
389
390 = **6.15.13 DTAN instruction** =
391
392 **Instruction description**
393
394 (% class="table-bordered" %)
395 |**Name**|**Function**|**Bits(bits)**|**Pulse type**|**Instruction format**|**Step**
396 |DTAN|(% rowspan="2" %)Calculates the tangent of a floating point value|32|No|(% rowspan="2" %)DTAN S D|9
397 |DTANP|32|Yes|9
398
399 This instruction performs the mathematical TAN operation on the floating point value in S. The result is stored in D.
400
401 (% class="table-bordered" %)
402 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
403 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
404 |S| | | | | | | | | | | | | |√| |
405 |D| | | | | | | | | | | | | |√| |
406
407 **Program example**
408
409 (% style="text-align:center" %)
410 [[image:7-14 Floating calculation_html_c0af762b1c289e7a.jpg||class="img-thumbnail" height="83" width="400"]]
411
412 When X2 is triggered, it calculations the TAN value of radian (D21, D20) and saved it to (D31, D30).
413
414 The calculated source data and SIN results are all in binary floating point value format.
415
416 RAD(radian)value=angle × π/180°,for example, the radian corresponding to angle 360° = 360°× π/180° = 2π.
417
418 In regards to the programming statements used to calculate the TAN value, please refer to the example in the SIN instruction section.
419
420 = **6.15.14 DASIN instruction** =
421
422 **Instruction description**
423
424 (% class="table-bordered" %)
425 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
426 |DASIN|(% rowspan="2" %)Calculate the corresponding radian value based on the SIN value|32|No|(% rowspan="2" %)DASIN S D|9
427 |DASINP|32|Yes|9
428
429 This instruction performs the mathematical ARCSIN operation on the floating point.
430
431 * S: The value of SIN, it is in binary floating-point format, the range is-1.0<=α<= 1.0;
432 * D: It used for store result, the range is -0.5π~~+0.5π
433
434 (% class="table-bordered" %)
435 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
436 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
437 |S| | | | | | | | | | | | | |√| |
438 |D| | | | | | | | | | | | | |√| |
439
440 **Program example**
441
442 Example 1:
443
444 (% style="text-align:center" %)
445 [[image:7-14 Floating calculation_html_94f1cc58dbe83556.jpg||class="img-thumbnail" height="123" width="400"]]
446
447 When M0= 0, SIN ^^-1^^ operation (D1, D0) carried out, and result is saved in (D3, D2).
448
449 SIN ^^-1^^ (D1, D0) -> (D3, D2)
450
451 The source data and results are binary floating-point format.
452
453 Angle in radians=angle in degree*π/180°
454
455 Example 2:
456
457 (% style="text-align:center" %)
458 [[image:7-14 Floating calculation_html_9f567ad283ddcac6.jpg||class="img-thumbnail" height="147" width="400"]]
459
460 If (D1, D0) is 0.707106781, when M10 turns from OFF to ON, (D3, D2) will be 0.78539815, (D5,D4) will be 45, (D7,D6) will be 45.
461
462 = **6.15.15 DACOS instruction** =
463
464 **Instruction description**
465
466 (% class="table-bordered" %)
467 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
468 |DACOS|(% rowspan="2" %)Calculate the corresponding radian value based on the COS value|32|No|(% rowspan="2" %)DACOS S D|9
469 |DACOSP|32|Yes|9
470
471 Calculate radian value, according to the corresponding value of COS.
472
473 * S: The value of COS, it is in binary floating-point format, the range is-1.0<=α<= 1.0;
474 * D: It used for store result, the range is 0~~π
475
476 (% class="table-bordered" %)
477 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
478 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
479 |S| | | | | | | | | | | | | |√| |
480 |D| | | | | | | | | | | | | |√| |
481
482 **Program example**
483
484 Example 1:
485
486 (% style="text-align:center" %)
487 [[image:7-14 Floating calculation_html_2497e02e1e0db818.jpg||class="img-thumbnail" height="114" width="400"]]
488
489 When M0=0, COS-1 operation (D1, D0) carried out, and result is saved in (D3, D2).
490
491 COS^^-1^^(D1, D0)->(D3, D2).
492
493 The source data and results are binary floating-point format.
494
495 Angle in radians=angle in degree*π/180°
496
497 Example 2:
498
499 (% style="text-align:center" %)
500 [[image:7-14 Floating calculation_html_32eefe65f5859cfb.jpg||class="img-thumbnail" height="164" width="400"]]
501
502 If (D1, D0) is 0.866025404, when M10 turns from OFF to ON, (D3, D2) will be 0.52359877, (D5, D4) will be 30, (D7, D6) will be 30.
503
504 = **6.15.16 DATAN instruction** =
505
506 **Instruction description**
507
508 (% class="table-bordered" %)
509 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
510 |DATAN|(% rowspan="2" %)Calculate the corresponding radian value based on the TAN value|32|No|(% rowspan="2" %)DATAN S D|9
511 |DATANP|32|Yes|9
512
513 Calculate radian value, according to the corresponding value of TAN.
514
515 * S: The value of TAN, it is in binary floating-point format;
516 * D: It used for store result, the range is –π/2~~+π/2
517
518 (% class="table-bordered" %)
519 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
520 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
521 |S| | | | | | | | | | | | | |√| |
522 |D| | | | | | | | | | | | | |√| |
523
524 **Program example**
525
526 Example 1:
527
528 (% style="text-align:center" %)
529 [[image:7-14 Floating calculation_html_a6de4d2d38b3be81.jpg||class="img-thumbnail" height="97" width="400"]]
530
531 When M0= 0, TAN -1 operation (D1, D0) carried out, and result is saved in (D3, D2).
532
533 TAN -1 (D1、D0) -> (D3、D2)
534
535 The source data and results are binary floating-point format.
536
537 Angle in radians=angle in degree*π/180°
538
539 Example 2:
540
541 (% style="text-align:center" %)
542 [[image:7-14 Floating calculation_html_6871c67fd5729c91.jpg||class="img-thumbnail" height="155" width="400"]]
543
544 If (D1, D0) is 1.732050808, when M10 turns from OFF to ON, (D3, D2) will be 1.04719753, (D5, D4) will be 60, (D7, D6) will be 60.
545
546 = **6.15.17 DSINH instruction** =
547
548 **Instruction description**
549
550 (% class="table-bordered" %)
551 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
552 |DSINH|(% rowspan="2" %)The operation of Hyperbolic Sine function SINH (Binary floating)|32|No|(% rowspan="2" %)DSINH S D|9
553 |DSINHP|32|Yes|9
554
555 This instruction performs the mathematical SINH operation on the floating point value. D= (e^^s^^-e^^-s^^)/2
556
557 * S: The binary floating-point for SINH;
558 * D: It used to save result;
559
560 (% class="table-bordered" %)
561 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
562 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
563 |S| | | | | | | | | | | | | |√| |
564 |D| | | | | | | | | | | | | |√| |
565
566 **Program example**
567
568 (% style="text-align:center" %)
569 [[image:7-14 Floating calculation_html_8a7af241e1911830.jpg||class="img-thumbnail" height="112" width="400"]]
570
571 When M10 turn ON, calculate value (D1, D0) of SINH, and saved the result in (D3, D2). DSINH (D1, D0) → (D3, D2)
572
573 = **6.15.18 DCOSH instruction** =
574
575 **Instruction description**
576
577 (% class="table-bordered" %)
578 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
579 |DCOSH|(% rowspan="2" %)Binary floating point hyperbolic sine function COSH operation|32|No|(% rowspan="2" %)DCOSH S D|9
580 |DCOSHP|32|Yes|9
581
582 This instruction performs the mathematical COSH operation on the floating point. D= (e^^s^^+e^^-s^^)/2
583
584 * S: The binary floating-point for COSH;
585 * D: The used to store result;
586
587 (% class="table-bordered" %)
588 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
589 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
590 |S| | | | | | | | | | | | | |√| |
591 |D| | | | | | | | | | | | | |√| |
592
593 **Program example**
594
595 (% style="text-align:center" %)
596 [[image:7-14 Floating calculation_html_25ea140aba809656.jpg||class="img-thumbnail" height="124" width="400"]]
597
598 When M10 turn ON, calculate value (D1, D0) of COSH, and saved the result in (D3, D2).
599
600 DCOSH (D1, D0) → (D3, D2)
601
602 = **6.15.19 DTANH instruction** =
603
604 **Instruction description**
605
606 (% class="table-bordered" %)
607 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
608 |DTANH|(% rowspan="2" %)The operation of Hyperbolic Tangent function TANH|32|No|(% rowspan="2" %)DTANH S D|9
609 |DTANHP|32|Yes|9
610
611 This instruction performs the mathematical TANH operation on the floating point. D= (e^^s^^-e^^-s^^)/ (e^^s^^+e^^-s^^)
612
613 * S: The binary floating-point for TANH;
614 * D: It used to save result;
615
616 (% class="table-bordered" %)
617 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
618 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
619 |S| | | | | | | | | | | | | |√| |
620 |D| | | | | | | | | | | | | |√| |
621
622 **Program example**
623
624 (% style="text-align:center" %)
625 [[image:7-14 Floating calculation_html_8db16e8375c14eab.jpg||class="img-thumbnail" height="118" width="400"]]
626
627 When M10 is triggered, calculate value (D1, D0) of TANH, and saved the result in (D3, D2). DTANH (D1, D0) → (D3, D2)
628
629 = **6.15.20 DDEG Instruction** =
630
631 **Instruction description**
632
633 (% class="table-bordered" %)
634 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
635 |DDEG|(% rowspan="2" %)The operation of converting radian to angle (Binary floating-point)|32|No|(% rowspan="2" %)DDEG S D|9
636 |DDEGP|32|Yes|9
637
638 This instruction is used for converting radian to angle (Binary floating-point). The formula is RAD value= Angle*π/180°
639
640 * S: The radian;
641 * D: It used to save result;
642
643 (% class="table-bordered" %)
644 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
645 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
646 |S| | | | | | | | | | | | | |√| |
647 |D| | | | | | | | | | | | | |√| |
648
649 **Program example**
650
651 Example 1
652
653 (% style="text-align:center" %)
654 [[image:7-14 Floating calculation_html_4e15943e8299afef.jpg||class="img-thumbnail" height="124" width="400"]]
655
656 When M10 turn ON, convert radian (D1, D0) to angle, and saved the result in (D3, D2). DDEG (D1, D0) → (D3, D2)
657
658 RAD (radian) value= angle×π/180°, for example, the radiancorrespondingtoangle360°=360°×π/180°= 2π.
659
660 Example 2
661
662 (% style="text-align:center" %)
663 [[image:7-14 Floating calculation_html_ea1287ee46570a37.jpg||class="img-thumbnail" height="116" width="400"]]
664
665 If the value of (D1, D0) is 3.1415926, when M10 turn ON, the value of (D3, D2) is 180; the value of (D5, D4) is 180.
666
667 = **6.15.21 DRAD instruction** =
668
669 **Instruction description**
670
671 (% class="table-bordered" %)
672 |**Name**|**Function**|**Bits (bits)**|**Pulse type**|**Instruction format**|**Step**
673 |DRAD|(% rowspan="2" %)The operation of Hyperbolic Tangent function TANH|32|No|(% rowspan="2" %)DTANH S D|9
674 |DRADP|32|Yes|9
675
676 This instruction is used for converting angle to radian (Binary floating-point). The formula is RAD value= Angle*π/180°
677
678 * S: The angle;
679 * D: It used to save result.
680
681 (% class="table-bordered" %)
682 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
683 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
684 |S| | | | | | | | | | | | | |√| |
685 |D| | | | | | | | | | | | | |√| |
686
687 **Program example**
688
689 Example 1:
690
691 (% style="text-align:center" %)
692 [[image:7-14 Floating calculation_html_f2d1c89f0d4e3df8.jpg||class="img-thumbnail" height="119" width="400"]]
693
694 When M10 turn ON, convert angle (D1, D0) to radian, and saved the result in (D3, D2). DRAD (D1, D0) → (D3, D2)
695
696 RAD (radian) value= angle×π/180°,for example, the radian corresponding to angle 360°= 360°× π/ 180°= 2π.
697
698 Example 2:
699
700 (% style="text-align:center" %)
701 [[image:7-14 Floating calculation_html_8335cdb30d5097cb.jpg||class="img-thumbnail" height="118" width="300"]]
702
703 When M10 is ON, (D5, D4) is π/2, i.e. 1.570796
704
705 = **6.15.22 DEXP instruction** =
706
707 **Instruction description**
708
709 (% class="table-bordered" %)
710 |**Name**|**Function**|**Bits**|**Pulse type**|**Instruction format**|**Step**
711 |DEXP|(% rowspan="2" %)Exponential operation of binary floating number with e as the base number|32|No|(% rowspan="2" %)DEXP S D|5
712 |DEXPP|32|Yes|9
713
714 This instruction performs the exponential operation on S with e(2.71828) as the base number and store the result in D.
715
716 When D is not within 2^^-126^^ ~~2^^128 ^^, an error will occur. The error code is K6707 that is stored in D8067, and M8067 will set ON.
717
718 (% class="table-bordered" %)
719 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
720 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
721 |S| | | | | | | | | | | | | |√| |
722 |D| | | | | | | | | | | | | |√| |
723
724 **Program example**
725
726 (% style="text-align:center" %)
727 [[image:7-14 Floating calculation_html_7cf0ad6018381a72.jpg||class="img-thumbnail" height="93" width="300"]]
728
729 When X0 is triggered, E (D1, D0) →(D3,D2). Because loge2128=88.7, so when (D1, D0) is greater than 88.7, D8067 is k6706, M8067 will set ON.
730
731 = **6.15.23 DLOG10 instruction** =
732
733 **Instruction description**
734
735 (% class="table-bordered" %)
736 |**Name**|**Function**|**Bits**|**Pulse type**|**Instruction format**|**Step**
737 |DLOG10|(% rowspan="2" %)Logarithmic operations of binary floating numbers with 10 as the base number|32|No|(% rowspan="2" %)DLOG10 S D|9
738 |DLOG10P|32|Yes|9
739
740 This instruction performs common logarithm operation of binary floating-point number to base 10.
741
742 * S: the binary floating-point variables of common logarithm in exponent binary floating-point number.
743 * D: the storage unit for saving the operation result of common logarithm
744 * Note: the value in could only be positive number. Operational error will occur when the value in is 0 or negative number. Error code K6706 is saved in D8067 and error flag M8067 turns ON.
745
746 (% class="table-bordered" %)
747 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
748 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
749 |S| | | | | | | | | | | | | |√| |
750 |D| | | | | | | | | | | | | |√| |
751
752 **Program example**
753
754 (% style="text-align:center" %)
755 [[image:7-14 Floating calculation_html_b470f3fc3392644c.jpg||class="img-thumbnail" height="113" width="400"]]
756
757 When M10 turns ON, the common logarithm operation of binary floating-point number in (D1, D0) to base 10 is performed, and save the result in (D3, D2)
758
759 Log,,10,, (D1, D0) →(D3, D2).
760
761 = **6.15.24 DLOGE instruction** =
762
763 **Instruction description**
764
765 (% class="table-bordered" %)
766 |**Name**|**Function**|**Bits**|**Pulse type**|**Instruction format**|**Step**
767 |DLOGE|(% rowspan="2" %)The natural logarithmic operation of binary floating number with e (2.71828) as the base number|32|No|(% rowspan="2" %)DLOGE S D|9
768 |DLOGEP|32|Yes|9
769
770 This instruction performs common logarithm operation of binary floating-point number to base 10.
771
772 * S: the binary floating-point variables of common logarithm in exponentiated binary floating-point number.
773 * D: the storage unit for saving the operation result of common logarithm
774 * Note: the value in S could only be positive number. Operational error will occur when the value in S is 0 or negative number. Error code K6706 is saved in D8067 and error flag M8067 turns ON.
775
776 (% class="table-bordered" %)
777 |(% rowspan="2" %)**Operand**|(% colspan="4" %)**Bit device**|(% colspan="12" %)**Word device**
778 |X|Y|M|S|K|H|E|KnX|KnY|KnM|KnS|T|C|D|V|Z
779 |S| | | | | | | | | | | | | |√| |
780 |D| | | | | | | | | | | | | |√| |
781
782 **Program example**
783
784 (% style="text-align:center" %)
785 [[image:7-14 Floating calculation_html_6010c4df672fabfe.jpg||class="img-thumbnail" height="117" width="400"]]
786
787 **~ **
788
789 When X0 is triggered, Loge^^(D1,D0)^^ →(D3,D2).
790
791 The conversation between natural logarithmic operation and common logarithmic operation is as below:
792
793 (% style="text-align:center" %)
794 [[image:7-14 Floating calculation_html_c324d50ac54002e0.jpg||class="img-thumbnail" height="52" width="200"]]
795