7.12 Special Function Instructions
7.12.1 SIN operation on floating-point data (single precision)
7-229
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
SI
N
SIN
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
(1) In the following program, the sine function is evaluated on the angle set in BCD 4 digits in
the devices from X20 to X2F, and the result is stored to Var_D0 as a floating-point real
number.
[Structured ladder]
[ST]
IF SM400 THEN
BIN(TRUE,K4X20,Var_D30);
FLT(TRUE,Var_D30,Var_D20);
RAD(TRUE,Var_D20,Var_D10);
SIN(TRUE,Var_D10,Var_D0);
END_IF;
[Operation example when the value of 150 is specified for X20 to X2F]
Inputs the angle data on which the sine function is
evaluated. ( )
Converts degrees to radians. ( )
Converts the input angle data to 32-bit floating-point
real number data. ( )
Sine operation on the converted angle data in radians. ( )
1
2
3
4
Ra
d
ian conversion
Floating-point real
number
Var_D20
RAD
S
IN operation
Floating-point real
number
Var_D10
S
IN
Floating-point real
number
Var_D0
X2F
BCD value
0
Var_D30
1 5 0
X20
BIN conversion
BIN
b15
b0
BIN value
Floating-point conversion
FLT
150
1 5 0
2 . 6 1 7 9 9 4
0 . 5 0 0 0 0 0
1
2
3
4
Содержание MELSEC Q Series
Страница 1: ...Structured Programming Manual Mitsubishi Programmable Controller QCPU Common Instructions ...
Страница 2: ......
Страница 14: ...A 12 MEMO ...
Страница 340: ...6 178 MEMO MTR ...
Страница 708: ...7 368 MEMO ...
Страница 776: ...8 68 MEMO ...
Страница 796: ...9 20 MEMO ...
Страница 804: ...App 8 MEMO ...
Страница 812: ...Index 8 MEMO ...
Страница 815: ......