EasyManuals Logo

Omron CJ - INSTRUCTIONS User Manual

Omron CJ - INSTRUCTIONS
1308 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #509 background imageLoading...
Page #509 background image
471
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Floating-point Math Instructions
3
Floating-point Math Instructions
Example Programming
Calculations
Distance r =
Angle θ = tan
−1
Example: Given the coordinates (100, 100),
the distance r and the angle θ can
be calculated from the above
equation.
Distance r =
Angle θ = tan
−1
(1) This section of the program converts the data from
BCD to floating-point.
• The data area from D200 onwards is used as a
work area.
• 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.
• The value of x that has been converted to floating-
point data is output to D203 and D202.
• The value of y that has been converted to floating-
point data is output to D205 and D204.
(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 D213 and D212
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 D219 and D218 as floating-point
data.
(4) The data is converted back from floating-point to
BCD.
• 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.
• The distance r is output to D100.
• The angle θ is output to D101.
(2)
(3)
(4)
(1)
D0
D200
D01
D201
D201
D204
D202
D202
D206
D204
D204
D208
D206
D208
D210
D210
D212
D204
D202
D214
D214
D216
D216
D218
D212
D220
D218
D221
D220
D100
D221
D101
D200
D202
0.00
x
2
y
2
+
y
x
---


100
2
100
2
+ 141.4214=
100
100
----------


180 π÷× 45.0=
DM Contents
D0
#0100
#0141
#0045
D1 #0100
x
y
D100
D101
r
(BCD)
(BCD)
(BCD)
(BCD)

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron CJ - INSTRUCTIONS and is the answer not in the manual?

Omron CJ - INSTRUCTIONS Specifications

General IconGeneral
BrandOmron
ModelCJ - INSTRUCTIONS
CategoryController
LanguageEnglish

Related product manuals