beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 441

background image

8 Application Instructions API 100-149

DVP-PLC Application Manual

8-39

API Mnemonic Operands

Function

127

D ESQR P

Floating Point Square Root

Controllers

ES/EX/SS SA/SX/SC EH/SV

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

*

DESQR, DESQRP: 9 steps

PULSE 16-bit 32-bit

ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV ES EX SS SA SX SC EH SV

Operands:

S

: Source device D: Operation result

Explanations:

1. Range

of

S

: ≥ 0

2. See the specifications of each model for their range of use.

3. Flags: M1020 (zero flag); M1067 (operation error)

4. This instruction performs a square root operation on the content in the register designated by S and stores the

result in the register designated by D. The square root operation is performed in floating point system.

5. If

S

is an designated constant K or H, the instruction will convert the constant into a binary floating point value

before the operation.

6. If the result of the operation = 0, the zero flag M1020 = On.

7. S can only be a positive value. Performing any square root operation on a negative value will result in an

“operation error” and this instruction will not be executed. M1067 and M1068 will be On and D1067 will record

the error code H’0E1B.

Program Example 1:

When M0 = On, calculate the square root of the binary floating point (D1, D0) and store the result in register (D11,

D10).

D0

DESQR

X0

D10

(D1, D0) (D11 D10)

,

binary floating point

binary floating point

Program Example 2:

When M2 = On, calculate the square root of K1,234 (automatically converted into binary floating point) and store the

result in register (D11, D10).

K1234

DESQR

X2

D10

Remarks:

For floating point operations, see “5.3 Handling of Numeric Values”.