7.12 Special Function Instructions
7.12.15 Radian to degree conversion on floating-point data (single precision)
7-259
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
DEG
DEG
O
peration Error
In any of the following cases, an operation error occurs, the error flag (SM0) is turned ON, and
the corresponding error code is stored to SD0.
• The value of the specified device is 0.
*1
(Error code: 4100)
*1: There are CPU modules that will not result in an operation error if 0 is specified. For details, refer to
Section 3.4.4.
• The operation result exceeds the following range. (An overflow occurs.)
(For Universal model QCPU only)
2
128
| operation result |
(Error code: 4141)
• The value of the specified device is 0, unnormalized number, nonnumeric or
±∞
.
(For Universal model QCPU only)
(Error code: 4140)
Program Example
In the following program, the radian value set as a floating-point real number in Var_D20 is
converted to degrees, and the result is output to Y40 to Y4F as a BCD value.
[Structured ladder]
[ST]
IF SM400 THEN
DEG(TRUE,Var_D20,Var_D10);
INT(TRUE,Var_D10,Var_D0);
BCD(TRUE,Var_D0,K4Y40);
END_IF;
[Operation example when the value of 1.435792 is set for Var_D20]
Converts
ra
di
ans
to
d
egrees
. ( )
O
utputs
the
ang
l
e
d
ata
converte
d
to
i
nteger
va
l
ue
to
the
di
sp
l
ay
. ( )
Converts
the
ang
l
e
d
ata
i
n
32
-
b
i
t
f
l
oat
i
ng
-
po
i
nt
rea
l
number
to
i
nteger
va
l
ue
. ( )
1
2
3
Ang
l
e
convers
i
on
D
E
G
BCD
convers
i
on
BCD
Var
_
D20
Var
_
D10
B
IN
convers
i
on
INT
Var
_
D0
b15
b0
B
IN
va
l
ue
82
Y4F
BCD
va
l
ue
0 0 8 2
Y4
0
Fl
oat
i
ng
-
po
i
nt
rea
l
number
Fl
oat
i
ng
-
po
i
nt
rea
l
number
1
. 4
3 5 7 9 2
8 2
.
2 6
4
8 2
1
2
3
Summary of Contents for MELSEC Q Series
Page 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Page 2: ......
Page 14: ...A 12 MEMO ...
Page 340: ...6 178 MEMO MTR ...
Page 708: ...7 368 MEMO ...
Page 776: ...8 68 MEMO ...
Page 796: ...9 20 MEMO ...
Page 804: ...App 8 MEMO ...
Page 812: ...Index 8 MEMO ...
Page 815: ......