Floating-point Math Instructions
5-24-1 FLOATING TO 16-BIT: FIX(––)
Limitations
352
Calculations
2
Distance r = √ x
(
Angle
= tan
–1
DM Contents
DM 0000
0100
(BCD)
DM 0001
0100
(BCD)
1. This section of the program converts the data from BCD to floating-point.
a) The data area from DM 0200 onwards is used as a work area.
b) First BIN(23) is used to temporarily convert the BCD data to binary da-
ta, and then FLT(––) 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 DM 0203 and DM 0202.
d) The value of y that has been converted to floating-point data is output
to DM 0205 and DM 0204.
2. In order to find the distance r, Floating-point Math Instructions are used to
calculate the square root of x
and DM 0212 as floating-point data.
3. In order to find the angle θ , Floating-point Math Instructions are used to
–1
calculate tan
(y/x). ATAN(––) outputs the result in radians, so DEG(––) is
used to convert to degrees. The result is then output to DM 0219 and DM
0218 as floating-point data.
4. The data is converted back from floating-point to BCD.
a) First FIX(––) is used to temporarily convert the floating-point data to bi-
nary data, and then BCD(024) is used to convert the binary data to
BCD data.
b) The distance r is output to DM 0100.
c) The angle θ is output to DM 0101.
Ladder Symbols
FIX(−−)
@FIX(−−)
S
R
000
The content of S+1 and S must be floating-point data and the integer portion
must be in the range of –32,768 to 32,767.
DM 6144 to DM 6655 cannot be used for R.
Example
2
+ y
Distance r = √ 100
y
)
Angle
= tan
x
x
DM 0100 0 1 4 1
y
DM 0101 0 0 4 5
2
2
+y
. The result is then output to DM 0213
IR, SR, AR, DM, EM, HR, TIM/CNT, LR
S
IR, SR, AR, DM, EM, HR, LR
R
Third operand: Always 000
000
Section 5-24
2
2
+ 100
= 141.4214
100
(
)
= 45.0
–1
100
r
θ
Operand Data Areas
S: First source word
R: Result word
−−−
Need help?
Do you have a question about the CQM1H - PROGRAM and is the answer not in the manual?