3 . I n s t r u c t i o n S e t
M N050 03003E F or mo re infor ma tio n vi sit:
w w w. e a t o n . c o m
3-105
API Mnemonic
Operands
Function
48
D SQR P
S, D
Square Root
Bit Devices
Word devices
Program Steps
Type
OP
X Y M S K H KnX KnY KnM KnS T
C D E
F
S
*
*
*
D
*
SQR, SQRP: 5 steps
DSQR, DSQRP: 9 steps
ELC ELCB
ELCM
PB PC/PA/PH
PV
PB PH/PA
32 16
P
32 16
P
32 16
P 32 16 P 32 16
P
Operands:
S
: Source
D
: Destination to store result
Description:
1.
Perform a square root on source
S
and store the result in
D
.
2.
S
can only be a positive value. Performing a square root operation on a negative value will
result in an error and the instruction will not be executed. The error flag M1067 and M1068 =
ON and D1067 records error code H0E1B.
3. SQR
result
D
is calculated as an integer only, fractional values are ignored. If the result of the
SQR is not a whole number, the Borrow flag M1021=ON.
4.
When SQR result
D
= 0, the Zero flag M1020=ON.
5.
Performing any square root operation (even on a calculator) on a negative number will result
in an error. This will result in M1067, the Program Execution Error bit being set.
Program Example:
When X20=ON, SQR of D0 will be stored in D12.
X20
SQR
D0
D12
D0
D12
Summary of Contents for ELC-PB
Page 1: ......
Page 5: ...For more information visit www eaton com MN05003003E iv...
Page 29: ...ELC Programming Manual For more information visit www eaton com MN05003003E 1 24 MEMO...
Page 502: ...3 Instruction Set MN05003003E For more information visit www eaton com 3 333...
Page 601: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 432...
Page 625: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 456...