Mitsubishi Electronics FX2C Home Theater Server User Manual


 
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 floatin
g
point value in S. The
result is stored in D.
Points to note:
a) The instruction must use the double word format: i.e.,
D
SIN or
D
SINP. All source and
destination data will be double word; i.e., uses two consecutive data re
g
isters to store the
data (32 bits).
The source data is re
g
arded as bein
g
in floatin
g
point format and the destination is also in
floatin
g
point format.
b) The source value must be an an
g
le between 0 to 360 de
g
rees in radians; i.e.,
0
° ≤
S< 360
°
Radian Angles
Below is an pro
g
ram example of how to calculate an
g
les in radians usin
g
floatin
g
point.
Mnemonic Function
Operands
Program steps
SD
SIN
FNC 130
(Sine)
Calculates the
sine of a floatin
g
point value
D - must be in floatin
g
point number format
(32 bits).(radians)
D - a floatin
g
point
value
(32 bits).
DSIN,
DSINP:
9 steps
DSIN
X03
D510
D314
X001
K45 D0MOVP
X002
D0 D4FLT
K90 D0MOVP
M8000
K31415926 K1800000000
D20DEDIV
D4
D20 D30
DEMUL
D30 D100DSIN
[ S ] [ D ]
K45 de
g
rees to D0
Convert D0 to float in D4,D5
K90 de
g
rees to D0
Calculate
π
in radians (
π
/180)
Store as a float in D20,D21
Calculate an
g
le in radians in D30,D31
(de
g
° × π
/180 = rads)
Calculate SIN of an
g
le in D100