![Omron CVM1D Operation Manual Download Page 288](http://html1.mh-extra.com/html/omron/cvm1d/cvm1d_operation-manual_742532288.webp)
283
100
100
Calculations
Distance r =
Angle
θ
= tan
–1
(
y
x
)
Example
Distance r = = 141.4214
Angle
θ
= tan
–1
(
)
= 45.0
DM Contents
D00000
0 1 0 0
D00001
0 1 0 0
x
y
D00100
0 1 4 1
D00101
0 0 4 5
r
θ
x
2
)
y
2
Ǹ
100
2
)
100
2
Ǹ
1, 2, 3...
1. This instruction clears (i.e., sets to “0”) D00100 and D00101 so that the dis-
tance and angle result can be output to those words.
2. 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(100) 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
to D00203 and D00202.
d) The value of y that has been converted to floating-point data is output to
to D00205 and D00204.
3. 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.
4. In order to find the angle
θ
, Floating-point Math Instructions are used to cal-
culate 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.
5. 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(101) is used to convert the binary data to
BCD data.
b) The distance r is output to to D00100.
c) The angle
θ
is output to to D00101.
5-21-1 FLOATING TO 16-BIT: FIX(450)
(450)
FIX
S
R
Ladder Symbol
Variations
↑
FIX(450)
Operand Data Areas
S: First source word
CIO, G, A, T, C, #, DM
R: Result word
CIO, G, A, DM, DR, IR
When the execution condition OFF, FIX(450) is not executed. When the execu-
tion condition is ON, FIX(450) converts the 32-bit floating-point content of S and
S+1 to 16-bit binary data, and places the result in R.
S+1
S
R
Floating-point data (32 bits)
Binary data (16 bits)
Description
Floating-point Math Instructions
Section 5-21
Summary of Contents for CVM1D
Page 462: ...SYSMAC CVM1D Duplex System Programmable Controllers Operation Manual Revised August 2001...
Page 463: ...iv...
Page 465: ...vi...