545
BCOS, BCOSP
1
2
3
4
4
6
7
8
7.12
Special function
instructions
7.12.3
0
BCOS
, B
C
OSP
Operat
i
on
E
rror
(1) In any of the following cases, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into
SD0.
Program
E
xamp
l
e
(1) The following program calculates the cosine of the data designated by the 3 BCD digits from X20 to X2B and outputs the
integer part of the result to 1 BCD digit from Y50 to Y53, and the decimal fraction part of the result to the 4 BCD digits
from Y40 to Y4F.
Y60 is turned ON if the results of the operation are negative.
[Ladder Mode]
[List Mode]
[Operations involved when value designated by X20 to X2B is 430]
Error
code
Error details
Q00J/
Q00/
Q01
QnH
QnPH QnPRH
QnU
LCPU
4100
The data specified in is not a BCD value.
The data specified in is not in the range from 0 to 360.
––
4101
The points of the device specified in exceed those of the
corresponding device.
––
––
––
––
S
S
D
Processes so that the input
angle is
w
ithin 360° ( )
Executes COS operation ( )
Outputs the integer part of the operation
result to a display de
v
ice ( )
Outputs the decimal fraction part of the
operation result to a display de
v
ice ( )
Outputs the sign of the operation result
by ON or OFF ( )
1
2
3
4
5
Step
I
nstruct
i
on
De
vi
ce
X2B
BCD
v
alue
4 3 0
X20
B/ operation
B/
BCOS
operation
BCOS
O
U
T
D10
BCD
v
alue
(quotient)
0 0 0 1
D11
BCD
v
alue
(remainder)
0 0 7 0
D20
Transfer
MOV
D21
Transfer
MOV
D22
BCD
v
alue
0 0 0 0
BCD
v
alue
0 0 0 0
BCD
v
alue
3 4 2 0
Y4F
BCD
v
alue
3 4 2 0
Y40
Y53
BCD
v
alue
0
Y50
Y60 ON
1
2
3
4
5