7.12 Special Function Instructions
7.12.30 TAN
-1
operation on data in BCD format
7-299
7
APPLI
C
A
T
IO
N
INSTRUCTIONS
BA
TA
N
BATAN
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 specified for
is not a BCD value.
(Error code: 4100)
• The device specified for
exceeds the corresponding device range. (For Universal
model QCPU only)
(Error code: 4101)
Program Example
In the following program, the arctangent function is evaluated on the data in which X0 with
positive and negative signs (positive when X0 is OFF, and negative when X0 is ON), the integer
part in BCD 4 digits from X20 to X2F and the decimal fraction in BCD 4 digits from X30 to X3F,
and the evaluated angle is output in BCD 4 digits to the devices from Y40 to Y4F.
[Structured ladder]
[ST]
MOV(X0,1,D0);
MOV(NOT(X0),0,D0);
IF SM400 THEN
MOV(TRUE,K1X20,D1);
MOV(TRUE,K4X30,D2);
BATANP(TRUE,Var_D0,K4Y40);
END_IF;
[Operation example when the value 1.2654X0 is specified for X0 and X20 to X2F]
s
s
S
ets
the
s
i
gn
of
the
tangent
va
l
ue
. ( )
S
ets
the
d
ec
i
ma
l
fract
i
on
of
the
tangent
va
l
ue
. ( )
S
ets
the
i
nteger
part
of
the
tangent
va
l
ue
. ( )
E
va
l
uates
the
arctangent
funct
i
on
an
d
outputs
the
operat
i
on
resu
l
t
to
the
d
ev
i
ces
from
Y40
to
Y4F. ( )
1
2
3
4
B
C
D value
D
0
Transfer
MO
V
D
1
Transfer
MO
V
D
2
B
C
D value
0
0
0
0
B
C
D value
1
0
0
0
B
C
D value
4
5
6
2
X
30
B
C
D value
4
5
6
2
X
3
F
X
0
O
FF
B
A
T
A
N operation
Y4
0
2
5
0
0
Y4F
B
A
T
A
N
X
20
B
C
D value
1
0
0
0
X
2
F
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: ......