DVP - ES2/EX2/SS2/SA2/SX2/SE Operation Manual - Programming

API

Mnemonic

Operands

Function

Controllers

48

D

SQR

 

P

 

 

 

 

Square Root

 

 

ES2/EX2

SS2

SA2

SX2

 

 

 

 

 

 

 

SE

 

Type

Bit Devices

 

 

 

Word devices

 

 

Program Steps

 

OP

 

X

Y

M

S

K

H KnX KnY KnM KnS T

C D

E

F SQR, SQRP: 5 steps

 

S

 

 

 

 

*

*

 

 

 

*

 

DSQR, DSQRP: 9 steps

 

D

 

 

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

 

 

 

 

 

PULSE

 

16-bit

 

 

32-bit

 

 

 

 

 

 

 

ES2/EX2

SS2

SA2

SX2 ES2/EX2

SS2

SA2

SX2 ES2/EX2

SS2

SA2

SX2

 

 

 

 

 

 

SE

SE

SE

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Operands:

S: Source device D: Device for storing the result

Explanation:

1.This instruction performs a square root operation on S and stores 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.The operation result D should be integer only, and the decimal will be left out. When decimal is left out, borrow flag M1021 = ON.

4.When the operation result D = 0, zero flag M1020 = ON.

Program Example:

When X20 = ON, square root of D0 will be stored in D12.

X20

SQR D0 D12

D0 D12

3 - 114

Page 230
Image 230
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Mnemonic Operands Function Controllers, Sqr