Mitsubishi MELSEC Q Series Programming Manual page 680

Common instruction 1/2
Hide thumbs Also See for MELSEC Q Series:
Table of Contents

Advertisement

BSQR(P),BDSQR(P)
BDSQR
(1) Calculates the square root of the values designated by
the device designated by
(2) BCD value of a maximum of 8 digits (0 to 99999999) can be designated by
(3) The operation results of
0 and 9999.
(4) Operation results are rounded off from the fifth decimal place.
For this reason, the fourth decimal place has an error of
Operation Error
(1) In the following case, an operation error occurs, the error flag (SM0) turns ON, and an error
code is stored into SD0.
• The data designated by
Program Example
(1) The following program calculates the square root of BCD value 1325 and outputs the integer
part to the 4 BCD digits from Y50 to Y5F, and the decimal fraction part to the 4 BCD digits
from Y40 to Y4F.
[Ladder Mode]
[List Mode]
Step
[Operation]
1325
H
7-306
.
D
S
S
(
+1
)
2-word data
and
+1 are stored as their respective BCD values of between
D
D
is not a BCD value.
S
Instruction
Device
D0
BSQR operation
1 3 2 5
MOV
BCD value
BSQR
and
+1 and stores the results at
S
S
D
D
+1
Integer part
Decimal fraction part
.
±
1.
Sets the data used for
square root operation (
)
1
Executes square root operation (
Outputs the integer part of the operation
result to a display device (
)
3
Outputs the decimal fraction part of the
operation result to a display device (
D1
Transfer
Y5F
0 0 3 6
0 0 3 6
BCD value
BCD value
D2
Transfer
Y4F
4 0 0 5
4 0 0 5
MOV
BCD value
BCD value
and
+1.
S
S
(Error code: 4100)
)
2
)
4
Y50
Integer part
Y40
Decimal fraction part

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec l series

Table of Contents