Справочник Пользователя для Mitsubishi Electronics FX

Скачать
Страница из 382
FX Series Programmable Controlers
Applied Instructions 5
5-127
5.12.1
SIN (FNC 130)
Contents:
This instruction performs the mathematical SIN
operation on the floating point value in S. The
result is stored in D.
Points to note:
a) The instruction must use the double word format: i.e., DSIN or DSINP. All source and
destination data will be double word; i.e., uses two consecutive data registers to store the
data (32 bits).
The source data is regarded as being in floating point format and the destination is also in
floating point format.
b) The source value must be an angle between 0 to 360 degrees in radians; i.e.,
0
° ≤ 
S< 360
°
Radian Angles
Below is an program example of how to calculate angles in radians using floating point.
Mnemonic
Function 
Operands
Program steps
S
D
SIN
FNC 130
(Sine)
Calculates the
sine of a floating
point value
D - must be in floating
point number format
(32 bits).(radians)
D - a floating point 
value
(32 bits). 
DSIN,
DSINP:
9 steps
FX
0(S)
FX
0N
FX FX
(2C)
FX
2N(C)
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
PULSE-P
FX
(2C)
FX
FX
2N(C)
FX
0N
FX
0(s)
16 BIT OPERATION
FX
FX
0N
FX
0(s)
FX
(2C)
FX
2N(C)
32 BIT OPERATION
DSIN
X03
D510 D314
X001
K45
D0
MOVP
X002
D0
D4
FLT
K90
D0
MOVP
M8000
K31415926 K1800000000
D20
DEDIV
D4
D20
D30
DEMUL
D30
D100
DSIN
[ S ]
[ D ]
K45 degrees to D0
Convert D0 to float in D4,D5
K90 degrees to D0
Calculate 
π
 in radians (
π
/180)
Store as a float in D20,D21
Calculate angle in radians in D30,D31
(deg
° × π
/180 = rads)
Calculate SIN of angle in D100