![background image](http://html1.mh-extra.com/html/omron/sysmac-cs1d-cpu/sysmac-cs1d-cpu_reference-manual_742268634.webp)
595
Floating-point Math Instructions
Section 3-15
1.
This section of the program converts the data from BCD to floating-point.
a) The data area from D00200 onwards is used as a work area.
b) First BIN(023) is used to temporarily convert the BCD data to binary
data, and then FLT(452) is used to convert the binary data to floating-
point data.
c)
The value of x that has been converted to floating-point data is output
to D00203 and D00202.
d) The value of y that has been converted to floating-point data is output
to D00205 and D00204.
2.
In order to find the distance r, Floating-point Math Instructions are used to
calculate the square root of x
2
+y
2
. The result is then output to D00213 and
D00212 as floating-point data.
3.
In order to find the angle
θ
, Floating-point Math Instructions are used to
calculate tan
–1
(y/x). ATAN(465) outputs the result in radians, so DEG(459)
is used to convert to degrees. The result is then output to D00219 and
D00218 as floating-point data.
4.
The data is converted back from floating-point to BCD.
a) First FIX(450) is used to temporarily convert the floating-point data to
binary data, and then BCD(024) is used to convert the binary data to
BCD data.
b) The distance r is output to D00100.
c)
The angle
θ
is output to D00101.
3-15-1 FLOATING TO 16-BIT: FIX(450)
Purpose
Converts a 32-bit floating-point value to 16-bit signed binary data and places
the result in the specified result word.
Ladder Symbol
Variations
DM Contents
D00000
#0100
D00001
#0100
x
y
D00100
0 1 4 1
D00101
0 0 4 5
r
(BCD)
(BCD)
(BCD)
(BCD)
Distance r =
Angle
θ
= tan
−
1
χ
2
y
2
+
y
χ
---
Calculations
Distance r =
Angle
θ
= tan
−
1
100
2
100
2
+
141.4214
=
100
100
----------
180
π
÷
×
45.0
=
Examples
FIX(450)
S
R
S
: First source word
R
: Result word
Variations
Executed Each Cycle for ON Condition
FIX(450)
Executed Once for Upward Differentiation
@FIX(450)
Executed Once for Downward Differentiation
Not supported.
Immediate Refreshing Specification
Not supported.
Содержание SYSMAC CS1D-CPU**
Страница 3: ...iv...
Страница 29: ...xxx...
Страница 185: ...146 List of Instructions by Function Code Section 2 4...
Страница 193: ...154 3 35 4 MOVE BIT MOVBC 568 1274 3 35 5 BIT COUNTER BCNTC 621 1276 3 35 6 GET VARIABLE ID GETID 286 1278...
Страница 1389: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2...
Страница 1390: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits...
Страница 1391: ...1352 ASCII Code Table Appendix A...